feat:增加组织树及项目归属权获取数据

This commit is contained in:
lixg
2022-11-24 15:10:01 +08:00
parent 57b9ba8263
commit affd52588a
6 changed files with 263 additions and 151 deletions

View File

@@ -42,18 +42,50 @@ export default defineComponent({
});
const currentRouteName = computed(() => route.name);
//获取组织树
const orgTree = () => {
let obj = {
id: 0,
keyWord: "",
pageNo: 0,
pageSize: 20,
};
api
.orgtree()
.getOrgInfo(obj)
.then((res) => {
console.log("获取集团组织成功", res);
if (res.status === 200) {
store.commit("getOrgtreeList", res.data.data);
// console.log("获取组织树成功", res.data.data);
// state.orgtreeList = res.data.data;
if (res.status === 200) {
let arr = res.data.data.rows;
for (let i = 0; i < arr.length; i++) {
let object = {
keyWord: "",
id: arr[i].id,
pageNo: 1,
pageSize: 20,
};
api
.getOrgInfo(object)
.then((res) => {
// console.log("获取子元素", res);
if (res.status === 200) {
arr[i].treeChildList = res.data.data.rows;
if (i === arr.length - 1) {
store.commit("getOrgtreeList", arr);
}
}
})
.catch((err) => {
console.log("获取子元素失败", err);
});
}
}
}
})
.catch((err) => {
console.log("获取集团组织失败", err);
console.log("获取组织失败", err);
});
};
orgTree();