Commit c9e3c7be authored by jingnan's avatar jingnan 👀

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

parent 1993e7f8
......@@ -27,6 +27,11 @@ export default {
appid: {
type: [String, Number],
default: () => ''
},
// 过滤模型
isFilterModel: {
type: Boolean,
default: false
}
},
data() {
......@@ -104,7 +109,11 @@ export default {
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.$nextTick(() => {
this.$refs.tree.filter('SOFT_TYPE')
......@@ -121,6 +130,20 @@ export default {
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) {
const treeData = []
if (tree instanceof Array) {
......
......@@ -18,7 +18,7 @@
/>
</el-select>
</div>
<permTree ref="permTree" @change="changeNode" />
<permTree ref="permTree" :is-filter-model="true" @change="changeNode" />
</div>
</template>
<template slot="paneR">
......
......@@ -54,21 +54,25 @@ export default {
if (!id) {
return
}
let findItem = null
if (apps.length) {
findItem = apps.find(r => r.value === id)
}
// let findItem = null
// if (apps.length) {
// findItem = apps.find(r => r.value === id)
// }
const result = await get('/DxAppModelDefLink/findPackageByAppID', { appId: id })
if (!result.items) {
this.treeData = []
this.nodeClick(null, [])
return
}
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)
// packageIsShow 为 false 不展示
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 => {
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
})
......@@ -77,6 +81,20 @@ export default {
})
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) {
const treeData = []
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