大宝管理后台代码
ne1
zzzz
2024-04-07 69ff731fbacf2f2ae16f98a355506bfeb01dd567
src/views/newshares/newshareslist.vue
@@ -33,26 +33,26 @@
            </a-col>
          </a-row>
          <a-row :gutter="48">
            <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, pagination.current = page,getlist()">查询
                    @click=";(queryParam.pageNum = 1), (pagination.current = page), getlist()"
                    >查询
                  </a-button>
                  <a-button
                    type="primary"
                    icon="plus"
                    style="margin-left: 8px"
                    @click="addUserdialog = true, currentdetail = ''">
                    添加新股</a-button>
                    @click=";(addUserdialog = true), (currentdetail = '')"
                  >
                    添加新股</a-button
                  >
                </span>
              </a-form-item>
            </a-col>
@@ -68,13 +68,13 @@
        :pagination="pagination"
        :columns="columns"
        :data-source="datalist"
        rowKey="newlistId">
        rowKey="newlistId"
      >
        <span slot="name" slot-scope="text,record">
          <template>
            <div>
              <span style="margin-right:10px">{{ record.name }}</span>
              <a-tag color="green">{{ record.code }}
              </a-tag>
              <a-tag color="green">{{ record.code }} </a-tag>
            </div>
          </template>
        </span>
@@ -99,11 +99,8 @@
        <span slot="stockType" slot-scope="text,record">
          <template>
            <div>
              <a-tag
                :color="record.stockType == 'sh' ? 'purple' : record.stockType == 'sz' ? 'blue' : ''">
                {{ record.stockType == 'sh' ? '沪股' : record.stockType == 'sz' ? '深股' :
                  record.stockType
                }}
              <a-tag :color="record.stockType == 'sh' ? 'purple' : record.stockType == 'sz' ? 'blue' : ''">
                {{ record.stockType == 'sh' ? '沪股' : record.stockType == 'sz' ? '深股' : record.stockType }}
              </a-tag>
            </div>
          </template>
@@ -123,21 +120,24 @@
      :visible="addUserdialog"
      :confirmLoading="addUserDialogloading"
      @ok="OkaddUserdialog"
      @cancel="CanceladdUserdialog">
      @cancel="CanceladdUserdialog"
    >
      <a-form :form="addUserform" ref="addUserform">
        <a-row :gutter="48">
          <a-col :md="12" :lg="12" :sm="12">
            <a-form-item label="新股名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                placeholder="请输入新股名称"
                v-decorator="['name', { rules: [{ required: true, message: '请输入新股名称', }] }]" />
                v-decorator="['name', { rules: [{ required: true, message: '请输入新股名称' }] }]"
              />
            </a-form-item>
          </a-col>
          <a-col :md="12" :lg="12" :sm="12">
            <a-form-item label="新股代码" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                placeholder="请输入新股代码"
                v-decorator="['code', { rules: [{ required: true, message: '请输入新股代码', }] }]" />
                v-decorator="['code', { rules: [{ required: true, message: '请输入新股代码' }] }]"
              />
            </a-form-item>
          </a-col>
        </a-row>
@@ -146,14 +146,16 @@
            <a-form-item label="新股价格" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                placeholder="请输入新股价格"
                v-decorator="['price', { rules: [{ required: true, message: '请输入新股价格', }] }]" />
                v-decorator="['price', { rules: [{ required: true, message: '请输入新股价格' }] }]"
              />
            </a-form-item>
          </a-col>
          <a-col :md="12" :lg="12" :sm="12">
            <a-form-item label="最大购买数量" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                placeholder="请输入最大购买数量"
                v-decorator="['orderNumber', { rules: [{ required: true, message: '请输入最大购买数量', }] }]" />
                v-decorator="['orderNumber', { rules: [{ required: true, message: '请输入最大购买数量' }] }]"
              />
            </a-form-item>
          </a-col>
        </a-row>
@@ -162,7 +164,8 @@
            <a-form-item label="股票类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-select
                placeholder="请选择股票类型"
                v-decorator="['stockType', { rules: [{ required: true, message: '请选择股票类型', }] }]">
                v-decorator="['stockType', { rules: [{ required: true, message: '请选择股票类型' }] }]"
              >
                <a-select-option :value="'nse'">nse</a-select-option>
                <a-select-option :value="'bse'">bse</a-select-option>
              </a-select>
