大宝管理后台代码
xxx
dcc
2024-05-07 abcf89c0931fc453f4fd8e1d4d48b8b469d0f3c7
src/views/product/shares.vue
@@ -61,7 +61,7 @@
                    icon="search"
                    style="margin-left: 8px"
                    @click=";(queryParam.pageNum = 1), (pagination.current = 1), getlist()"
                    >查询
                  >查询
                  </a-button>
                  <!-- <a-button
@@ -98,20 +98,21 @@
        <span slot="stockType" slot-scope="text, record">
          <template>
            <div>
              <a-tag color="red"
                >{{
                  record.stockType == 'sz'
                    ? '深股'
                    : record.stockType == 'sh'
              <a-tag
                color="red"
              >{{
                record.stockType == 'sz'
                  ? '深股'
                  : record.stockType == 'sh'
                    ? '沪股'
                    : record.stockType == 'bj'
                    ? '京股'
                    : record.stockType == 'hk'
                    ? '港股'
                    : record.stockType == 'us'
                    ? '美股'
                    : ''
                }}
                      ? '京股'
                      : record.stockType == 'hk'
                        ? '港股'
                        : record.stockType == 'us'
                          ? '美股'
                          : ''
              }}
              </a-tag>
            </div>
          </template>
@@ -119,8 +120,9 @@
        <span slot="nowPrice" slot-scope="text, record">
          <template>
            <div>
              <a-tag :color="record.hcrate < 0 ? 'green' : record.hcrate > 0 ? 'red' : ''"
                >{{ Number(record.nowPrice).toFixed(2) }}
              <a-tag
                :color="record.hcrate < 0 ? 'green' : record.hcrate > 0 ? 'red' : ''"
              >{{ Number(record.nowPrice).toFixed(2) }}
              </a-tag>
            </div>
          </template>
@@ -279,14 +281,14 @@
import pick from 'lodash.pick'
export default {
  name: 'Shares',
  data() {
  data () {
    return {
      columns: [
        {
          title: '股票名称 / 股票代码',
          dataIndex: 'stockName',
          align: 'center',
          scopedSlots: { customRender: 'stockName' },
          scopedSlots: { customRender: 'stockName' }
        },
        // {
        //     title: '沪深京股',
@@ -298,13 +300,13 @@
          title: '现价',
          dataIndex: 'nowPrice',
          align: 'center',
          scopedSlots: { customRender: 'nowPrice' },
          scopedSlots: { customRender: 'nowPrice' }
        },
        {
          title: '涨跌幅',
          dataIndex: 'hcrate',
          align: 'center',
          scopedSlots: { customRender: 'hcrate' },
          scopedSlots: { customRender: 'hcrate' }
        },
        // {
        //     title: '最近3天涨跌',
@@ -322,13 +324,13 @@
          title: '显示状态',
          dataIndex: 'isShow',
          align: 'center',
          scopedSlots: { customRender: 'isShow' },
          scopedSlots: { customRender: 'isShow' }
        },
        {
          title: '股票状态',
          dataIndex: 'isLock',
          align: 'center',
          scopedSlots: { customRender: 'isLock' },
          scopedSlots: { customRender: 'isLock' }
        },
        {
          title: '添加时间',
@@ -336,14 +338,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: {
@@ -354,7 +356,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: {
@@ -365,16 +367,16 @@
        stockPlate: 'A股',
        stockType: undefined,
        showState: undefined,
        lockState: undefined,
        lockState: undefined
      },
      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,
@@ -384,25 +386,25 @@
      editStockdialogloading: false,
      editStockform: this.$form.createForm(this),
      fields: ['stockName', 'spreadRate'],
      currentid: '',
      currentid: ''
    }
  },
  created() {
  created () {
    this.getlist()
  },
  methods: {
    geteditStock(val) {
    geteditStock (val) {
      this.currentid = val.id
      this.editStockdialog = true
      this.fields.forEach((v) => this.editStockform.getFieldDecorator(v))
      this.editStockform.setFieldsValue(pick(val, this.fields))
    },
    CanceleditStockdialog() {
    CanceleditStockdialog () {
      this.editStockdialog = false
      const form = this.$refs.editStockform.form
      form.resetFields()
    },
    OkeditStockdialog() {
    OkeditStockdialog () {
      const form = this.$refs.editStockform.form
      form.validateFields((errors, values) => {
        if (!errors) {
@@ -423,13 +425,13 @@
      })
    },
    // 新增用户取消弹窗
    CanceladdUserdialog() {
    CanceladdUserdialog () {
      this.addUserdialog = false
      const form = this.$refs.addUserform.form
      form.resetFields()
    },
    // 新增用户确定
    OkaddUserdialog() {
    OkaddUserdialog () {
      const form = this.$refs.addUserform.form
      form.validateFields((errors, values) => {
        if (!errors) {
@@ -449,7 +451,7 @@
        }
      })
    },
    getqueryParam() {
    getqueryParam () {
      this.queryParam = {
        pageNum: 1,
        pageSize: 10,
@@ -458,15 +460,15 @@
        stockPlate: 'A股',
        stockType: undefined,
        showState: undefined,
        lockState: undefined,
        lockState: undefined
      }
    },
    getinit() {
    getinit () {
      this.getqueryParam()
      this.pagination.current = 1
      this.getlist()
    },
    getlist() {
    getlist () {
      this.loading = true
      this.queryParam.stockPlate == 'A股' ? (this.queryParam.stockPlate = '') : this.queryParam.stockPlate
      stocklist(this.queryParam).then((res) => {
@@ -477,7 +479,7 @@
      })
    },
    // 股票的显示隐藏
    getisShow(idval, isShowval) {
    getisShow (idval, isShowval) {
      updateShow({ stockId: idval }).then((res) => {
        if (res.status === 0) {
          this.getlist()
@@ -492,7 +494,7 @@
      })
    },
    // 股票的锁定解锁
    getisLock(idval, isLockval) {
    getisLock (idval, isLockval) {
      updateLock({ stockId: idval }).then((res) => {
        if (res.status === 0) {
          this.getlist()
@@ -506,17 +508,17 @@
        }
      })
    },
    onPageChange(page, pageSize) {
    onPageChange (page, pageSize) {
      this.queryParam.pageNum = page
      this.pagination.current = page
      this.getlist()
    },
    onSizeChange(current, pageSize) {
    onSizeChange (current, pageSize) {
      this.queryParam.pageNum = current
      this.pagination.current = page
      this.queryParam.pageSize = pageSize
      this.getlist()
    },
  },
    }
  }
}
</script>