大宝管理后台代码
ne1
zzzz
2024-04-07 69ff731fbacf2f2ae16f98a355506bfeb01dd567
src/views/managesettings/managelist.vue
@@ -17,20 +17,17 @@
            <a-col :md="12" :lg="6" :sm="24">
              <a-form-item>
                <span class="table-page-search-submitButtons">
                  <a-button @click="getqueryParam" icon="redo">
                    重置</a-button>
                  <a-button @click="getqueryParam" icon="redo"> 重置</a-button>
                  <a-button
                    type="primary"
                    icon="search"
                    style="margin-left: 8px"
                    @click="queryParam.pageNum = 1, getlist()">查询
                    @click=";(queryParam.pageNum = 1), getlist()"
                    >查询
                  </a-button>
                  <a-button
                    type="primary"
                    icon="plus"
                    style="margin-left: 8px"
                    @click="addUserdialog = true">
                    添加管理</a-button>
                  <a-button type="primary" icon="plus" style="margin-left: 8px" @click="addUserdialog = true">
                    添加管理</a-button
                  >
                </span>
              </a-form-item>
            </a-col>
@@ -46,7 +43,8 @@
        :pagination="pagination"
        :columns="columns"
        :data-source="datalist"
        rowKey="id">
        rowKey="id"
      >
        <span slot="isLock" slot-scope="text,record">
          <template>
            <div>
@@ -58,9 +56,8 @@
        </span>
        <template slot="action" slot-scope="text,record">
          <a slot="action" href="javascript:;" @click="getisLock(record.id, record.isLock)">{{ record.isLock
            == 0 ? '锁定用户' :
              '解锁用户'
          <a slot="action" href="javascript:;" @click="getisLock(record.id, record.isLock)">{{
            record.isLock == 0 ? '锁定用户' : '解锁用户'
          }}</a>
          <a-divider type="vertical" />
          <a slot="action" href="javascript:;" @click="geteditStock(record)">修改密码</a>
@@ -74,27 +71,32 @@
      :visible="addUserdialog"
      :confirmLoading="addUserDialogloading"
      @ok="OkaddUserdialog"
      @cancel="CanceladdUserdialog">
      @cancel="CanceladdUserdialog"
    >
      <a-form :form="addUserform" ref="addUserform">
        <a-form-item label="管理员名" :labelCol="labelCol" :wrapperCol="wrapperCol">
          <a-input
            placeholder="请输入管理员名"
            v-decorator="['adminName', { rules: [{ required: true, message: '请输入管理员名', }] }]" />
            v-decorator="['adminName', { rules: [{ required: true, message: '请输入管理员名' }] }]"
          />
        </a-form-item>
        <a-form-item label="管理员手机号" :labelCol="labelCol" :wrapperCol="wrapperCol">
          <a-input
            placeholder="请输入管理员手机号"
            v-decorator="['adminPhone', { rules: [{ required: true, message: '请输入管理员手机号', }] }]" />
            v-decorator="['adminPhone', { rules: [{ required: true, message: '请输入管理员手机号' }] }]"
          />
        </a-form-item>
        <a-form-item label="管理员密码" :labelCol="labelCol" :wrapperCol="wrapperCol">
          <a-input
            placeholder="请输入管理员密码"
            v-decorator="['adminPwd', { rules: [{ required: true, message: '请输入管理员密码', }] }]" />
            v-decorator="['adminPwd', { rules: [{ required: true, message: '请输入管理员密码' }] }]"
          />
        </a-form-item>
        <a-form-item label="管理员状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
          <a-select
            placeholder="请选择管理员状态"
            v-decorator="['isLock', { rules: [{ required: true, message: '请选择管理员状态', }] }]">
            v-decorator="['isLock', { rules: [{ required: true, message: '请选择管理员状态' }] }]"
          >
            <a-select-option value="0">正常</a-select-option>
            <a-select-option value="1">锁定</a-select-option>
          </a-select>
@@ -108,18 +110,21 @@
      :visible="editStockdialog"
      :confirmLoading="editStockdialogloading"
      @ok="OkeditStockdialog"
      @cancel="CanceleditStockdialog">
      @cancel="CanceleditStockdialog"
    >
      <a-form :form="editStockform" ref="editStockform">
        <a-form-item label="用户ID" :labelCol="labelCol" :wrapperCol="wrapperCol">
          <a-input
            placeholder="请输入用户ID"
            disabled
            v-decorator="['id', { rules: [{ required: true, message: '请输入用户ID', }] }]" />
            v-decorator="['id', { rules: [{ required: true, message: '请输入用户ID' }] }]"
          />
        </a-form-item>
        <a-form-item label="密码" :labelCol="labelCol" :wrapperCol="wrapperCol">
          <a-input
            placeholder="请输入密码"
            v-decorator="['adminPwd', { rules: [{ required: true, message: '请输入密码', }] }]" />
            v-decorator="['adminPwd', { rules: [{ required: true, message: '请输入密码' }] }]"
          />
        </a-form-item>
      </a-form>
    </a-modal>
@@ -136,23 +141,23 @@
                {
                    title: 'id',
                    dataIndex: 'id',
                    align: 'center'
          align: 'center',
                },
                {
                    title: '管理员姓名',
                    dataIndex: 'adminName',
                    align: 'center'
          align: 'center',
                },
                {
                    title: '管理员手机号',
                    dataIndex: 'adminPhone',
                    align: 'center'
          align: 'center',
                },
                {
                    title: '管理员状态',
                    dataIndex: 'isLock',
                    align: 'center',
                    scopedSlots: { customRender: 'isLock' }
          scopedSlots: { customRender: 'isLock' },
                },
                {
@@ -161,14 +166,14 @@
                    align: 'center',
                    customRender: (text, row, index) => {
                        return text ? moment(text).format('YYYY-MM-DD HH:mm:ss') : ''
                    }
          },
                },
                {
                    title: '操作',
                    key: 'action',
                    align: 'center',
                    scopedSlots: { customRender: 'action' }
                }
          scopedSlots: { customRender: 'action' },
        },
            ],
            // 表头
            pagination: {
@@ -178,23 +183,23 @@
                pageSizeOptions: ['10', '20', '50', '100'], // 每页中显示的数据
                onShowSizeChange: (current, pageSize) => this.onSizeChange(current, pageSize), // 改变每页数量时更新显示
                onChange: (page, pageSize) => this.onPageChange(page, pageSize), // 点击页码事件
                showTotal: total => `共有 ${total} 条数据` // 分页中显示总的数据
        showTotal: (total) => `共有 ${total} 条数据`, // 分页中显示总的数据
            },
            loading: false,
            queryParam: {
                pageNum: 1,
                pageSize: 10,
                adminName: '',
                adminPhone: ''
        adminPhone: '',
            },
            datalist: [],
            labelCol: {
                xs: { span: 24 },
                sm: { span: 7 }
        sm: { span: 7 },
            },
            wrapperCol: {
                xs: { span: 24 },
                sm: { span: 13 }
        sm: { span: 13 },
            },
            addUserform: this.$form.createForm(this),
            addUserdialog: false,
@@ -203,7 +208,7 @@
            editStockdialog: false,
            editStockdialogloading: false,
            editStockform: this.$form.createForm(this),
            fields: ['id', 'adminPwd']
      fields: ['id', 'adminPwd'],
        }
    },
    created () {
@@ -212,8 +217,8 @@
    methods: {
        geteditStock (val) {
            this.editStockdialog = true
            this.fields.forEach(v => this.editStockform.getFieldDecorator(v))
            this.editStockform.setFieldsValue(({ id: val.id }))
      this.fields.forEach((v) => this.editStockform.getFieldDecorator(v))
      this.editStockform.setFieldsValue({ id: val.id })
        },
        CanceleditStockdialog () {
            this.editStockdialog = false
@@ -226,14 +231,14 @@
                if (!errors) {
                    this.editStockdialogloading = true
                    values.adminPwd = this.editStockform.getFieldValue('adminPwd')
                    adminupdate(values).then(res => {
          adminupdate(values).then((res) => {
                        if (res.status == 0) {
                            this.editStockdialog = false
                            this.$message.success({ content: res.msg, duration: 2 })
              this.$message.success(res.msg)
                            form.resetFields()
                            this.getlist()
                        } else {
                            this.$message.error({ content: res.msg })
              this.$message.error(res.msg)
                        }
                        this.editStockdialogloading = false
                    })
@@ -252,14 +257,14 @@
            form.validateFields((errors, values) => {
                if (!errors) {
                    this.addUserDialogloading = true
                    adminadd(values).then(res => {
          adminadd(values).then((res) => {
                        if (res.status == 0) {
                            this.addUserdialog = false
                            this.$message.success({ content: res.msg, duration: 2 })
              this.$message.success(res.msg)
                            form.resetFields()
                            this.getlist()
                        } else {
                            this.$message.error({ content: res.msg })
              this.$message.error(res.msg)
                        }
                        this.addUserDialogloading = false
                    })
@@ -271,12 +276,12 @@
                pageNum: 1,
                pageSize: 10,
                adminName: '',
                adminPhone: ''
        adminPhone: '',
            }
        },
        getlist () {
            this.loading = true
            adminlist(this.queryParam).then(res => {
      adminlist(this.queryParam).then((res) => {
                this.datalist = res.data.list
                this.pagination.total = res.data.total
                this.loading = false
@@ -284,7 +289,7 @@
        },
        // 股票的锁定解锁
        getisLock (idval, isLockval) {
            adminupdateLock({ adminId: idval }).then(res => {
      adminupdateLock({ adminId: idval }).then((res) => {
                if (res.status === 0) {
                    this.getlist()
                    if (isLockval == 0) {
@@ -305,7 +310,7 @@
            this.queryParam.pageNum = current
            this.queryParam.pageSize = pageSize
            this.getlist()
        }
    }
    },
  },
}
</script>