fix: get list with head
This commit is contained in:
parent
630a667c64
commit
ddf21992ff
2 changed files with 9 additions and 7 deletions
|
|
@ -263,7 +263,7 @@ onMounted(async () => {
|
|||
// object, we are effectively unselecting any HQ branch.
|
||||
];
|
||||
|
||||
await fetchList({ pageSize: 99999, tree: true });
|
||||
await fetchList({ pageSize: 99999, tree: true, withHead: true });
|
||||
await calculateStats();
|
||||
|
||||
modeView.value = $q.screen.lt.md ? true : false;
|
||||
|
|
@ -641,7 +641,7 @@ async function triggerDelete(id: string) {
|
|||
const res = await branchStore.deleteById(id);
|
||||
|
||||
if (res) {
|
||||
await fetchList({ tree: true, pageSize: 99999 });
|
||||
await fetchList({ tree: true, pageSize: 99999, withHead: true });
|
||||
modalDrawer.value = false;
|
||||
modal.value = false;
|
||||
await calculateStats();
|
||||
|
|
@ -705,13 +705,14 @@ async function fetchList(opts: {
|
|||
zipCode?: string;
|
||||
query?: string;
|
||||
tree?: boolean;
|
||||
withHead?: boolean;
|
||||
filter?: 'head' | 'sub';
|
||||
}) {
|
||||
await branchStore.fetchList(opts);
|
||||
}
|
||||
|
||||
watch(inputSearch, () => {
|
||||
fetchList({ tree: true, query: inputSearch.value });
|
||||
fetchList({ tree: true, query: inputSearch.value, withHead: true });
|
||||
currentSubBranch.value = undefined;
|
||||
});
|
||||
|
||||
|
|
@ -737,7 +738,7 @@ async function triggerChangeStatus(
|
|||
});
|
||||
if (res) resolve(res);
|
||||
|
||||
await fetchList({ tree: true, pageSize: 99999 });
|
||||
await fetchList({ tree: true, pageSize: 99999, withHead: true });
|
||||
},
|
||||
cancel: () => {},
|
||||
});
|
||||
|
|
@ -767,7 +768,7 @@ async function onSubmit(submitSelectedItem?: boolean) {
|
|||
formData.value.codeHeadOffice = formData.value.code = res.code;
|
||||
imageUrl.value = `${baseUrl}/branch/${res.id}/image/${res.selectedImage}`;
|
||||
|
||||
await fetchList({ tree: true, pageSize: 99999 });
|
||||
await fetchList({ tree: true, pageSize: 99999, withHead: true });
|
||||
|
||||
if (!imageDialog.value) modalDrawer.value = submitSelectedItem || false;
|
||||
}
|
||||
|
|
@ -797,7 +798,7 @@ async function onSubmit(submitSelectedItem?: boolean) {
|
|||
formType.value = 'view';
|
||||
}
|
||||
|
||||
await fetchList({ tree: true, pageSize: 99999 });
|
||||
await fetchList({ tree: true, pageSize: 99999, withHead: true });
|
||||
};
|
||||
|
||||
if (
|
||||
|
|
@ -2069,7 +2070,7 @@ watch(currentHq, () => {
|
|||
formType = 'view';
|
||||
}
|
||||
|
||||
await fetchList({ tree: true, pageSize: 99999 });
|
||||
await fetchList({ tree: true, pageSize: 99999, withHead: true });
|
||||
}
|
||||
"
|
||||
:menu="formMenuIcon"
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ const useBranchStore = defineStore('api-branch', () => {
|
|||
query?: string;
|
||||
tree?: boolean;
|
||||
filter?: 'head' | 'sub';
|
||||
withHead?: boolean;
|
||||
},
|
||||
Data extends Pagination<Branch[]>,
|
||||
>(opts?: Options): Promise<Data | false> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue