This commit is contained in:
shilin
2025-02-21 11:00:50 +08:00
parent 555f854031
commit 009d7cb8af
2 changed files with 70 additions and 11 deletions

View File

@ -57,7 +57,18 @@
align="center"
prop="groupName"
:show-overflow-tooltip="true"
/><el-table-column
/>
<el-table-column
label="交易所"
align="center"
prop="exchangeType"
:show-overflow-tooltip="true"
>
<template #default="{row}">
{{ exchangeTypeFormat(row) }}
</template>
</el-table-column>
<el-table-column
label="交易对"
align="center"
prop="symbol"
@ -72,8 +83,7 @@
{{ ['现货','合约'][row.type-1] || '' }}
</template>
</el-table-column>
<el-table-column label="数量" prop="count">
</el-table-column>
<el-table-column label="数量" prop="count" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-popconfirm
@ -121,7 +131,24 @@
<!-- 添加或修改对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px">
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="交易所" prop="exchangeType">
<el-select
v-model="form.exchangeType"
style="width: 100%;"
placeholder="请选择交易所"
clearable
filterable
size="small"
@change="onchangeForm"
>
<el-option
v-for="dict in exchangeTypes"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="交易对组名称" prop="groupName">
<el-input
v-model="form.groupName"
@ -139,11 +166,17 @@
<el-radio label="2">合约</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="交易对" prop="symbol">
<el-form-item label="交易对" prop="curChange">
<el-radio-group v-model="curChange" @change="form.symbol=undefined">
<el-radio :label="1">输入</el-radio>
<el-radio :label="2">选择</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-if="curChange===2" label="" prop="symbol">
<el-select
v-model="form.symbol"
style="width: 100%;"
placeholder="请选择"
placeholder="请选择交易对"
multiple
clearable
filterable
@ -171,6 +204,15 @@
</div>
</el-select>
</el-form-item>
<el-form-item v-else label="" prop="symbol">
<el-input
v-model="form.symbol"
type="textarea"
:disabled="symbol.symbolList.length===0"
:autosize="{ minRows: 4, maxRows: 8 }"
placeholder="请输入交易对"
/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
@ -218,13 +260,16 @@ export default {
pageIndex: 1,
pageSize: 10,
type: undefined,
idOrder:"desc"
idOrder: 'desc'
},
// 表单参数
form: {
},
// 表单校验
rules: { type: [{ required: true, message: '类型:1=现货,2=合约不能为空', trigger: 'blur' }]
rules: {
type: [{ required: true, message: '类型:1=现货,2=合约不能为空', trigger: 'blur' }],
symbol: [{ required: true, message: '交易对不能为空', trigger: 'blur' }],
exchangeType: [{ required: true, message: '交易所不能为空', trigger: 'blur' }]
},
symbol: {
symbolList: [],
@ -232,7 +277,9 @@ export default {
pageIndex: 1,
pageSize: 6
},
searchLoding: false
searchLoding: false,
exchangeTypes: [],
curChange: 1
}
},
watch: {
@ -244,14 +291,25 @@ export default {
created() {
this.getList()
// 获取交易所字典数据
this.getDicts('exchange_type').then(response => {
this.exchangeTypes = response.data
})
},
methods: {
exchangeTypeFormat(row) {
return this.selectDictLabel(this.exchangeTypes || [], row.exchangeType)
},
onchangeForm() {
this.form.symbol = undefined
this.getSymbol({})
},
// 交易对列表
getSymbol(e, type) {
this.searchLoding = true
const { pageIndex } = this.symbol
const symbol = typeof e === 'object' ? '' : e
listLineSymbol({ pageIndex, pageSize: 6, type: type || this.form.type, symbol }).then(res => {
listLineSymbol({ pageIndex, pageSize: 6, type: type || this.form.type, symbol, exchangeType: this.form.exchangeType }).then(res => {
this.symbol.total = res.data.count
this.symbol.symbolList = res.data.list
}).finally(() => {
@ -275,8 +333,10 @@ export default {
},
// 表单重置
reset() {
this.curChange = 1
this.form = {
exchangeType: this.exchangeTypes.length ? this.exchangeTypes[0].value : '',
id: undefined,
groupName: undefined,
symbol: undefined,
@ -324,7 +384,6 @@ export default {
row.id || this.ids
getLineSymbolGroup(id).then(response => {
this.form = response.data
this.form.symbol = response.data.symbol ? response.data.symbol.split(',') : undefined
this.getSymbol()
this.open = true
this.title = '修改交易对组列表'

Binary file not shown.