@@ -172,7 +175,8 @@
            <a-form-item label="新股模式" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-select
                placeholder="请选择新股模式"
                v-decorator="['type', { rules: [{ required: true, message: '请选择新股模式', }] }]">
                v-decorator="['type', { rules: [{ required: true, message: '请选择新股模式' }] }]"
              >
                <a-select-option :value="1">新股申购</a-select-option>
                <a-select-option :value="2">线下配售</a-select-option>
              </a-select>
@@ -184,7 +188,8 @@
            <a-form-item label="显示状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-select
                placeholder="请选择显示状态"
                v-decorator="['zt', { rules: [{ required: true, message: '请选择显示状态', }] }]">
                v-decorator="['zt', { rules: [{ required: true, message: '请选择显示状态' }] }]"
              >
                <a-select-option :value="0">显示</a-select-option>
                <a-select-option :value="1">隐藏</a-select-option>
              </a-select>
@@ -196,8 +201,9 @@
                show-time
                style="width:100%"
                @change="getsubscribeTime"
                v-decorator="['subscribeTime', { rules: [{ required: true, message: '请填写申购时间', }] }]"
                format="YYYY-MM-DD HH:mm:ss">
                v-decorator="['subscribeTime', { rules: [{ required: true, message: '请填写申购时间' }] }]"
                format="YYYY-MM-DD HH:mm:ss"
              >
              </a-date-picker>
            </a-form-item>
          </a-col>
@@ -209,8 +215,9 @@
                show-time
                style="width:100%"
                @change="getsubscriptionTime"
                v-decorator="['subscriptionTime', { rules: [{ required: true, message: '请填写认缴时间', }] }]"
                format="YYYY-MM-DD HH:mm:ss">
                v-decorator="['subscriptionTime', { rules: [{ required: true, message: '请填写认缴时间' }] }]"
                format="YYYY-MM-DD HH:mm:ss"
              >
              </a-date-picker>
            </a-form-item>
          </a-col>
@@ -239,12 +246,12 @@
                    title: '新股名称 / 新股代码',
                    dataIndex: 'name',
                    align: 'center',
                    scopedSlots: { customRender: 'name' }
          scopedSlots: { customRender: 'name' },
                },
                {
                    title: '最大购买数量',
                    dataIndex: 'orderNumber',
                    align: 'center'
          align: 'center',
                },
                // {
                //     title: '预估价格',
@@ -254,25 +261,25 @@
                {
                    title: '价格',
                    dataIndex: 'price',
                    align: 'center'
          align: 'center',
                },
                {
                    title: '是否显示',
                    dataIndex: 'zt',
                    align: 'center',
                    scopedSlots: { customRender: 'zt' }
          scopedSlots: { customRender: 'zt' },
                },
                {
                    title: '新股模式',
                    dataIndex: 'type',
                    align: 'center',
                    scopedSlots: { customRender: 'type' }
          scopedSlots: { customRender: 'type' },
                },
                {
                    title: '股票类型',
                    dataIndex: 'stockType',
                    align: 'center',
                    scopedSlots: { customRender: 'stockType' }
          scopedSlots: { customRender: 'stockType' },
                },
                {
@@ -281,7 +288,7 @@
                    align: 'center',
                    customRender: (text, row, index) => {
                        return text ? moment(text).format('YYYY-MM-DD HH:mm:ss') : ''
                    }
          },
                },
                {
                    title: '认缴时间',
@@ -289,21 +296,22 @@
                    align: 'center',
                    customRender: (text, row, index) => {
                        return text ? moment(text).format('YYYY-MM-DD HH:mm:ss') : ''
                    }
                }, {
          },
        },
        {
                    title: '上市时间',
                    dataIndex: 'listDate',
                    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' },
        },
            ],
            disabledDate: true,
            // 表头
