|
|
@@ -122,12 +122,18 @@ export default {
|
|
|
this.loadTreeData()
|
|
|
},
|
|
|
methods: {
|
|
|
- loadTreeData() {
|
|
|
+ loadTreeData () {
|
|
|
findTreeData({ categoryKey: this.categoryKey }).then(response => {
|
|
|
- this.treeData = response.data || []
|
|
|
+ const data = response.data || []
|
|
|
if (this.hasPermission) {
|
|
|
- this.treeData = this.treeData.filter(i => i.isShow !== '1')
|
|
|
+ // this.treeData = this.treeData.filter(i => i.isShow !== '1')
|
|
|
+ // 处理isShow,父级节点不显示子节点都不显示
|
|
|
+ const noData = data.filter(item => item.isShow === '1')
|
|
|
+ const noIdList = noData.map((obj, index) => { return obj.id }).join(',').split(',')
|
|
|
+ const tree = data.filter(item => item.isShow !== '1' && !noIdList.includes(item.parentId))
|
|
|
+ this.treeData = tree
|
|
|
}
|
|
|
+
|
|
|
this.$emit('treeData', response.data)
|
|
|
})
|
|
|
},
|