From 3155c09dc97626bd1944387b388f547e70bd651c Mon Sep 17 00:00:00 2001 From: clay <20932067@zju.edu.cn> Date: Tue, 19 Jul 2022 21:47:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=93=E6=89=91=E5=9B=BE=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 | 21 ++- ebts-ui/src/views/tool/query/uniQuery.vue | 11 +- .../packages/topology/src/toolbar-edit.vue | 2 +- ebts-ui/src/views/tool/top/topology.vue | 161 +++++++++++------- 4 files changed, 119 insertions(+), 76 deletions(-) diff --git a/ebts-ui/src/views/system/query/queryDate.vue b/ebts-ui/src/views/system/query/queryDate.vue index 6d30641..4fe4162 100644 --- a/ebts-ui/src/views/system/query/queryDate.vue +++ b/ebts-ui/src/views/system/query/queryDate.vue @@ -60,11 +60,12 @@ - + :key="index" + :prop="item.prop" + /> { - this.uconList = listInit(res.data) + let data = res.data + this.uconList = listInit(data.uniCons) + this.realDate.header = data.infoList }) this.handleQuery() }, @@ -140,10 +143,10 @@ export default { RealData(data).then(res => { this.realDate.data = res.rows this.total = res.total - this.realDate.header = [] - for (var key in this.realDate.data[0]) { - this.realDate.header.push(key) - } + // this.realDate.header = [] + // for (var key in this.realDate.data[0]) { + // this.realDate.header.push(key) + // } }) }, diff --git a/ebts-ui/src/views/tool/query/uniQuery.vue b/ebts-ui/src/views/tool/query/uniQuery.vue index 69c6816..a67eff8 100644 --- a/ebts-ui/src/views/tool/query/uniQuery.vue +++ b/ebts-ui/src/views/tool/query/uniQuery.vue @@ -131,10 +131,10 @@
- @@ -295,9 +295,11 @@ export default { created() { this.queryId = this.$route.params && this.$route.params.queryId getQueryInfo(this.queryId).then(res => { + let data = res.data this.columns = [] - this.info = res.data.info - this.columns = JSONparse(res.data.list) + this.info = data.info + this.columnInfo.list = data.infoList + this.columns = JSONparse(data.list) this.sqlConfig.coder.setValue(this.info.uqSql) }) this.$nextTick(function() { @@ -545,6 +547,7 @@ export default { }) return } + data.infoList = this.columnInfo.list editQueryInfo(data).then(res => { this.columns = JSONparse(list) Message({ diff --git a/ebts-ui/src/views/tool/top/packages/topology/src/toolbar-edit.vue b/ebts-ui/src/views/tool/top/packages/topology/src/toolbar-edit.vue index bba3420..e45383b 100644 --- a/ebts-ui/src/views/tool/top/packages/topology/src/toolbar-edit.vue +++ b/ebts-ui/src/views/tool/top/packages/topology/src/toolbar-edit.vue @@ -47,7 +47,7 @@ - + 预览 上线 diff --git a/ebts-ui/src/views/tool/top/topology.vue b/ebts-ui/src/views/tool/top/topology.vue index 0e6c147..a76a324 100644 --- a/ebts-ui/src/views/tool/top/topology.vue +++ b/ebts-ui/src/views/tool/top/topology.vue @@ -14,12 +14,14 @@ @doPreview="doPreview" @doOnLine="doOnLine" > + + :label="item.ucName" + > + placeholder="选择日期时间" + > - + :key="index" + :prop="item.prop" + /> { + this.topId = this.$route.params && this.$route.params.topId + getQuery(this.topId).then(res => { this.baseData = res.data - if (res.data.topJson){ + if (res.data.topJson) { this.graphData = JSON.parse(res.data.topJson) - }else { - this.graphData ={ - nodes:[], - edges:[] + } else { + this.graphData = { + nodes: [], + edges: [] } - } + } let graphData = deepClone(this.graphData) this.$refs.topology.initTopo(graphData) this.randomChange() }) - getTables().then(res =>{ + getTables().then(res => { this.nodeTypeList = res.data.tables this.relationalMap = res.data.relationalMap }) @@ -179,38 +184,35 @@ export default { /** 导出按钮操作 */ handleExport() { var that = this - this.$confirm('是否确认导出查询数据项?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function () { + this.$confirm('是否确认导出查询数据项?', '警告', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(function() { let data = { - id:that.topId, - uniCons:that.previewDate.uconList, + id: that.topId, + uniCons: that.previewDate.uconList } return exportReal(data) }).then(response => { - this.download(response.msg); + this.download(response.msg) }) }, handleQuery() { let data = { id: this.topId, pageNum: this.queryParams.pageNum, - pageSize: this.queryParams.pageSize, + pageSize: this.queryParams.pageSize } data.uniCons = this.previewDate.uconList + //todo 需要修改 RealData(data).then(res => { this.previewDate.data = res.rows this.total = res.total - this.previewDate.header = [] - for (const key in this.previewDate.data[0]) { - this.previewDate.header.push(key) - } }) }, outPlaceholder(item) { - return "请输入" + item.ucName + return '请输入' + item.ucName }, doAutoRefresh(interval) { if (interval === -1) { @@ -235,46 +237,81 @@ export default { }, doSaveData(graphData) { let data = { - id : this.topId, - topJson:JSON.stringify(graphData) + id: this.topId, + topJson: JSON.stringify(graphData) } //todo 入库完成 - updateQuery(data).then(res =>{ + updateQuery(data).then(res => { this.msgSuccess(res.msg) }) }, - doOnLine(){ - this.$confirm('请确认top图结构无误并预览结果无误后上线?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function () { + doOnLine() { + this.$confirm('请确认top图结构无误并预览结果无误后上线?', '警告', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(function() { }) }, //预览 - doPreview(graphData){ - if (graphData.nodes&&graphData.nodes.length>0){ + doPreview(graphData) { + if (graphData.nodes && graphData.nodes.length > 0) { + let nodeList = graphData.nodes + let edgeList = graphData.edges + let nodes = [] + nodeList.forEach(node => { + nodes.push({ + id: node.id, + label: node.label, + table: node.table, + columns: node.columns + }) + }) + let edges = [] + edgeList.forEach(edge => { + edges.push({ + id:edge.id, + label: edge.label, + source: edge.source, + target: edge.target, + appConfig: edge.appConfig + }) + }) + let data = { - jsonData:JSON.stringify(graphData), - id:this.topId + jsonData: JSON.stringify({ + nodes: nodes, + edges: edges + }), + id: this.topId } - preview(data).then(res=>{ + console.log({ + nodes: nodes, + edges: edges + }) + preview(data).then(res => { this.previewDate.data = res.rows this.previewDate.total = res.total this.previewDate.uconList = res.uconList - if (this.previewDate.uconList.length>0){ + if (this.previewDate.uconList.length > 0) { this.previewDate.showSearch = true } this.previewDate.header = [] - for (const key in this.previewDate.data[0]) { - this.previewDate.header.push(key) - } - this.previewDate.title = this.baseData.uqName + "数据预览" + let infoList = res.infoList + infoList.forEach( info=>{ + this.previewDate.header.push({ + key: info.prop, + label: info.label, + prop: info.prop + }) + }) + + this.previewDate.title = this.baseData.uqName + '数据预览' this.previewDate.open = true }) - }else { - this.msgError("top数据有误,请再次检查") + } else { + this.msgError('top数据有误,请再次检查') } }, randomChange() {