From 247c6c23b37be1dae5bf119f44b79073d506d5ef Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Wed, 27 Apr 2022 10:34:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BB=AA=E8=A1=A8=E6=9D=BF=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E5=99=A8=E8=AE=BF=E9=97=AE=E6=95=B0=E6=8D=AE=E9=9B=86?= =?UTF-8?q?api=E6=9D=83=E9=99=90=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/panel/filter/filterDialog.vue | 62 +++++++++---------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/frontend/src/views/panel/filter/filterDialog.vue b/frontend/src/views/panel/filter/filterDialog.vue index 6b6ddea4f3..2acc5d44c2 100644 --- a/frontend/src/views/panel/filter/filterDialog.vue +++ b/frontend/src/views/panel/filter/filterDialog.vue @@ -35,18 +35,17 @@ node-key="id" :data="datas" :props="defaultProps" - lazy - :load="loadTree" + @node-click="handleNodeClick" > - - - - - - + + + + + + @@ -202,13 +201,13 @@ import FilterHead from './filterMain/FilterHead' import FilterControl from './filterMain/FilterControl' import FilterFoot from './filterMain/FilterFoot' import bus from '@/utils/bus' +import { queryAuthModel } from '@/api/authModel/authModel' import { mapState } from 'vuex' import { groupTree, - fieldListWithPermission, - post + fieldListWithPermission } from '@/api/dataset/dataset' import { viewsWithIds @@ -366,6 +365,26 @@ export default { }, methods: { + + treeNode(cache) { + const modelInfo = localStorage.getItem('dataset-tree') + const userCache = (modelInfo && cache) + if (userCache) { + this.tData = JSON.parse(modelInfo) + const results = this.buildTree(this.tData) + this.defaultDatas = JSON.parse(JSON.stringify(results)) + this.datas = JSON.parse(JSON.stringify(results)) + } + queryAuthModel({ modelType: 'dataset' }, !userCache).then(res => { + localStorage.setItem('dataset-tree', JSON.stringify(res.data)) + if (!userCache) { + this.tData = res.data + const results = this.buildTree(this.tData) + this.defaultDatas = JSON.parse(JSON.stringify(results)) + this.datas = JSON.parse(JSON.stringify(results)) + } + }) + }, initWithField() { if (this.myAttrs && this.myAttrs.activeName) { this.activeName = this.myAttrs.activeName @@ -457,28 +476,7 @@ export default { this.showFieldDatas(data) } }, - loadTree(node, resolve) { - if (!this.isTreeSearch) { - if (node.level > 0) { - if (node.data.id) { - post('/dataset/table/listAndGroup', { - sort: 'type asc,name asc,create_time desc', - sceneId: node.data.id - }).then(res => { - resolve(res.data) - }) - } - } - } else { - node.data.children && resolve(node.data.children) - } - }, - treeNode(group) { - post('/dataset/group/treeNode', group).then(res => { - this.defaultDatas = res.data - this.datas = res.data - }) - }, + loadDataSetTree() { groupTree({}).then(res => { const datas = res.data