fix bug
This commit is contained in:
@@ -1676,10 +1676,25 @@ export default {
|
||||
loadDeptOptions() {
|
||||
getDeptTree().then(res => {
|
||||
const deptTree = res.data.data || [];
|
||||
const undertakeDeptTree =
|
||||
this.dialogType === 'add' ? this.excludeExternalOrganization(deptTree) : deptTree;
|
||||
this.deptOptions = this.flattenDept(deptTree);
|
||||
this.deptTreeOptions = this.toDeptCascaderOptions(deptTree);
|
||||
this.deptTreeOptions = this.toDeptCascaderOptions(undertakeDeptTree);
|
||||
});
|
||||
},
|
||||
excludeExternalOrganization(list = []) {
|
||||
return list.reduce((result, item) => {
|
||||
const deptName = item.title || item.deptName || item.name;
|
||||
if (String(deptName || '').trim() === '外部组织') return result;
|
||||
result.push({
|
||||
...item,
|
||||
children: item.children?.length
|
||||
? this.excludeExternalOrganization(item.children)
|
||||
: item.children,
|
||||
});
|
||||
return result;
|
||||
}, []);
|
||||
},
|
||||
toDeptCascaderOptions(list = []) {
|
||||
return list.map(item => ({
|
||||
label: item.title || item.deptName || item.name,
|
||||
|
||||
Reference in New Issue
Block a user