@@ -315,7 +323,7 @@
                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: {
@@ -324,28 +332,40 @@
                code: '',
                name: '',
                zt: undefined,
                type: undefined
        type: undefined,
            },
            datalist: [],
            labelCol: {
                xs: { span: 8 },
                sm: { span: 8 },
                md: { span: 8 }
        md: { span: 8 },
            },
            wrapperCol: {
                xs: { span: 14 },
                sm: { span: 14 },
                md: { span: 14 }
        md: { span: 14 },
            },
            addUserform: this.$form.createForm(this),
            addUserdialog: false,
            addUserDialogloading: false,
            fields: ['name', 'code', 'price', 'orderNumber', 'zt', 'subscribeTime', 'subscriptionTime', 'type', 'stockType', 'code', 'pe', 'listDate'],
      fields: [
        'name',
        'code',
        'price',
        'orderNumber',
        'zt',
        'subscribeTime',
        'subscriptionTime',
        'type',
        'stockType',
        'code',
        'pe',
        'listDate',
      ],
            currentdetail: '',
            subscribeTime: '',
            subscriptionTime: ''
      subscriptionTime: '',
        }
    },
    created () {
@@ -359,20 +379,20 @@
                content: '确认删除该新股吗?此操作不可恢复!',
                onOk () {
                    var data = {
                        id: val.newlistId
            id: val.newlistId,
                    }
                    subscribedel(data).then(res => {
          subscribedel(data).then((res) => {
                        if (res.status == 0) {
                            that.$message.success({ content: res.msg, duration: 2 })
              that.$message.success(res.msg)
                            that.getinit()
                        } else {
                            that.$message.error({ content: res.msg })
              that.$message.error(res.msg)
                        }
                    })
                },
                onCancel () {
                    console.log('Cancel')
                }
        },
            })
        },
        getsubscribeTime (date, dateString) {
@@ -385,10 +405,16 @@
            this.currentdetail = val
            this.addUserdialog = true
            var currentTime = new Date()
            this.fields.forEach(v => this.addUserform.getFieldDecorator(v))
      this.fields.forEach((v) => this.addUserform.getFieldDecorator(v))
            this.addUserform.setFieldsValue(pick(val, this.fields))
            this.addUserform.setFieldsValue({ subscriptionTime: moment(val.subscriptionTime ? val.subscriptionTime : currentTime).format('YYYY-MM-DD HH:mm:ss') })
            this.addUserform.setFieldsValue({ subscribeTime: moment(val.subscribeTime ? val.subscribeTime : currentTime).format('YYYY-MM-DD HH:mm:ss') })
      this.addUserform.setFieldsValue({
        subscriptionTime: moment(val.subscriptionTime ? val.subscriptionTime : currentTime).format(
          'YYYY-MM-DD HH:mm:ss'
        ),
      })
      this.addUserform.setFieldsValue({
        subscribeTime: moment(val.subscribeTime ? val.subscribeTime : currentTime).format('YYYY-MM-DD HH:mm:ss'),
      })
             // this.subscribeTime = moment(val.subscribeTime).format('YYYY-MM-DD HH:mm:ss')
             // this.subscriptionTime  = moment(val.subscriptionTime).format('YYYY-MM-DD HH:mm:ss')
        },
@@ -407,14 +433,14 @@
                        values.newlistId = this.currentdetail.newlistId
                        values.subscriptionTime = this.subscriptionTime
                        values.subscribeTime = this.subscribeTime
                        subscribeupdate(values).then(res => {
            subscribeupdate(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
                        })
@@ -422,14 +448,14 @@
                        this.addUserDialogloading = true
                        values.subscriptionTime = this.subscriptionTime
                        values.subscribeTime = this.subscribeTime
                        subscribeadd(values).then(res => {
            subscribeadd(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.getinit()
                            } else {
                                this.$message.error({ content: res.msg })
                this.$message.error(res.msg)
                            }
                            this.addUserDialogloading = false
                        })
@@ -444,7 +470,7 @@
                code: '',
                name: '',
                zt: undefined,
                type: undefined
        type: undefined,
            }
        },
        getinit () {
@@ -454,7 +480,7 @@
        },
        getlist () {
            this.loading = true
            subscribelist(this.queryParam).then(res => {
      subscribelist(this.queryParam).then((res) => {
                this.datalist = res.data.list
                this.pagination.total = res.data.total
                this.loading = false
@@ -470,7 +496,7 @@
            this.pagination.current = page
            this.queryParam.pageSize = pageSize
            this.getlist()
        }
    }
    },
  },
}
</script>