From 69ff731fbacf2f2ae16f98a355506bfeb01dd567 Mon Sep 17 00:00:00 2001
From: zzzz <690498789@qq.com>
Date: Sun, 07 Apr 2024 21:47:08 +0800
Subject: [PATCH] ne1
---
src/views/product/shares.vue | 580 +++++++++++++++++++++++++++++----------------------------
1 files changed, 299 insertions(+), 281 deletions(-)
diff --git a/src/views/product/shares.vue b/src/views/product/shares.vue
index e303d97..04978c8 100644
--- a/src/views/product/shares.vue
+++ b/src/views/product/shares.vue
@@ -55,13 +55,13 @@
<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 = 1,getlist()">查询
+ @click=";(queryParam.pageNum = 1), (pagination.current = 1), getlist()"
+ >查询
</a-button>
<!-- <a-button
@@ -70,7 +70,6 @@
style="margin-left: 8px"
@click="addUserdialog = true">
添加股票</a-button> -->
-
</span>
</a-form-item>
</a-col>
@@ -86,35 +85,47 @@
:pagination="pagination"
:columns="columns"
:data-source="datalist"
- rowKey="id">
- <span slot="stockName" slot-scope="text,record">
+ rowKey="id"
+ >
+ <span slot="stockName" slot-scope="text, record">
<template>
<div>
- <span style="margin-right:10px">{{ record.stockName }}</span>
- <a-tag color="green">{{ record.stockCode }}
+ <span style="margin-right: 10px">{{ record.stockName }}</span>
+ <a-tag color="green">{{ record.stockCode }} </a-tag>
+ </div>
+ </template>
+ </span>
+ <span slot="stockType" slot-scope="text, record">
+ <template>
+ <div>
+ <a-tag color="red"
+ >{{
+ record.stockType == 'sz'
+ ? '深股'
+ : record.stockType == 'sh'
+ ? '沪股'
+ : record.stockType == 'bj'
+ ? '京股'
+ : record.stockType == 'hk'
+ ? '港股'
+ : record.stockType == 'us'
+ ? '美股'
+ : ''
+ }}
</a-tag>
</div>
</template>
</span>
- <span slot="stockType" slot-scope="text,record">
+ <span slot="nowPrice" slot-scope="text, record">
<template>
<div>
- <a-tag color="red">{{ record.stockType == 'sz' ? '深股' : record.stockType == 'sh' ? '沪股' : record.stockType == 'bj' ? '京股' : record.stockType == 'hk' ? '港股' : record.stockType == 'us' ? '美股' : '' }}
+ <a-tag :color="record.hcrate < 0 ? 'green' : record.hcrate > 0 ? 'red' : ''"
+ >{{ Number(record.nowPrice).toFixed(2) }}
</a-tag>
</div>
</template>
</span>
- <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>
- </div>
- </template>
- </span>
- <span slot="hcrate" slot-scope="text,record">
+ <span slot="hcrate" slot-scope="text, record">
<template>
<div>
<a-tag :color="record.hcrate < 0 ? 'green' : record.hcrate > 0 ? 'red' : ''">
@@ -123,7 +134,7 @@
</div>
</template>
</span>
- <span slot="day3Rate" slot-scope="text,record">
+ <span slot="day3Rate" slot-scope="text, record">
<template>
<div>
<a-tag :color="record.day3Rate < 0 ? 'green' : record.day3Rate > 0 ? 'red' : ''">
@@ -132,7 +143,7 @@
</div>
</template>
</span>
- <span slot="spreadRate" slot-scope="text,record">
+ <span slot="spreadRate" slot-scope="text, record">
<template>
<div>
<a-tag :color="record.spreadRate < 0 ? 'green' : record.spreadRate > 0 ? 'red' : ''">
@@ -141,7 +152,7 @@
</div>
</template>
</span>
- <span slot="isShow" slot-scope="text,record">
+ <span slot="isShow" slot-scope="text, record">
<template>
<div>
<a-tag :color="record.isShow == 0 ? 'green' : record.isShow == 1 ? 'red' : ''">
@@ -150,7 +161,7 @@
</div>
</template>
</span>
- <span slot="isLock" slot-scope="text,record">
+ <span slot="isLock" slot-scope="text, record">
<template>
<div>
<a-tag :color="record.isLock == 0 ? 'green' : record.isLock == 1 ? 'red' : ''">
@@ -160,16 +171,13 @@
</template>
</span>
- <template slot="action" slot-scope="text,record">
- <a slot="action" href="javascript:;" @click="getisShow(record.id, record.isShow)">{{ record.isShow
- ==
- 0 ? '隐藏股票' :
- '显示股票'
+ <template slot="action" slot-scope="text, record">
+ <a slot="action" href="javascript:;" @click="getisShow(record.id, record.isShow)">{{
+ record.isShow == 0 ? '隐藏股票' : '显示股票'
}}</a>
<a-divider type="vertical" />
- <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>
@@ -183,22 +191,26 @@
: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="['stockName', { rules: [{ required: true, message: '请输入股票名称', }] }]" />
+ v-decorator="['stockName', { rules: [{ required: true, message: '请输入股票名称' }] }]"
+ />
</a-form-item>
<a-form-item label="股票代码" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input
placeholder="请输入股票代码"
- v-decorator="['stockCode', { rules: [{ required: true, message: '请输入股票代码', }] }]" />
+ v-decorator="['stockCode', { rules: [{ required: true, message: '请输入股票代码' }] }]"
+ />
</a-form-item>
<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="sh">沪股</a-select-option>
<a-select-option value="sz">深股</a-select-option>
<a-select-option value="bj">京股</a-select-option>
@@ -209,7 +221,8 @@
<a-form-item label="科创板股票" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select
placeholder="请选择科创板股票"
- v-decorator="['stockPlate', { rules: [{ required: true, message: '请选择科创板股票', }] }]">
+ v-decorator="['stockPlate', { rules: [{ required: true, message: '请选择科创板股票' }] }]"
+ >
<a-select-option value="A股">否</a-select-option>
<a-select-option value="科创">是</a-select-option>
</a-select>
@@ -217,7 +230,8 @@
<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>
@@ -225,7 +239,8 @@
<a-form-item label="显示状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select
placeholder="请选择显示状态"
- v-decorator="['isShow', { rules: [{ required: true, message: '请选择显示状态', }] }]">
+ v-decorator="['isShow', { rules: [{ required: true, message: '请选择显示状态' }] }]"
+ >
<a-select-option value="0">显示</a-select-option>
<a-select-option value="1">不显示</a-select-option>
</a-select>
@@ -239,17 +254,20 @@
:visible="editStockdialog"
:confirmLoading="editStockdialogloading"
@ok="OkeditStockdialog"
- @cancel="CanceleditStockdialog">
+ @cancel="CanceleditStockdialog"
+ >
<a-form :form="editStockform" ref="editStockform">
<a-form-item label="股票名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input
placeholder="请输入股票名称"
- v-decorator="['stockName', { rules: [{ required: true, message: '请输入股票名称', }] }]" />
+ v-decorator="['stockName', { rules: [{ required: true, message: '请输入股票名称' }] }]"
+ />
</a-form-item>
<a-form-item label="点差费率" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input
placeholder="请输入点差费率"
- v-decorator="['spreadRate', { rules: [{ required: true, message: '请输入点差费率', }] }]" />
+ v-decorator="['spreadRate', { rules: [{ required: true, message: '请输入点差费率' }] }]"
+ />
</a-form-item>
</a-form>
</a-modal>
@@ -260,245 +278,245 @@
import moment from 'moment'
import pick from 'lodash.pick'
export default {
- name: 'Shares',
- data () {
- return {
- columns: [
- {
- title: '股票名称 / 股票代码',
- dataIndex: 'stockName',
- align: 'center',
- scopedSlots: { customRender: 'stockName' }
- },
- // {
- // title: '沪深京股',
- // dataIndex: 'stockType',
- // align: 'center',
- // scopedSlots: { customRender: 'stockType' }
- // },
- {
- title: '现价',
- dataIndex: 'nowPrice',
- align: 'center',
- scopedSlots: { customRender: 'nowPrice' }
- },
- {
- title: '涨跌幅',
- dataIndex: 'hcrate',
- align: 'center',
- scopedSlots: { customRender: 'hcrate' }
- },
- // {
- // title: '最近3天涨跌',
- // dataIndex: 'day3Rate',
- // align: 'center',
- // scopedSlots: { customRender: 'day3Rate' }
- // },
- // {
- // title: '点差费率',
- // dataIndex: 'spreadRate',
- // align: 'center',
- // scopedSlots: { customRender: 'spreadRate' }
- // },
- {
- title: '显示状态',
- dataIndex: 'isShow',
- align: 'center',
- scopedSlots: { customRender: 'isShow' }
- },
- {
- title: '股票状态',
- dataIndex: 'isLock',
- align: 'center',
- scopedSlots: { customRender: 'isLock' }
- },
- {
- title: '添加时间',
- dataIndex: 'addTime',
- 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' }
- }
- ],
- // 表头
- pagination: {
- total: 0,
- current: 1,
- pageSize: 10, // 每页中显示10条数据
- showSizeChanger: true,
- pageSizeOptions: ['10', '20', '50', '100'], // 每页中显示的数据
- onShowSizeChange: (current, pageSize) => this.onSizeChange(current, pageSize), // 改变每页数量时更新显示
- onChange: (page, pageSize) => this.onPageChange(page, pageSize), // 点击页码事件
- showTotal: total => `共有 ${total} 条数据` // 分页中显示总的数据
- },
- loading: false,
- queryParam: {
- pageNum: 1,
- pageSize: 10,
- code: '',
- name: '',
- stockPlate: 'A股',
- stockType: undefined,
- showState: undefined,
- lockState: undefined
- },
- datalist: [],
- labelCol: {
- xs: { span: 24 },
- sm: { span: 7 }
- },
- wrapperCol: {
- xs: { span: 24 },
- sm: { span: 13 }
- },
- addUserform: this.$form.createForm(this),
- addUserdialog: false,
- addUserDialogloading: false,
+ name: 'Shares',
+ data() {
+ return {
+ columns: [
+ {
+ title: '股票名称 / 股票代码',
+ dataIndex: 'stockName',
+ align: 'center',
+ scopedSlots: { customRender: 'stockName' },
+ },
+ // {
+ // title: '沪深京股',
+ // dataIndex: 'stockType',
+ // align: 'center',
+ // scopedSlots: { customRender: 'stockType' }
+ // },
+ {
+ title: '现价',
+ dataIndex: 'nowPrice',
+ align: 'center',
+ scopedSlots: { customRender: 'nowPrice' },
+ },
+ {
+ title: '涨跌幅',
+ dataIndex: 'hcrate',
+ align: 'center',
+ scopedSlots: { customRender: 'hcrate' },
+ },
+ // {
+ // title: '最近3天涨跌',
+ // dataIndex: 'day3Rate',
+ // align: 'center',
+ // scopedSlots: { customRender: 'day3Rate' }
+ // },
+ // {
+ // title: '点差费率',
+ // dataIndex: 'spreadRate',
+ // align: 'center',
+ // scopedSlots: { customRender: 'spreadRate' }
+ // },
+ {
+ title: '显示状态',
+ dataIndex: 'isShow',
+ align: 'center',
+ scopedSlots: { customRender: 'isShow' },
+ },
+ {
+ title: '股票状态',
+ dataIndex: 'isLock',
+ align: 'center',
+ scopedSlots: { customRender: 'isLock' },
+ },
+ {
+ title: '添加时间',
+ dataIndex: 'addTime',
+ 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' },
+ },
+ ],
+ // 表头
+ pagination: {
+ total: 0,
+ current: 1,
+ pageSize: 10, // 每页中显示10条数据
+ showSizeChanger: true,
+ pageSizeOptions: ['10', '20', '50', '100'], // 每页中显示的数据
+ onShowSizeChange: (current, pageSize) => this.onSizeChange(current, pageSize), // 改变每页数量时更新显示
+ onChange: (page, pageSize) => this.onPageChange(page, pageSize), // 点击页码事件
+ showTotal: (total) => `共有 ${total} 条数据`, // 分页中显示总的数据
+ },
+ loading: false,
+ queryParam: {
+ pageNum: 1,
+ pageSize: 10,
+ code: '',
+ name: '',
+ stockPlate: 'A股',
+ stockType: undefined,
+ showState: undefined,
+ lockState: undefined,
+ },
+ datalist: [],
+ labelCol: {
+ xs: { span: 24 },
+ sm: { span: 7 },
+ },
+ wrapperCol: {
+ xs: { span: 24 },
+ sm: { span: 13 },
+ },
+ addUserform: this.$form.createForm(this),
+ addUserdialog: false,
+ addUserDialogloading: false,
- editStockdialog: false,
- editStockdialogloading: false,
- editStockform: this.$form.createForm(this),
- fields: ['stockName', 'spreadRate'],
- currentid: ''
- }
- },
- created () {
- this.getlist()
- },
- methods: {
- 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 () {
- this.editStockdialog = false
- const form = this.$refs.editStockform.form
- form.resetFields()
- },
- OkeditStockdialog () {
- const form = this.$refs.editStockform.form
- form.validateFields((errors, values) => {
- if (!errors) {
- this.editStockdialogloading = true
- values.id = this.currentid
- stockupdateStock(values).then(res => {
- if (res.status == 0) {
- this.editStockdialog = false
- this.$message.success({ content: res.msg, duration: 2 })
- form.resetFields()
- this.getlist()
- } else {
- this.$message.error({ content: res.msg })
- }
- this.editStockdialogloading = false
- })
- }
- })
- },
- // 新增用户取消弹窗
- CanceladdUserdialog () {
- this.addUserdialog = false
- const form = this.$refs.addUserform.form
- form.resetFields()
- },
- // 新增用户确定
- OkaddUserdialog () {
- const form = this.$refs.addUserform.form
- form.validateFields((errors, values) => {
- if (!errors) {
- this.addUserDialogloading = true
- values.stockPlate == 'A股' ? values.stockPlate = '' : values.stockPlate
- stockadd(values).then(res => {
- if (res.status == 0) {
- this.addUserdialog = false
- this.$message.success({ content: res.msg, duration: 2 })
- form.resetFields()
- this.getinit()
- } else {
- this.$message.error({ content: res.msg })
- }
- this.addUserDialogloading = false
- })
- }
- })
- },
- getqueryParam () {
- this.queryParam = {
- pageNum: 1,
- pageSize: 10,
- code: '',
- name: '',
- stockPlate: 'A股',
- stockType: undefined,
- showState: undefined,
- lockState: undefined
- }
- },
- getinit () {
- this.getqueryParam()
- this.pagination.current = 1
- this.getlist()
- },
- getlist () {
- this.loading = true
- this.queryParam.stockPlate == 'A股' ? this.queryParam.stockPlate = '' : this.queryParam.stockPlate
- stocklist(this.queryParam).then(res => {
- this.datalist = res.data.list
- this.pagination.total = res.data.total
- this.queryParam.stockPlate == '' ? this.queryParam.stockPlate = 'A股' : this.queryParam.stockPlate
- this.loading = false
- })
- },
- // 股票的显示隐藏
- getisShow (idval, isShowval) {
- updateShow({ stockId: idval }).then(res => {
- if (res.status === 0) {
- this.getlist()
- if (isShowval == 0) {
- this.$message.success({ content: '隐藏成功', duration: 2 })
- } else {
- this.$message.success({ content: '显示成功', duration: 2 })
- }
- } else {
- this.$message.error({ content: res.msg, duration: 2 })
- }
- })
- },
- // 股票的锁定解锁
- getisLock (idval, isLockval) {
- updateLock({ stockId: idval }).then(res => {
- if (res.status === 0) {
- this.getlist()
- if (isLockval == 0) {
- this.$message.success({ content: '锁定成功', duration: 2 })
- } else {
- this.$message.success({ content: '解锁成功', duration: 2 })
- }
- } else {
- this.$message.error({ content: res.msg, duration: 2 })
- }
- })
- },
- onPageChange (page, pageSize) {
- this.queryParam.pageNum = page
- this.pagination.current = page
- this.getlist()
- },
- onSizeChange (current, pageSize) {
- this.queryParam.pageNum = current
- this.pagination.current = page
- this.queryParam.pageSize = pageSize
- this.getlist()
- }
+ editStockdialog: false,
+ editStockdialogloading: false,
+ editStockform: this.$form.createForm(this),
+ fields: ['stockName', 'spreadRate'],
+ currentid: '',
}
+ },
+ created() {
+ this.getlist()
+ },
+ methods: {
+ 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() {
+ this.editStockdialog = false
+ const form = this.$refs.editStockform.form
+ form.resetFields()
+ },
+ OkeditStockdialog() {
+ const form = this.$refs.editStockform.form
+ form.validateFields((errors, values) => {
+ if (!errors) {
+ this.editStockdialogloading = true
+ values.id = this.currentid
+ stockupdateStock(values).then((res) => {
+ if (res.status == 0) {
+ this.editStockdialog = false
+ this.$message.success(res.msg)
+ form.resetFields()
+ this.getlist()
+ } else {
+ this.$message.error(res.msg)
+ }
+ this.editStockdialogloading = false
+ })
+ }
+ })
+ },
+ // 新增用户取消弹窗
+ CanceladdUserdialog() {
+ this.addUserdialog = false
+ const form = this.$refs.addUserform.form
+ form.resetFields()
+ },
+ // 新增用户确定
+ OkaddUserdialog() {
+ const form = this.$refs.addUserform.form
+ form.validateFields((errors, values) => {
+ if (!errors) {
+ this.addUserDialogloading = true
+ values.stockPlate == 'A股' ? (values.stockPlate = '') : values.stockPlate
+ stockadd(values).then((res) => {
+ if (res.status == 0) {
+ this.addUserdialog = false
+ this.$message.success(res.msg)
+ form.resetFields()
+ this.getinit()
+ } else {
+ this.$message.error(res.msg)
+ }
+ this.addUserDialogloading = false
+ })
+ }
+ })
+ },
+ getqueryParam() {
+ this.queryParam = {
+ pageNum: 1,
+ pageSize: 10,
+ code: '',
+ name: '',
+ stockPlate: 'A股',
+ stockType: undefined,
+ showState: undefined,
+ lockState: undefined,
+ }
+ },
+ getinit() {
+ this.getqueryParam()
+ this.pagination.current = 1
+ this.getlist()
+ },
+ getlist() {
+ this.loading = true
+ this.queryParam.stockPlate == 'A股' ? (this.queryParam.stockPlate = '') : this.queryParam.stockPlate
+ stocklist(this.queryParam).then((res) => {
+ this.datalist = res.data.list
+ this.pagination.total = res.data.total
+ this.queryParam.stockPlate == '' ? (this.queryParam.stockPlate = 'A股') : this.queryParam.stockPlate
+ this.loading = false
+ })
+ },
+ // 股票的显示隐藏
+ getisShow(idval, isShowval) {
+ updateShow({ stockId: idval }).then((res) => {
+ if (res.status === 0) {
+ this.getlist()
+ if (isShowval == 0) {
+ this.$message.success({ content: '隐藏成功', duration: 2 })
+ } else {
+ this.$message.success({ content: '显示成功', duration: 2 })
+ }
+ } else {
+ this.$message.error({ content: res.msg, duration: 2 })
+ }
+ })
+ },
+ // 股票的锁定解锁
+ getisLock(idval, isLockval) {
+ updateLock({ stockId: idval }).then((res) => {
+ if (res.status === 0) {
+ this.getlist()
+ if (isLockval == 0) {
+ this.$message.success({ content: '锁定成功', duration: 2 })
+ } else {
+ this.$message.success({ content: '解锁成功', duration: 2 })
+ }
+ } else {
+ this.$message.error({ content: res.msg, duration: 2 })
+ }
+ })
+ },
+ onPageChange(page, pageSize) {
+ this.queryParam.pageNum = page
+ this.pagination.current = page
+ this.getlist()
+ },
+ onSizeChange(current, pageSize) {
+ this.queryParam.pageNum = current
+ this.pagination.current = page
+ this.queryParam.pageSize = pageSize
+ this.getlist()
+ },
+ },
}
</script>
--
Gitblit v1.9.3