From 788cd2c0d2d00360135944576d995c5280ac879a Mon Sep 17 00:00:00 2001 From: clay <20932067@zju.edu.cn> Date: Mon, 1 Aug 2022 15:17:45 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ebts-ui/src/utils/ebts.js | 1 + ebts-ui/src/views/tool/query/uniQuery.vue | 2 +- .../top/packages/topology/src/topology.vue | 36 +++++--- ebts-ui/src/views/tool/top/topology.vue | 84 ++++++++++++------- 4 files changed, 84 insertions(+), 39 deletions(-) diff --git a/ebts-ui/src/utils/ebts.js b/ebts-ui/src/utils/ebts.js index f120ea1..9decbdc 100644 --- a/ebts-ui/src/utils/ebts.js +++ b/ebts-ui/src/utils/ebts.js @@ -95,6 +95,7 @@ export function addCreateDateRange(params, dateRange) { // 回显数据字典 export function selectDictLabel(datas, value) { + console.log(datas) let actions = []; Object.keys(datas).some((key) => { if (datas[key].dictValue === ('' + value)) { diff --git a/ebts-ui/src/views/tool/query/uniQuery.vue b/ebts-ui/src/views/tool/query/uniQuery.vue index 5027632..6daa412 100644 --- a/ebts-ui/src/views/tool/query/uniQuery.vue +++ b/ebts-ui/src/views/tool/query/uniQuery.vue @@ -172,7 +172,7 @@ - + - + - + - + + + + @@ -325,6 +342,7 @@ export default { nodes: [], edges: [] }, + dictTypeList:[], // 表格Column设置弹窗开关 tableColumnEditOpen:false, loading: false, @@ -332,11 +350,6 @@ export default { clientHeight: window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight, //todo 设置线段的选择 er图中只有一种线 edgeShapeList: [ - // { guid: "top-line", label: "直线", class: "iconfont icon-flow-line" }, - // { guid: "dice-er-edge", label: "连线", class: "iconfont icon-flow-line" }, - // { guid: "top-brokenline", label: "折线", class: "iconfont icon-flow-broken" }, - // { guid: "top-polyline", label: "多段线", class: "iconfont icon-flow-broken" }, - // { guid: "top-cubic", label: "曲线", class: "iconfont icon-flow-curve" } ], graph: null, grid: null, @@ -510,7 +523,6 @@ export default { // 修改字段信息 editColumns() { this.tableColumnEditOpen = true - }, // 连线的三个选择框触发实践 tableCommentChang(e) { @@ -583,6 +595,9 @@ export default { }, dragendHandler() { }, + tranDictData(list){ + this.dictTypeList = list + }, initTopo(graphData) { let self = this if (self.graph) { @@ -1162,6 +1177,7 @@ export default { item.type = 1 item.ucMock = '' item.ucName = item.columnComment + item.dictType = null columns.push(item) } diff --git a/ebts-ui/src/views/tool/top/topology.vue b/ebts-ui/src/views/tool/top/topology.vue index 76f0fee..a944f8c 100644 --- a/ebts-ui/src/views/tool/top/topology.vue +++ b/ebts-ui/src/views/tool/top/topology.vue @@ -80,23 +80,21 @@ - - - + /* 局部注册 */ import Topology from './packages/topology/src/topology' -import { deepClone } from './utils/index' -import { getQuery, getTables, updateQuery, preview } from '@/api/tool/top' -import { realData } from '@/api/system/data' -import { exportReal } from '../../../api/system/data' +import {deepClone} from './utils/index' +import {getQuery, getTables, updateQuery, preview} from '@/api/tool/top' +import {realData} from '@/api/system/data' +import {exportReal} from '@/api/system/data' +import {optionSelect} from "@/api/system/dict/type"; import {eventBus} from "@/views/tool/top/utils/eventBus"; import {Release} from "@/api/tool/query"; import {Message} from "element-ui"; + export default { name: 'DemoTopology', components: { @@ -162,14 +162,15 @@ export default { tableComment: '主表字段', relComment: '关联字段' }, - autoRefreshTimer: null + autoRefreshTimer: null, + dictTypeDataList: {} } }, mounted() { this.topId = this.$route.params && this.$route.params.topId getQuery(this.topId).then(res => { this.baseData = res.data - eventBus.$emit('isRelease',this.baseData.isRelease) + eventBus.$emit('isRelease', this.baseData.isRelease) console.log(res.data) if (res.data.topJson) { @@ -189,8 +190,29 @@ export default { this.nodeTypeList = res.data.tables this.relationalMap = res.data.relationalMap }) + optionSelect().then(res => { + this.$refs.topology.tranDictData(res.data) + }) + }, methods: { + + // todo 异步请求问题 字典状态字典翻译 + dictFormat: async function(dictType, data) { + console.log("请求开始",dictType, !this.dictTypeDataList[dictType]) + if (!this.dictTypeDataList[dictType]) { + this.dictTypeDataList[dictType] = {} + await this.getDicts(dictType).then(res => { + this.dictTypeDataList[dictType] = res.data + console.log("请求响应",res.data) + console.log("数据集",this.dictTypeDataList) + }) + } + console.log('准备执行字段渲染',this.dictTypeDataList[dictType], data) + let res = this.selectDictLabel(this.dictTypeDataList[dictType], data + '') + console.log(res,"rses") + return res; + }, /** * 重置 */ @@ -206,7 +228,7 @@ export default { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' - }).then(function() { + }).then(function () { let data = { id: that.topId, uniCons: that.previewDate.uconList @@ -265,11 +287,11 @@ export default { }, changeOnLine(release) { let that = this - this.$confirm(release === 1?'请确认top图结构无误并预览结果无误后上线?':'请确认是否撤销当前发布内容!', '警告', { + this.$confirm(release === 1 ? '请确认top图结构无误并预览结果无误后上线?' : '请确认是否撤销当前发布内容!', '警告', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' - }).then(function() { + }).then(function () { let data = { id: that.baseData.id, isRelease: release @@ -300,7 +322,7 @@ export default { let edges = [] edgeList.forEach(edge => { edges.push({ - id:edge.id, + id: edge.id, label: edge.label, source: edge.source, target: edge.target, @@ -324,12 +346,18 @@ export default { } this.previewDate.header = [] let infoList = res.infoList - infoList.forEach( info=>{ + infoList.forEach(info => { this.previewDate.header.push({ key: info.prop, label: info.label, - prop: info.prop + prop: info.prop, + dictType: info.dictType }) + // if (info.dictType!=null){ + // this.getDicts(info.dictType).then(res => { + // this.dictTypeDataList[info.dictType] = res.data + // }) + // } }) this.previewDate.title = this.baseData.uqName + '数据预览' this.previewDate.open = true From 3dff38153ae991128f5c6ce62119cd62348912c8 Mon Sep 17 00:00:00 2001 From: clay <20932067@zju.edu.cn> Date: Mon, 1 Aug 2022 23:02:30 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E6=98=A0=E5=B0=84=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ebts-ui/src/views/system/query/queryDate.vue | 61 ++++++++++---- ebts-ui/src/views/tool/query/uniQuery.vue | 86 +++++++++++++++----- ebts-ui/src/views/tool/top/topology.vue | 36 +++----- 3 files changed, 120 insertions(+), 63 deletions(-) diff --git a/ebts-ui/src/views/system/query/queryDate.vue b/ebts-ui/src/views/system/query/queryDate.vue index c063fbe..bf4087c 100644 --- a/ebts-ui/src/views/system/query/queryDate.vue +++ b/ebts-ui/src/views/system/query/queryDate.vue @@ -60,23 +60,38 @@ - - - - - - + + + + + + + + + + + + + + + + + + + +
- - - + + + + + + + + + + + + + + + + + + + + - +