Commit 18331636 by xiaohai

merge

parent edf23bf4
......@@ -123,84 +123,105 @@
},
methods: {
formatGroupData(treeData, personData) {
let _this = this;
let data = [].concat(JSON.parse(JSON.stringify(treeData)));
let employees = [].concat(JSON.parse(JSON.stringify(personData)));
let copyData = data.slice(0);
let onlyGroup = _this.onlyGroup;
this.menuData = [];
this.defaultOpen = [];
this.menusObj = {};
data.forEach(group => {
group.allClerks = null;
group.childrens = null;
group.label = group.name || "";
group.id = group.groupId || "";
let allClerks = [];
let arr = [];
if (onlyGroup.length > 0) {
if (onlyGroup.indexOf(group.groupId) > -1) {
group.disableOpen = false;
group.disabled = true;
} else {
group.disabled = true;
group.disableOpen = true;
}
} else {
group.disabled = _this.onlyPerson ? true : group.hasPression == 1 ? false : true;
}
copyData.forEach(cG => {
cG.label = cG.name || "";
cG.id = cG.groupId || "";
cG.disableOpen = false;
if (onlyGroup.length > 0) {
if (onlyGroup.indexOf(cG.groupId) > -1) {
cG.disableOpen = false;
cG.disabled = true;
if (cG.parentId == group.groupId) {
arr.push(cG);
}
} else {
cG.disabled = true;
cG.disableOpen = true;
}
} else {
cG.disabled = _this.onlyPerson ? true : cG.hasPression == 1 ? false : true;
if (cG.parentId == group.groupId) {
arr.push(cG);
}
}
});
if (_this.treeSet.isSelectPerson && group.hasPression == 1) employees.forEach(person => {
person.label = person.name;
person.id = person.employeeClerkId;
if (person.departmentId == group.groupId) {
arr.push(person);
allClerks.push(person);
}
_this.menusObj[person.id] = person;
});
if (arr.length > 0) group.childrens = arr;
group.allClerks = allClerks;
if (onlyGroup.length > 0) {
if (onlyGroup.indexOf(group.groupId) > -1) {
group.hasLoad = true;
_this.defaultOpen.push(group.id);
if (onlyGroup.indexOf(group.parentId) < 0) {
_this.menuData.push(group);
}
}
let obj = {};
let arr = [];
arr = treeData.splice(0).concat(personData.slice(0));
arr.forEach(tree => {
if (tree.employeeClerkId) {
tree.id = tree.employeeClerkId;
tree.label = tree.name;
obj[tree.id] = tree;
} else {
if (group.level == 0) {
group.disabled = !(group.childrens == null || group.childrens.length == 0);
group.hasLoad = true;
_this.menuData = [group];
_this.defaultOpen.push(group.id);
}
tree.id = tree.groupId;
tree.label = tree.name;
obj[tree.id] = tree;
}
_this.menusObj[group.id] = group;
});
this.sortTheGroup(obj);
},
sortTheGroup(groups) {
console.log(groups);
},
// formatGroupData(treeData, personData) {
// console.log(treeData, personData);
// let _this = this;
// let data = treeData.slice(0);
// let employees = personData.slice(0);
// let copyData = data.slice(0);
// let onlyGroup = _this.onlyGroup;
// this.menuData = [];
// this.defaultOpen = [];
// this.menusObj = {};
// data.forEach(group => {
// group.allClerks = null;
// group.childrens = null;
// group.label = group.name || "";
// group.id = group.groupId || "";
// let allClerks = [];
// let arr = [];
// if (onlyGroup.length > 0) {
// if (onlyGroup.indexOf(group.groupId) > -1) {
// group.disableOpen = false;
// group.disabled = true;
// } else {
// group.disabled = true;
// group.disableOpen = true;
// }
// } else {
// group.disabled = _this.onlyPerson ? true : group.hasPression == 1 ? false : true;
// }
// copyData.forEach(cG => {
// cG.label = cG.name || "";
// cG.id = cG.groupId || "";
// cG.disableOpen = false;
// if (onlyGroup.length > 0) {
// if (onlyGroup.indexOf(cG.groupId) > -1) {
// cG.disableOpen = false;
// cG.disabled = true;
// if (cG.parentId == group.groupId) {
// arr.push(cG);
// }
// } else {
// cG.disabled = true;
// cG.disableOpen = true;
// }
// } else {
// cG.disabled = _this.onlyPerson ? true : cG.hasPression == 1 ? false : true;
// if (cG.parentId == group.groupId) {
// arr.push(cG);
// }
// }
// });
// if (_this.treeSet.isSelectPerson && group.hasPression == 1) employees.forEach(person => {
// person.label = person.name;
// person.id = person.employeeClerkId;
// if (person.departmentId == group.groupId) {
// arr.push(person);
// allClerks.push(person);
// }
// _this.menusObj[person.id] = person;
// });
// if (arr.length > 0) group.childrens = arr;
// group.allClerks = allClerks;
// if (onlyGroup.length > 0) {
// if (onlyGroup.indexOf(group.groupId) > -1) {
// group.hasLoad = true;
// _this.defaultOpen.push(group.id);
// if (onlyGroup.indexOf(group.parentId) < 0) {
// _this.menuData.push(group);
// }
// }
// } else {
// if (group.level == 0) {
// group.disabled = !(group.childrens == null || group.childrens.length == 0);
// group.hasLoad = true;
// _this.menuData = [group];
// _this.defaultOpen.push(group.id);
// }
// }
// _this.menusObj[group.id] = group;
// });
// },
/**
* 树形菜单选择
*/
......
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