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