From ca87c5e438b090547c113e92846f5602fce9d9f3 Mon Sep 17 00:00:00 2001 From: sunshine7058 <2564255161@qq.com> Date: Sun, 28 Apr 2024 09:59:51 +0800 Subject: [PATCH] =?UTF-8?q?fix():=E5=AE=8C=E5=96=84=E5=AD=97=E5=85=B8?= =?UTF-8?q?=E8=A1=A8=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/data/dictData.js | 27 +++ src/api/data/dictType.js | 26 +++ src/api/data/source.js | 10 +- .../dashboard/OverallAssetStructure.vue | 67 ++++--- .../dashboard/OverallSpecificAssets.vue | 179 ++++++++++++++---- src/views/data/assetStructure/index.vue | 42 +++- 6 files changed, 269 insertions(+), 82 deletions(-) create mode 100644 src/api/data/dictData.js create mode 100644 src/api/data/dictType.js diff --git a/src/api/data/dictData.js b/src/api/data/dictData.js new file mode 100644 index 0000000..064ddb4 --- /dev/null +++ b/src/api/data/dictData.js @@ -0,0 +1,27 @@ +import request from '@/utils/request' + +// 添加字典数据 +export function addDictData(data) { + return request({ + url: '/data/source/dictData/addDictData', + method: 'post', + data: data + }) +} + +// 修改字典数据 +export function updateDictData(data) { + return request({ + url: '/data/source/dictData/editDictData', + method: 'post', + data: data + }) +} + +// 删除字典数据 +export function delDictData(id) { + return request({ + url: '/data/source/dictData/delDictData/' + id, + method: 'get' + }) +} diff --git a/src/api/data/dictType.js b/src/api/data/dictType.js new file mode 100644 index 0000000..621c483 --- /dev/null +++ b/src/api/data/dictType.js @@ -0,0 +1,26 @@ +import request from '@/utils/request' + +// 根据数据源id查询字典类型数据 +export function getDictDataList(id) { + return request({ + url: '/data/source/dictType/getDictDataList/' + id, + method: 'get' + }) +} + +// 添加字典类型 +export function addDictType(data) { + return request({ + url: '/data/source/dictType/addDictType', + method: 'post', + data: data + }) +} + +// 删除字典类型 +export function delDictType(id) { + return request({ + url: '/data/source/dictType/delDictType/' + id, + method: 'get' + }) +} diff --git a/src/api/data/source.js b/src/api/data/source.js index 383d9ff..e80f66a 100644 --- a/src/api/data/source.js +++ b/src/api/data/source.js @@ -109,10 +109,12 @@ export function getTableDataCount(id) { }) } -// 根据数据源id查询字典类型数据 -export function getDictDataList(id) { +// 修改字段是否为字典 +export function updTableData(data) { return request({ - url: '/source/dictType/getDictDataList/' + id, - method: 'get' + url: '/data/source/updTableData', + method: 'post', + data: data }) } + diff --git a/src/views/data/assetStructure/dashboard/OverallAssetStructure.vue b/src/views/data/assetStructure/dashboard/OverallAssetStructure.vue index d0b3b25..5e0a343 100644 --- a/src/views/data/assetStructure/dashboard/OverallAssetStructure.vue +++ b/src/views/data/assetStructure/dashboard/OverallAssetStructure.vue @@ -53,13 +53,9 @@ placement="left" width="200" trigger="hover"> - - - + + + {{ scope.row.dictKey }} @@ -147,16 +143,17 @@ - - + + - - - + + + @@ -164,13 +161,14 @@ diff --git a/src/views/data/assetStructure/dashboard/OverallSpecificAssets.vue b/src/views/data/assetStructure/dashboard/OverallSpecificAssets.vue index 05d774a..8329883 100644 --- a/src/views/data/assetStructure/dashboard/OverallSpecificAssets.vue +++ b/src/views/data/assetStructure/dashboard/OverallSpecificAssets.vue @@ -42,30 +42,23 @@ content="这个字典是数据资产项目当中的字典内容,而不是本项目当中的字典内容。主要作用为数据清洗过程中数据字典映射作用"> - - - - - - - 确定 - - - 新增字典 - + 新增字典 + - +
- {{dict.dictName+'('+dict.dictType+')'}} + {{ dict.dictName + '(' + dict.dictType + ')' }} + 删除 + 新增 + >新增数据
@@ -87,13 +80,19 @@ v-if="!scope.row.isEdit" size="mini" type="text" - icon="el-icon-edit" - @click="scope.row.isEdit = true" + @click="$set(scope.row,'isEdit',true)" >修改 + 删除 +
- + + + + + + + + + + + + + + + - +
- diff --git a/src/views/data/assetStructure/index.vue b/src/views/data/assetStructure/index.vue index fd8449b..eb3fc8d 100644 --- a/src/views/data/assetStructure/index.vue +++ b/src/views/data/assetStructure/index.vue @@ -23,9 +23,9 @@ + :assetId="assetId" :title="title"/> + :asset-id="assetId"/> @@ -38,6 +38,7 @@ import { addTableData, getAssetList, getChildrenList, + getTableDataCount, selectTableData, selectTableDataCount } from "@/api/data/source"; @@ -52,11 +53,11 @@ export default { children: 'childrenList', label: 'name' }, - dictDataList: [], assetStructureList: [], childrenList: [], tableDataList: [], childrenParams: null, + assetId: 0, showAssets: null, title: null, showTable: { @@ -71,19 +72,24 @@ export default { } }, methods: { - expandTable(node, resolve) { console.log(node) console.log(resolve) if (node.level === 0) return resolve(this.assetStructureList); const {data} = node; if (data.type === 'dataSource') { - getTableDataCount(data.id).then(res => { - this.count = res.data - }) - getDictDataList(data.id).then(res => { - this.dictDataList = res.data - console.log(this.dictDataList) + this.assetId = data.id + console.log(this.assetId) + getChildrenList(data).then(res => { + this.childrenList = res.data + resolve(this.childrenList) + this.childrenList.forEach(children => { + this.showTable.assetStructure = data + this.showTable.tableName = children.name + addTableData(this.showTable).then(res => { + // console.log(res) + }) + }) }) } // this.showAssets = data.type; @@ -102,6 +108,22 @@ export default { showAssetsFun(data) { this.title = data.name + '(' + data.databaseName + '-' + data.systemName + ')' this.showAssets = data.type; + if (data.type === 'dataSource') { + this.assetId = data.id + console.log(this.assetId) + getTableDataCount(data.id).then(res => { + this.count = res.data + }) + getChildrenList(data).then(res => { + this.childrenList = res.data + this.childrenList.forEach(children => { + this.showTable.assetStructure = data + this.showTable.tableName = children.name + addTableData(this.showTable).then(res => { + }) + }) + }) + } if (data.type === "dataTable") { this.childrenParams = data selectTableData(data.id).then(res => {