Commit e30d4cb1 by Jings

fix: 权限数据过滤

parent ffae9834
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @Author: Drama * @Author: Drama
* @Date: 2022-09-14 11:09:43 * @Date: 2022-09-14 11:09:43
* @LastEditors: Drama * @LastEditors: Drama
* @LastEditTime: 2022-10-14 12:30:00 * @LastEditTime: 2022-10-17 15:59:54
* @FilePath: /haoban-3/src/views/enterprise/guide-setting-new.vue * @FilePath: /haoban-3/src/views/enterprise/guide-setting-new.vue
* Copyright (C) 2022 huzhenhong. All rights reserved. * Copyright (C) 2022 huzhenhong. All rights reserved.
--> -->
...@@ -176,7 +176,27 @@ export default { ...@@ -176,7 +176,27 @@ export default {
// }); // });
// item.rightId = item.menuCode; // item.rightId = item.menuCode;
// }); // });
// 添加处理字段
result.forEach(item => { result.forEach(item => {
// 一级
item.ownerShipArr = item.ownerShip.split('|');
if (item.menuBOList.length) {
// 二级
item.menuBOList.forEach(item_2 => {
item_2.ownerShipArr = item_2.ownerShip.split('|');
if (item_2.menuBOList.length) {
// 三级
item_2.menuBOList.forEach(item_3 => {
item_3.ownerShipArr = item_3.ownerShip.split('|');
});
}
});
}
});
let dealArr = deepClone(result);
let dealTreeData = this.filterTreeData(dealArr, String(clerkType));
dealTreeData.forEach(item => {
item.fold = false; item.fold = false;
item.childList = item.menuBOList; // 构造childList item.childList = item.menuBOList; // 构造childList
item.rightType = '0'; item.rightType = '0';
...@@ -197,7 +217,7 @@ export default { ...@@ -197,7 +217,7 @@ export default {
}); });
} }
}); });
this['treeData_' + clerkType] = deepClone(result); this['treeData_' + clerkType] = deepClone(dealTreeData);
if (clerkType == 0) { if (clerkType == 0) {
this.treeData = deepClone(this.treeData_0); this.treeData = deepClone(this.treeData_0);
} }
...@@ -212,6 +232,12 @@ export default { ...@@ -212,6 +232,12 @@ export default {
} }
}); });
}, },
// 递归过滤
filterTreeData(column, text) {
let newColumn = column.filter(item => item.ownerShipArr.includes(text));
newColumn.forEach(x => x.menuBOList && (x.menuBOList = this.filterTreeData(x.menuBOList, text)));
return newColumn;
},
// 保存 // 保存
submit: _debounce(function() { submit: _debounce(function() {
let currentChooseList = this.$refs.tree.getCheckedKeys().concat(this.$refs.tree.getHalfCheckedKeys()); let currentChooseList = this.$refs.tree.getCheckedKeys().concat(this.$refs.tree.getHalfCheckedKeys());
......
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