| | |
| | | icon="search" |
| | | style="margin-left: 8px" |
| | | @click=";(queryParam.pageNum = 1), (pagination.current = 1), getlist()" |
| | | >查询 |
| | | >查询 |
| | | </a-button> |
| | | |
| | | <!-- <a-button |
| | |
| | | <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> |
| | |
| | | <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> |
| | |
| | | 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: '沪深京股', |
| | |
| | | title: '现价', |
| | | dataIndex: 'nowPrice', |
| | | align: 'center', |
| | | scopedSlots: { customRender: 'nowPrice' }, |
| | | scopedSlots: { customRender: 'nowPrice' } |
| | | }, |
| | | { |
| | | title: '涨跌幅', |
| | | dataIndex: 'hcrate', |
| | | align: 'center', |
| | | scopedSlots: { customRender: 'hcrate' }, |
| | | scopedSlots: { customRender: 'hcrate' } |
| | | }, |
| | | // { |
| | | // title: '最近3天涨跌', |
| | |
| | | title: '显示状态', |
| | | dataIndex: 'isShow', |
| | | align: 'center', |
| | | scopedSlots: { customRender: 'isShow' }, |
| | | scopedSlots: { customRender: 'isShow' } |
| | | }, |
| | | { |
| | | title: '股票状态', |
| | | dataIndex: 'isLock', |
| | | align: 'center', |
| | | scopedSlots: { customRender: 'isLock' }, |
| | | scopedSlots: { customRender: 'isLock' } |
| | | }, |
| | | { |
| | | title: '添加时间', |
| | |
| | | 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: { |
| | |
| | | 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: { |
| | |
| | | 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, |
| | |
| | | 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) { |
| | |
| | | }) |
| | | }, |
| | | // 新增用户取消弹窗 |
| | | 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) { |
| | |
| | | } |
| | | }) |
| | | }, |
| | | getqueryParam() { |
| | | getqueryParam () { |
| | | this.queryParam = { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | |
| | | 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) => { |
| | |
| | | }) |
| | | }, |
| | | // 股票的显示隐藏 |
| | | getisShow(idval, isShowval) { |
| | | getisShow (idval, isShowval) { |
| | | updateShow({ stockId: idval }).then((res) => { |
| | | if (res.status === 0) { |
| | | this.getlist() |
| | |
| | | }) |
| | | }, |
| | | // 股票的锁定解锁 |
| | | getisLock(idval, isLockval) { |
| | | getisLock (idval, isLockval) { |
| | | updateLock({ stockId: idval }).then((res) => { |
| | | if (res.status === 0) { |
| | | this.getlist() |
| | |
| | | } |
| | | }) |
| | | }, |
| | | 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> |