+
-
+
dataSourceName === ele.value) ||
- {}
return {
- queryType,
- num: obj.value,
- label: obj.label
+ queryType: this.formInline.queryType,
+ num: this.formInline.dataSourceName,
+ label: this.nodeData.name,
+ nodeData: this.nodeData
}
},
queryTypeTitle() {
@@ -189,9 +253,9 @@ export default {
},
created() {
this.routerWithParams = this.$route.query
- const { id, queryType } = this.routerWithParams
+ const { id, queryType, name } = this.routerWithParams
if (id && queryType) {
- this.searchDetail(id, queryType)
+ this.searchDetail(id, queryType, name)
return
}
this.listDatasource()
@@ -204,11 +268,12 @@ export default {
this.getChartSize()
},
methods: {
+ data,
activeQueryType(activeIcon) {
this.activeIcon = activeIcon
this.onSubmit()
},
- async searchDetail(id, queryType) {
+ async searchDetail(id, queryType, name) {
switch (queryType) {
case 'datasource':
await this.listDatasource()
@@ -223,6 +288,13 @@ export default {
break
}
this.formInline = { queryType, dataSourceName: id }
+ this.nodeData = { id, name }
+ this.ignoredOptions = [this.nodeData]
+ this.$refs.resourceTree.setCurrentKey(id)
+ const currentParents = this.$refs.resourceTree.getNodePath(this.nodeData)
+ currentParents.forEach((node) => {
+ this.$refs.resourceTree.store.nodesMap[node.id].expanded = true
+ })
this.getChartData()
},
getChartData() {
@@ -234,9 +306,14 @@ export default {
case 'dataset':
this.getDatasetRelationship(id)
break
- case 'panel':
- this.getPanelRelationship(id)
+ case 'panel': {
+ let targetId = id
+ if (this.nodeData.source) {
+ targetId = this.nodeData.source
+ }
+ this.getPanelRelationship(targetId)
break
+ }
default:
break
}
@@ -270,7 +347,7 @@ export default {
})
},
formatter(row, column, cellValue) {
- return cellValue ? cellValue : '-'
+ return cellValue || '-'
},
initTable() {
this.paginationConfig.total = this.treeData.length
@@ -302,7 +379,7 @@ export default {
}
})
},
- getChartSize: _.debounce(function () {
+ getChartSize: _.debounce(function() {
const dom = document.querySelector(
this.activeIcon === 'date' ? '.consanguinity-table' : '#consanguinity'
)
@@ -313,44 +390,67 @@ export default {
}, 200),
listDatasource() {
return listDatasource().then((res) => {
- const arr = res?.data || []
- this.dataSourceNameList = arr.map((ele) => ({
- value: ele.id,
- label: ele.name
- }))
+ const dsArr = res?.data || []
+ const typeMap = {}
+ dsArr.forEach((item) => {
+ if (!typeMap[item.type]) {
+ typeMap[item.type] = [{ id: item.id, name: item.name, type: 'datasource' }]
+ this.resourceTreeData.push({
+ id: item.type,
+ name: item.typeDesc,
+ type: 'folder',
+ children: typeMap[item.type]
+ })
+ } else {
+ typeMap[item.type].push({ id: item.id, name: item.name, type: 'datasource' })
+ }
+ })
})
},
getDatasetList() {
- return getDatasetList().then((res) => {
- const arr = res?.data || []
- this.dataSourceNameList = arr.map((ele) => ({
- value: ele.id,
- label: ele.name
- }))
+ return queryAuthModel({ modelType: 'dataset' }, false).then((res) => {
+ this.resourceTreeData = res.data
})
},
getPanelGroupList() {
- return getPanelGroupList().then((res) => {
- const arr = res?.data || []
- this.dataSourceNameList = arr.map((ele) => ({
- value: ele.id,
- label: ele.name
- }))
+ return defaultTree({ panelType: 'system' }, true).then((res) => {
+ if (res.data?.length > 0) {
+ const defaultPanelTree = {
+ id: 'defaultPanel',
+ name: this.$t('panel.default_panel'),
+ nodeType: 'folder',
+ children: res.data
+ }
+ this.resourceTreeData.push(defaultPanelTree)
+ }
+ }).then(() => {
+ const form = {
+ panelType: 'self',
+ sort: 'create_time desc,node_type desc,name asc'
+ }
+ groupTree(form, true).then((res) => {
+ this.resourceTreeData = [...this.resourceTreeData, ...res.data]
+ })
})
},
queryTypeChange(val) {
this.formInline.dataSourceName = ''
- this.dataSourceNameList = []
+ this.resourceTreeData = []
+ this.nodeData = {}
+ this.currentNode = {}
switch (val) {
- case 'datasource':
+ case 'datasource': {
this.listDatasource()
break
- case 'dataset':
+ }
+ case 'dataset': {
this.getDatasetList()
break
- case 'panel':
+ }
+ case 'panel': {
this.getPanelGroupList()
break
+ }
default:
break
}
@@ -374,6 +474,88 @@ export default {
handleCurrentChange(currentPage) {
this.paginationConfig.currentPage = currentPage
this.onSubmit()
+ },
+ getIconClass(queryType, nodeData) {
+ switch (queryType) {
+ case 'datasource': {
+ if (nodeData.type === 'folder') {
+ return 'scene'
+ }
+ return 'db-de'
+ }
+ case 'dataset': {
+ if (nodeData.modelInnerType === 'group') {
+ return 'scene'
+ }
+ return `ds-${nodeData.modelInnerType}`
+ }
+ case 'panel':
+ if (nodeData.nodeType === 'panel') {
+ let iconClass = 'panel-'
+ if (nodeData.mobileLayout) {
+ iconClass += 'mobile-'
+ }
+ iconClass += nodeData.status
+ return iconClass
+ }
+ return 'scene'
+ default:
+ break
+ }
+ },
+ getNodeClass(queryType, nodeData) {
+ switch (queryType) {
+ case 'dataset': {
+ if (nodeData.modelInnerType !== 'group') {
+ return `ds-icon-${nodeData.modelInnerType}`
+ }
+ return ''
+ }
+ case 'panel': {
+ if (nodeData.nodeType === 'panel') {
+ return 'ds-icon-scene'
+ }
+ return ''
+ }
+ default: {
+ return ''
+ }
+ }
+ },
+ filterNodeMethod(value, data) {
+ if (!value) {
+ return true
+ }
+ return data.name.toLowerCase().indexOf(value.toLowerCase()) !== -1
+ },
+ filterMethod(filterText) {
+ this.$refs.resourceTree.filter(filterText)
+ },
+ nodeClick(data, node) {
+ if (node.isLeaf) {
+ this.ignoredOptions = [{ id: data.id, name: data.name }]
+ this.formInline.dataSourceName = data.id
+ this.showTree = false
+ this.nodeData = data
+ this.currentNode = node
+ }
+ },
+ resetFilter() {
+ if (this.showTree) {
+ this.showTree = false
+ this.$refs.resourceTree.filter()
+ this.$refs.resourceTree.setCurrentKey(this.formInline.dataSourceName)
+ if (this.formInline.dataSourceName === '') {
+ this.$refs.resourceTree.setCurrentKey(null)
+ }
+ if (this.formInline.dataSourceName) {
+ const currentParents = this.$refs.resourceTree.getNodePath(this.nodeData).map((item) => item.id)
+ const nodesMap = this.$refs.resourceTree.store.nodesMap || {}
+ for (const key in nodesMap) {
+ nodesMap[key].expanded = currentParents.includes(key)
+ }
+ }
+ }
}
}
}
@@ -428,4 +610,35 @@ export default {
}
}
}
+.custom-tree-node {
+ flex: 1;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ font-size: 14px;
+ padding-right: 8px;
+}
+
+.custom-tree-node-list {
+ flex: 1;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ font-size: 14px;
+ padding: 0 8px;
+}
+
+.father .child {
+ /*display: none;*/
+ visibility: hidden;
+}
+
+.father:hover .child {
+ /*display: inline;*/
+ visibility: visible;
+}
+.relation-popover {
+ max-height: 70%;
+ overflow-y: scroll;
+}
diff --git a/frontend/src/views/system/sysParam/Operator.vue b/frontend/src/views/system/sysParam/Operator.vue
index ebf533b493..120b1736a1 100644
--- a/frontend/src/views/system/sysParam/Operator.vue
+++ b/frontend/src/views/system/sysParam/Operator.vue
@@ -17,20 +17,3 @@ export default {
}
}
-
-
diff --git a/frontend/src/views/system/user/UserEditer.vue b/frontend/src/views/system/user/UserEditer.vue
index e3cf2b0a13..fcaf287844 100644
--- a/frontend/src/views/system/user/UserEditer.vue
+++ b/frontend/src/views/system/user/UserEditer.vue
@@ -223,7 +223,6 @@