ปรับการ fetxhStructure
This commit is contained in:
parent
1aceedf3d9
commit
cfdb0c0dfb
1 changed files with 10 additions and 5 deletions
|
|
@ -42,7 +42,13 @@ onMounted(async () => {
|
||||||
id && (await fetchStructChart(id, "0"));
|
id && (await fetchStructChart(id, "0"));
|
||||||
});
|
});
|
||||||
|
|
||||||
async function fetchStructChart(id: string, type: string) {
|
async function fetchStructChart(
|
||||||
|
id: string,
|
||||||
|
type: string,
|
||||||
|
status: boolean = false
|
||||||
|
) {
|
||||||
|
console.log(status);
|
||||||
|
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(config.API.orgStructChart(id, type))
|
.get(config.API.orgStructChart(id, type))
|
||||||
|
|
@ -52,7 +58,7 @@ async function fetchStructChart(id: string, type: string) {
|
||||||
const struct = [];
|
const struct = [];
|
||||||
struct.push({ ...data, officer: [], heads: [] });
|
struct.push({ ...data, officer: [], heads: [] });
|
||||||
dataSource.value = struct[0];
|
dataSource.value = struct[0];
|
||||||
if (dataSourceLock.value === undefined)
|
if (dataSourceLock.value === undefined || status)
|
||||||
dataSourceLock.value = dataSource.value;
|
dataSourceLock.value = dataSource.value;
|
||||||
breadcrumbsGen();
|
breadcrumbsGen();
|
||||||
}
|
}
|
||||||
|
|
@ -181,7 +187,6 @@ const findPath = (id: any) => {
|
||||||
id: dataSourceLock.value.deptID,
|
id: dataSourceLock.value.deptID,
|
||||||
type: dataSourceLock.value.type,
|
type: dataSourceLock.value.type,
|
||||||
});
|
});
|
||||||
console.log(_path);
|
|
||||||
|
|
||||||
if (dataSourceLock.value.deptID === id) return _path;
|
if (dataSourceLock.value.deptID === id) return _path;
|
||||||
if (dataSourceLock.value.children.length > 0) {
|
if (dataSourceLock.value.children.length > 0) {
|
||||||
|
|
@ -213,14 +218,14 @@ watch(
|
||||||
? store.draftId
|
? store.draftId
|
||||||
: "";
|
: "";
|
||||||
|
|
||||||
id && (await fetchStructChart(id, "0"));
|
id && (await fetchStructChart(id, "0", true));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => store.historyId,
|
() => store.historyId,
|
||||||
async () => {
|
async () => {
|
||||||
store.historyId && (await fetchStructChart(store.historyId, "0"));
|
store.historyId && (await fetchStructChart(store.historyId, "0", true));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue