大宝管理后台代码
ne1
zzzz
2024-04-07 69ff731fbacf2f2ae16f98a355506bfeb01dd567
src/views/product/baseCurrency.vue
@@ -17,22 +17,26 @@
            <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; currentDetails = ''">
                    添加基础货币</a-button>
                    @click="
                      addUserdialog = true
                      currentDetails = ''
                    "
                  >
                    添加基础货币</a-button
                  >
                </span>
              </a-form-item>
            </a-col>
@@ -48,8 +52,8 @@
        :pagination="pagination"
        :columns="columns"
        :data-source="datalist"
        rowKey="id">
        rowKey="id"
      >
        <span slot="dynamicRate" slot-scope="text,record">
          <template>
            <div>
@@ -82,27 +86,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="['coinName', { rules: [{ required: true, message: '请输入基币名称', }] }]" />
            v-decorator="['coinName', { rules: [{ required: true, message: '请输入基币名称' }] }]"
          />
        </a-form-item>
        <a-form-item label="基币代码" :labelCol="labelCol" :wrapperCol="wrapperCol">
          <a-input
            placeholder="请输入基币代码"
            v-decorator="['coinCode', { rules: [{ required: true, message: '请输入基币代码', }] }]" />
            v-decorator="['coinCode', { rules: [{ required: true, message: '请输入基币代码' }] }]"
          />
        </a-form-item>
        <a-form-item label="默认汇率" :labelCol="labelCol" :wrapperCol="wrapperCol">
          <a-input
            placeholder="请输入默认汇率"
            v-decorator="['defaultRate', { rules: [{ required: true, message: '请输入默认汇率', }] }]" />
            v-decorator="['defaultRate', { rules: [{ required: true, message: '请输入默认汇率' }] }]"
          />
        </a-form-item>
        <a-form-item label="启用动态行情" :labelCol="labelCol" :wrapperCol="wrapperCol">
          <a-select
            placeholder="请选择启用动态行情"
            v-decorator="['dynamicRate', { rules: [{ required: true, message: '请选择启用动态行情', }] }]">
            v-decorator="['dynamicRate', { rules: [{ required: true, message: '请选择启用动态行情' }] }]"
          >
            <a-select-option :value="0">启用动态汇率值</a-select-option>
            <a-select-option :value="1">使用默认汇率值</a-select-option>
          </a-select>
@@ -110,7 +119,8 @@
        <a-form-item label="是否可用" :labelCol="labelCol" :wrapperCol="wrapperCol">
          <a-select
            placeholder="请选择是否可用"
            v-decorator="['isUse', { rules: [{ required: true, message: '请选择是否可用', }] }]">
            v-decorator="['isUse', { rules: [{ required: true, message: '请选择是否可用' }] }]"
          >
            <a-select-option :value="0">不可用</a-select-option>
            <a-select-option :value="1">可用</a-select-option>
          </a-select>
@@ -135,34 +145,34 @@
                    width: 200,
                    customRender: (text, row, index) => {
                        return `${row.coinName}(${row.coinCode})`
                    }
          },
                },
                {
                    title: '基础货币Gid',
                    dataIndex: 'coinGid',
                    align: 'center'
          align: 'center',
                },
                {
                    title: '当前汇率',
                    dataIndex: 'nowPrice',
                    align: 'center'
          align: 'center',
                },
                {
                    title: '默认汇率',
                    dataIndex: 'defaultRate',
                    align: 'center'
          align: 'center',
                },
                {
                    title: '汇率使用',
                    dataIndex: 'dynamicRate',
                    align: 'center',
                    scopedSlots: { customRender: 'dynamicRate' }
          scopedSlots: { customRender: 'dynamicRate' },
                },
                {
                    title: '是否可用',
                    dataIndex: 'isUse',
                    align: 'center',
                    scopedSlots: { customRender: 'isUse' }
          scopedSlots: { customRender: 'isUse' },
                },
                {
                    title: '添加时间',
@@ -171,7 +181,7 @@
                    width: 180,
                    customRender: (text, row, index) => {
                        return text ? moment(text).format('YYYY-MM-DD HH:mm:ss') : ''
                    }
          },
                },
                {
                    title: '操作',
@@ -179,8 +189,8 @@
                    align: 'center',
                    fixed: 'right',
                    width: 150,
                    scopedSlots: { customRender: 'action' }
                }
          scopedSlots: { customRender: 'action' },
        },
            ],
            // 表头
            pagination: {
@@ -190,14 +200,14 @@
                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,
                coinCode: '',
                coinName: ''
        coinName: '',
            },
            datalist: [],
@@ -206,14 +216,14 @@
            addUserform: this.$form.createForm(this),
            labelCol: {
                xs: { span: 24 },
                sm: { span: 7 }
        sm: { span: 7 },
            },
            wrapperCol: {
                xs: { span: 24 },
                sm: { span: 13 }
        sm: { span: 13 },
            },
            fields: ['coinName', 'coinCode', 'defaultRate', 'dynamicRate', 'isUse'],
            currentDetails: ''
      currentDetails: '',
        }
    },
    created () {
@@ -223,7 +233,7 @@
        geteditbaseCurrency (val) {
            this.currentDetails = val
            this.addUserdialog = true
            this.fields.forEach(v => this.addUserform.getFieldDecorator(v))
      this.fields.forEach((v) => this.addUserform.getFieldDecorator(v))
            this.addUserform.setFieldsValue(pick(val, this.fields))
        },
        CanceladdUserdialog () {
@@ -238,28 +248,28 @@
                    this.addUserDialogloading = true
                    if (this.currentDetails != '') {
                        values.id = this.currentDetails.id
                        coinupdate(values).then(res => {
            coinupdate(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
                        })
                    } else {
                        values.id = 0
                        values.coinGid = 'fx_s' + this.addUserform.getFieldValue('coinCode') + 'cny',
                            coinadd(values).then(res => {
            ;(values.coinGid = 'fx_s' + this.addUserform.getFieldValue('coinCode') + 'cny'),
              coinadd(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
                            })
@@ -272,12 +282,12 @@
                pageNum: 1,
                pageSize: 10,
                coinCode: '',
                coinName: ''
        coinName: '',
            }
        },
        getlist () {
            this.loading = true
            coinlist(this.queryParam).then(res => {
      coinlist(this.queryParam).then((res) => {
                this.datalist = res.data.list
                this.pagination.total = res.data.total
                this.loading = false
@@ -291,8 +301,8 @@
            this.queryParam.pageNum = current
            this.queryParam.pageSize = pageSize
            this.getlist()
        }
    }
    },
  },
}
</script>
<style scoped>