<template>
|
<div>
|
<a-card :bordered="false">
|
<div class="table-page-search-wrapper">
|
<a-form layout="inline">
|
<a-row :gutter="48">
|
<a-col :md="12" :lg="6" :sm="24">
|
<a-form-item label="名称或股票代码">
|
<a-input v-model="queryParam.keyword" style="width: 100%" placeholder="请输入名称或股票代码" />
|
</a-form-item>
|
</a-col>
|
<a-col :md="12" :lg="6" :sm="24">
|
<a-form-item label="状态">
|
<a-select v-model="queryParam.status" placeholder="请选择状态">
|
<a-select-option :value="''">全部</a-select-option>
|
<a-select-option :value="1">开</a-select-option>
|
<a-select-option :value="0">关</a-select-option>
|
</a-select>
|
</a-form-item>
|
</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
|
type="primary"
|
icon="search"
|
style="margin-left: 8px"
|
@click=";(queryParam.pageNum = 1), getlist()"
|
>查询
|
</a-button>
|
<a-button type="primary" icon="plus-circle" style="margin-left: 8px" @click="Lockvisibledialog = true"
|
>添加
|
</a-button>
|
<a-button type="primary" icon="key" style="margin-left: 8px" @click="updateKey"
|
>密钥配置
|
</a-button>
|
</span>
|
</a-form-item>
|
</a-col>
|
</a-row>
|
</a-form>
|
</div>
|
</a-card>
|
<a-table
|
bordered
|
:loading="loading"
|
:pagination="pagination"
|
:columns="columns"
|
:data-source="datalist"
|
rowKey="id"
|
>
|
<span slot="stockName" slot-scope="text, record">
|
<template>
|
<div>
|
<span style="margin-right: 10px">{{ record.stockName }}</span>
|
<a-tag
|
:color="
|
record.stockPlate == '科创'
|
? 'blue'
|
: !record.stockPlate
|
? 'orange'
|
: record.stockPlate == '创业'
|
? 'pink'
|
: 'purple'
|
"
|
>
|
{{ record.stockPlate == '科创' ? '科创' : !record.stockPlate ? '股票' : record.stockPlate }}
|
</a-tag>
|
<p>({{ record.stockCode }})</p>
|
</div>
|
</template>
|
</span>
|
<span slot="positionType" slot-scope="text, record">
|
<template>
|
<div>
|
<a-tag :color="record.positionType == 1 ? 'blue' : 'green'">
|
{{ record.positionType == 1 ? '模拟持仓' : '正式持仓' }}
|
</a-tag>
|
</div>
|
</template>
|
</span>
|
<span slot="status" slot-scope="text, record">
|
<template>
|
<div>
|
<a-tag v-if="record.status == 1"> 开 </a-tag>
|
<a-tag v-if="record.status == 0"> 关 </a-tag>
|
</div>
|
</template>
|
</span>
|
<span slot="orderDirection" slot-scope="text, record">
|
<template>
|
<div>
|
<a-tag :color="record.orderDirection == '买涨' ? 'red' : 'green'">
|
{{ record.orderDirection }}
|
</a-tag>
|
</div>
|
</template>
|
</span>
|
<span slot="nowPrice" slot-scope="text, record">
|
<template>
|
<div>
|
<p
|
:class="
|
Number(record.nowPrice) - record.targetPrice < 0
|
? 'greens'
|
: Number(record.nowPrice) - record.targetPrice > 0
|
? 'reds'
|
: ''
|
"
|
>
|
{{ record.nowPrice }}
|
</p>
|
</div>
|
</template>
|
</span>
|
<span slot="profitAndLose" slot-scope="text">
|
<template>
|
<div>
|
<p :class="text < 0 ? 'greens' : text > 0 ? 'reds' : ''">
|
{{ text }}
|
</p>
|
</div>
|
</template>
|
</span>
|
<span slot="allProfitAndLose" slot-scope="text">
|
<template>
|
<div>
|
<p :class="text < 0 ? 'greens' : text > 0 ? 'reds' : ''">
|
{{ text }}
|
</p>
|
</div>
|
</template>
|
</span>
|
|
<template slot="action" slot-scope="text, record">
|
<a slot="action" href="javascript:;" @click="geteditStock(record)">修改</a>
|
<a-divider type="vertical" />
|
<a slot="action" href="javascript:;" @click="getLockopen(record.id)">删除</a>
|
</template>
|
</a-table>
|
<a-modal
|
:title="currentdetail ? '修改' : '添加'"
|
:width="830"
|
:visible="Lockvisibledialog"
|
:confirmLoading="Lockvisibleloading"
|
@ok="getDialogok"
|
@cancel="handleCancel"
|
>
|
<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: '请输入名称' }] }]"
|
/>
|
</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="['stockCode', { rules: [{ required: true, message: '请输入股票代码' }] }]"
|
/>
|
</a-form-item>
|
</a-col>
|
</a-row>
|
<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="['stockChg', { 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-select
|
placeholder="请选择状态"
|
v-decorator="['status', { rules: [{ required: true, message: '请选择状态' }] }]"
|
>
|
<a-select-option :value="1">开</a-select-option>
|
<a-select-option :value="0">关</a-select-option>
|
</a-select>
|
</a-form-item> -->
|
<a-form-item label="状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
<a-select
|
placeholder="请选择状态"
|
v-decorator="['status', { rules: [{ required: true, message: '请选择状态' }] }]"
|
>
|
<a-select-option :value="1">开</a-select-option>
|
<a-select-option :value="0">关</a-select-option>
|
</a-select>
|
</a-form-item>
|
</a-col>
|
</a-row>
|
<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="['lowestTrade', { rules: [{ required: true, message: '请输入最低交易数量(手)' }] }]"
|
/>
|
</a-form-item>
|
</a-col>
|
</a-row>
|
</a-form>
|
</a-modal>
|
<a-modal
|
title="密钥配置"
|
:width="830"
|
:visible="visibledialog"
|
:confirmLoading="keyvisibleloading"
|
@ok="getkeyDialogok"
|
@cancel="handlekeyCancel"
|
>
|
<a-form :form="addkeyUserform" ref="addkeyUserform">
|
<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="['vipPassword', { rules: [{ required: true, message: '请输入密钥配置' }] }]"
|
/>
|
</a-form-item>
|
</a-col>
|
</a-row>
|
</a-form>
|
</a-modal>
|
</div>
|
</template>
|
<script>
|
import { positionlock, positionsell, examine, sitevipList, sitevipAdd, sitevipUpdate,sitevipUpdateStatus,sitevipDel } from '@/api/position'
|
import { setupdate,admingetSetting } from '@/api/risksetting'
|
import { nextagent } from '@/api/home'
|
import pick from 'lodash.pick'
|
import moment from 'moment'
|
export default {
|
name: 'VIPScrambleHold',
|
data() {
|
return {
|
columns: [
|
{
|
title: 'ID',
|
dataIndex: 'id',
|
align: 'center',
|
},
|
{
|
title: '名称',
|
dataIndex: 'name',
|
align: 'center',
|
},
|
{
|
title: '股票代码',
|
dataIndex: 'stockCode',
|
align: 'center',
|
},
|
{
|
title: '涨跌幅',
|
dataIndex: 'stockChg',
|
align: 'center',
|
},
|
{
|
title: '状态',
|
dataIndex: 'status',
|
align: 'center',
|
scopedSlots: { customRender: 'status' },
|
},
|
{
|
title: '最低交易数量(手)',
|
dataIndex: 'lowestTrade',
|
align: 'center',
|
},
|
{
|
title: '创建时间',
|
dataIndex: 'createTime',
|
align: 'center',
|
width: 180,
|
customRender: (text, row, index) => {
|
return text ? moment(text).format('YYYY-MM-DD HH:mm:ss') : ''
|
},
|
},
|
{
|
title: '修改时间',
|
dataIndex: 'updateTime',
|
align: 'center',
|
width: 180,
|
customRender: (text, row, index) => {
|
return text ? moment(text).format('YYYY-MM-DD HH:mm:ss') : ''
|
},
|
},
|
{
|
title: '操作',
|
key: 'action',
|
align: 'center',
|
fixed: 'right',
|
width: 150,
|
scopedSlots: { customRender: 'action' },
|
},
|
],
|
// 表头
|
pagination: {
|
total: 0,
|
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,
|
keyword: '',
|
status: '',
|
},
|
fields: [
|
'name',
|
'stockCode',
|
'stockChg',
|
'status',
|
'lowestTrade',
|
'createTime',
|
'updateTime',
|
'vipPassword'
|
],
|
datalist: [],
|
agentlist: [],
|
agentloading: false,
|
Lockvisibledialog: false,
|
visibledialog: false,
|
Lockvisibleloading: false,
|
keyvisibleloading: false,
|
Lockvisibleform: this.$form.createForm(this),
|
clickpositionId: '',
|
agentqueryParam: {
|
pageNum: 1,
|
pageSize: 100,
|
},
|
labelCol: {
|
xs: { span: 8 },
|
sm: { span: 8 },
|
md: { span: 8 },
|
},
|
wrapperCol: {
|
xs: { span: 14 },
|
sm: { span: 14 },
|
md: { span: 14 },
|
},
|
addUserform: this.$form.createForm(this),
|
addkeyUserform: this.$form.createForm(this),
|
currentdetail: '',
|
details: {}
|
}
|
},
|
created() {
|
this.getlist()
|
this.getdetail()
|
},
|
methods: {
|
updateKey(){
|
this.visibledialog = true
|
this.fields.forEach((v) => this.addkeyUserform.getFieldDecorator(v))
|
this.addkeyUserform.setFieldsValue(pick(this.details, this.fields))
|
},
|
getdetail () {
|
admingetSetting().then((res) => {
|
this.details = res.data
|
})
|
},
|
geteditStock(val) {
|
this.currentdetail = val
|
this.Lockvisibledialog = true
|
this.fields.forEach((v) => this.addUserform.getFieldDecorator(v))
|
this.addUserform.setFieldsValue(pick(val, this.fields))
|
},
|
getLockopen(val) {
|
var that = this
|
this.$confirm({
|
title: '提示',
|
content: '确认要删除吗?',
|
onOk() {
|
var data = {
|
id: val,
|
}
|
sitevipDel(data).then((res) => {
|
if (res.status == 0) {
|
that.$message.success(res.msg)
|
that.getlist()
|
} else {
|
that.$message.error(res.msg)
|
}
|
})
|
},
|
onCancel() {
|
console.log('Cancel')
|
},
|
})
|
},
|
handleCancel() {
|
console.log('handleCancel',this.Lockvisibledialog);
|
this.Lockvisibledialog = false
|
const form = this.$refs.addUserform.form
|
form.resetFields()
|
},
|
handlekeyCancel() {
|
this.visibledialog = false
|
const form = this.$refs.addkeyUserform.form
|
form.resetFields()
|
},
|
getDialogok() {
|
const form = this.$refs.addUserform.form
|
|
form.validateFields((errors, values) => {
|
console.log(values);
|
if (!errors) {
|
if (this.currentdetail != '') {
|
this.Lockvisibleloading = true
|
values.id = this.currentdetail.id
|
|
// values.subscriptionTime = this.subscriptionTime
|
// values.subscribeTime = this.subscribeTime
|
sitevipUpdate(values).then((res) => {
|
if (res.status == 0) {
|
this.Lockvisibledialog = false
|
this.$message.success('修改成功')
|
this.currentdetail = ''
|
form.resetFields()
|
this.getlist()
|
} else {
|
this.$message.error(res.msg)
|
}
|
this.Lockvisibleloading = false
|
})
|
} else {
|
this.Lockvisibleloading = true
|
sitevipAdd(values).then((res) => {
|
if (res.status == 0) {
|
this.Lockvisibledialog = false
|
this.$message.success(res.msg)
|
form.resetFields()
|
this.getinit()
|
} else {
|
this.$message.error(res.msg)
|
}
|
this.Lockvisibleloading = false
|
})
|
}
|
}
|
})
|
},
|
getkeyDialogok() {
|
const form = this.$refs.addkeyUserform.form
|
|
form.validateFields((errors, values) => {
|
if (!errors) {
|
values.id = this.details.id
|
this.keyvisibleloading = true
|
setupdate(values).then((res) => {
|
if (res.status == 0) {
|
this.visibledialog = false
|
this.$message.success('修改成功')
|
form.resetFields()
|
this.getdetail()
|
} else {
|
this.$message.error(res.msg)
|
}
|
this.keyvisibleloading = false
|
})
|
}
|
})
|
},
|
getinit() {
|
this.queryParam = {
|
pageNum: 1,
|
pageSize: 10,
|
keyword: '',
|
status: '',
|
}
|
this.getlist()
|
},
|
getqueryParam() {
|
this.queryParam = {
|
pageNum: 1,
|
pageSize: 10,
|
keyword: '',
|
status: '',
|
}
|
},
|
getagentlist() {
|
var that = this
|
this.agentloading = true
|
nextagent(this.agentqueryParam).then((res) => {
|
this.agentlist = res.data.list
|
setTimeout(() => {
|
that.agentloading = false
|
}, 500)
|
})
|
},
|
getlist() {
|
this.loading = true
|
console.log(this.queryParam)
|
sitevipList(this.queryParam).then((res) => {
|
console.log(res)
|
this.datalist = res.data.records
|
this.pagination.total = res.data.total
|
this.loading = false
|
})
|
},
|
onPageChange(page, pageSize) {
|
this.queryParam.pageNum = page
|
this.getlist()
|
},
|
onSizeChange(current, pageSize) {
|
this.queryParam.pageNum = current
|
this.queryParam.pageSize = pageSize
|
this.getlist()
|
},
|
},
|
}
|
</script>
|
<style scoped>
|
.greens {
|
color: #52c41a;
|
}
|
|
.reds {
|
color: #f5222d;
|
}
|
</style>
|