Commit c9e3c7be authored by jingnan's avatar jingnan 👀

合并产品【10243 同 10248】【测评】控制不需要配置权限的模型包与模型不显示

parent 1993e7f8
...@@ -27,6 +27,11 @@ export default { ...@@ -27,6 +27,11 @@ export default {
appid: { appid: {
type: [String, Number], type: [String, Number],
default: () => '' default: () => ''
},
// 过滤模型
isFilterModel: {
type: Boolean,
default: false
} }
}, },
data() { data() {
...@@ -104,7 +109,11 @@ export default { ...@@ -104,7 +109,11 @@ export default {
el.target && treeList.push(el.target) el.target && treeList.push(el.target)
}) })
this.treeData = this.$utils.generateTree(treeList, { id: 'id', pid: 'parentId' }) let treeData = this.$utils.generateTree(treeList, { id: 'id', pid: 'parentId' })
if (this.isFilterModel) {
treeData = this.removeHideModel(treeData)
}
this.treeData = treeData
this.initTreeData = this.filterData(treeList, []) this.initTreeData = this.filterData(treeList, [])
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.tree.filter('SOFT_TYPE') this.$refs.tree.filter('SOFT_TYPE')
...@@ -121,6 +130,20 @@ export default { ...@@ -121,6 +130,20 @@ export default {
this.modelData = [] this.modelData = []
} }
}, },
// 递归移除节点,避免出现父子节点错位问题
removeHideModel(children) {
if (Array.isArray(children) && children.length > 0) {
return children.filter(m => {
if (m.modelIsShow === false) {
return false
} else {
m.children = this.removeHideModel(m.children)
}
return true
})
}
return children
},
filterData(tree, parentIds) { filterData(tree, parentIds) {
const treeData = [] const treeData = []
if (tree instanceof Array) { if (tree instanceof Array) {
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
/> />
</el-select> </el-select>
</div> </div>
<permTree ref="permTree" @change="changeNode" /> <permTree ref="permTree" :is-filter-model="true" @change="changeNode" />
</div> </div>
</template> </template>
<template slot="paneR"> <template slot="paneR">
......
...@@ -54,21 +54,25 @@ export default { ...@@ -54,21 +54,25 @@ export default {
if (!id) { if (!id) {
return return
} }
let findItem = null // let findItem = null
if (apps.length) { // if (apps.length) {
findItem = apps.find(r => r.value === id) // findItem = apps.find(r => r.value === id)
} // }
const result = await get('/DxAppModelDefLink/findPackageByAppID', { appId: id }) const result = await get('/DxAppModelDefLink/findPackageByAppID', { appId: id })
if (!result.items) { if (!result.items) {
this.treeData = [] this.treeData = []
this.nodeClick(null, []) this.nodeClick(null, [])
return return
} }
// packageIsShow 为 false 不展示
const data = findItem && findItem.data.name === '平台管理' ? this.$utils._clonedeep(result.items).filter(r => r.name !== 'DEX-SECURITYCENTER' && r.name !== 'User' && r.name !== 'DEX-AUTH' && r.name !== 'DEX-AUDIT') : this.$utils._clonedeep(result.items) result.items = result.items.filter(m => m.packageIsShow !== false)
const data = this.$utils._clonedeep(result.items)
// const data = findItem && findItem.data.name === '平台管理' ? this.$utils._clonedeep(result.items).filter(r => !['DEX-SECURITYCENTER', 'User', 'DEX-AUTH', 'DEX-AUDIT'].includes(r.name)) : this.$utils._clonedeep(result.items)
this.treeData = data.map(r => { this.treeData = data.map(r => {
if (r.modelDefinitionVOS) { if (r.modelDefinitionVOS) {
r.children = this.$utils.generateTree(this.$utils._clonedeep(r.modelDefinitionVOS), { id: 'id', pid: 'parentId' }) let children = this.$utils.generateTree(this.$utils._clonedeep(r.modelDefinitionVOS), { id: 'id', pid: 'parentId' })
children = this.removeHideModel(children)
r.children = children
} }
return r return r
}) })
...@@ -77,6 +81,20 @@ export default { ...@@ -77,6 +81,20 @@ export default {
}) })
this.nodeClick(this.treeData[0], []) this.nodeClick(this.treeData[0], [])
}, },
// 递归移除节点,避免出现父子节点错位问题
removeHideModel(children) {
if (Array.isArray(children) && children.length > 0) {
return children.filter(m => {
if (m.modelIsShow === false) {
return false
} else {
m.children = this.removeHideModel(m.children)
}
return true
})
}
return children
},
filterData(tree, parentIds) { filterData(tree, parentIds) {
const treeData = [] const treeData = []
if (tree instanceof Array) { if (tree instanceof Array) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment