|
|
@@ -1,7 +1,157 @@
|
|
|
<!-- 基础数据管理-数据字典管理 -->
|
|
|
<template>
|
|
|
- <app-view></app-view>
|
|
|
+ <div class="g-view-tree">
|
|
|
+ <app-view>
|
|
|
+ <el-tree ref="treeRef" :data="nodeList"
|
|
|
+ :props="{ label: (data: { enumgroupname: string; enumdicname: string }) => data.enumgroupname || data.enumdicname }"
|
|
|
+ :expand-on-click-node="false" @node-click="nodeClick" highlight-current default-expand-all />
|
|
|
+ </app-view>
|
|
|
+ <app-view>
|
|
|
+ <app-table :data="dataList" :columns="tableColumns">
|
|
|
+ <template #headerLeft>
|
|
|
+ <app-operation :data-list="getActionButtons(['investor_custom_tradecfg_add'])"
|
|
|
+ @click="openComponent" />
|
|
|
+ <app-operation
|
|
|
+ :data-list="getActionButtons(['investor_custom_tradecfg_modify', 'investor_custom_tradecfg_delete'])"
|
|
|
+ @click="openComponent" v-if="data" />
|
|
|
+ </template>
|
|
|
+ </app-table>
|
|
|
+ </app-view>
|
|
|
+ <component :is="componentMap.get(componentId)" v-bind="{ record: toRaw(data) }" @closed="closeComponent"
|
|
|
+ v-if="componentId" />
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
+import { ref, computed, reactive, toRaw, nextTick } from 'vue'
|
|
|
+import { ElMessage } from 'element-plus'
|
|
|
+import type Node from 'element-plus/es/components/tree/src/model/node'
|
|
|
+import { buildTree, handleNoneValue } from '@/filters'
|
|
|
+import { Language } from '@/constants/language'
|
|
|
+import { useEnum } from '@/hooks/enum'
|
|
|
+import { useRequest } from '@/hooks/request'
|
|
|
+import { useOperation } from '@/hooks/operation'
|
|
|
+import { getInvestorTree, tradeConfigView } from '@/services/api/investor'
|
|
|
+import { queryEnumDicItemByPage, getEnumDics } from '@/services/api/base'
|
|
|
+import { CellProp } from '@pc/components/base/table-details/types'
|
|
|
+import AppTable from '@pc/components/base/table/index.vue'
|
|
|
+import AppOperation from '@pc/components/base/operation/index.vue'
|
|
|
+import AppTableDetails from '@pc/components/base/table-details/index.vue'
|
|
|
+import { i18n } from '@/stores'
|
|
|
+
|
|
|
+const { t } = i18n.global
|
|
|
+const customerTypeEnum = useEnum('customerType')
|
|
|
+const feetypeEnum = useEnum('feetype')
|
|
|
+const scfRiskMode = useEnum('SCFRiskMode')
|
|
|
+const traderuleEnum = useEnum('traderule') // 交易规则
|
|
|
+const tradefeeEnum = useEnum('tradefee') // 交易费用
|
|
|
+
|
|
|
+const treeRef = ref()
|
|
|
+const nodeList = ref<(Base.EnumGroup & { children: Base.EnumDic[]; })[]>([])
|
|
|
+const selectedNode = ref<Node>()
|
|
|
+
|
|
|
+const currentInfo = reactive({
|
|
|
+ groupName: '',
|
|
|
+ marketName: '',
|
|
|
+ goodsName: '',
|
|
|
+ customerType: '',
|
|
|
+ marginValue: ''
|
|
|
+})
|
|
|
+
|
|
|
+const qs = computed<Investor.TradeConfigViewReq>(() => {
|
|
|
+ const data = selectedNode.value?.data
|
|
|
+ return {
|
|
|
+ usergroupid: data?.usergroupid,
|
|
|
+ marketid: data?.marketid,
|
|
|
+ goodsid: data?.goodsid,
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+const { componentMap, componentId, openComponent, closeComponent, getActionButtons } = useOperation<Investor.TradeConfigViewRsp>({
|
|
|
+ onClose: (componentId) => {
|
|
|
+ getNodeList()
|
|
|
+ if (componentId === 'investor_custom_tradecfg_modify') {
|
|
|
+ getDetails(qs.value)
|
|
|
+ }
|
|
|
+ if (componentId === 'investor_custom_tradecfg_delete') {
|
|
|
+ data.value = undefined
|
|
|
+ }
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+const { run: getNodeList } = useRequest(getEnumDics, {
|
|
|
+ onSuccess: (res) => {
|
|
|
+ nodeList.value = res.data.enumgroups.map((e) => {
|
|
|
+ const children: Base.EnumDic[] = []
|
|
|
+ res.data.enumdics.forEach((item) => {
|
|
|
+ if (e.enumgroupid === item.enumgroupid) {
|
|
|
+ children.push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return {
|
|
|
+ ...e,
|
|
|
+ children,
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onError: (err) => {
|
|
|
+ ElMessage.error(err)
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+const { data, run: getDetails } = useRequest(tradeConfigView, {
|
|
|
+ manual: true,
|
|
|
+ onError: (err) => {
|
|
|
+ ElMessage.error(err)
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+const { dataList, run: getDataList } = useRequest(queryEnumDicItemByPage, {
|
|
|
+ manual: true,
|
|
|
+ defaultParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 20
|
|
|
+ },
|
|
|
+ onError: (err) => {
|
|
|
+ ElMessage.error(err)
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+const detailProps = computed<CellProp[]>(() => [
|
|
|
+ { prop: 'groupName', label: 'investor.custom.tradecfg.usergroupid1' },
|
|
|
+ { prop: 'marketName', label: 'investor.custom.tradecfg.marketid1' },
|
|
|
+ { prop: 'goodsName', label: 'investor.custom.tradecfg.goodsid1' },
|
|
|
+ { prop: 'customerType', label: 'investor.custom.tradecfg.paramid', formatValue: () => customerTypeEnum.getEnumTypeName(data.value?.paramid) },
|
|
|
+ { prop: 'marginValue', label: 'investor.custom.tradecfg.marketmarginvaluedisplay', formatValue: () => data.value?.marketmarginvaluedisplay },
|
|
|
+])
|
|
|
+
|
|
|
+const tableColumns: Model.TableColumn[] = [
|
|
|
+ { field: 'enumdiccode', label: '所属枚举代码' },
|
|
|
+ { field: 'enumdicname', label: '枚举项名称' },
|
|
|
+ { field: 'enumitemname', label: '枚举项值' },
|
|
|
+ { field: 'itemstatus', label: '枚举项状态' },
|
|
|
+ { field: 'operate', label: 'common.operate', fixed: 'right' }
|
|
|
+]
|
|
|
+
|
|
|
+const nodeClick = (data: Base.EnumGroup | Base.EnumDic, node: Node) => {
|
|
|
+ if ('enumdiccode' in data) {
|
|
|
+ getDataList({
|
|
|
+ enumgroupid: data.enumgroupid,
|
|
|
+ enumdiccode: data.enumdiccode,
|
|
|
+ ismappingtobank: data.ismappingtobank
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ getDataList({
|
|
|
+ enumgroupid: data.enumgroupid
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ if (data.goodsid) {
|
|
|
+ selectedNode.value = node
|
|
|
+ currentInfo.goodsName = node.label
|
|
|
+ currentInfo.marketName = node.parent.label
|
|
|
+ currentInfo.groupName = node.parent.parent.label
|
|
|
+ getDetails(qs.value)
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|