feat ทำ ย้อนกลับ
This commit is contained in:
parent
d00752d344
commit
1855d67ed3
1 changed files with 57 additions and 1 deletions
|
|
@ -39,6 +39,11 @@ const { data: branchData } = storeToRefs(branchStore);
|
||||||
|
|
||||||
const modal = ref<boolean>(false);
|
const modal = ref<boolean>(false);
|
||||||
|
|
||||||
|
const currentHeadOfficeId = ref<string>();
|
||||||
|
const currentHeadOfficeName = ref<{
|
||||||
|
nameTh: string;
|
||||||
|
nameEn: string;
|
||||||
|
}>({ nameTh: '', nameEn: '' });
|
||||||
const currentBranchIdEdit = ref<string>('');
|
const currentBranchIdEdit = ref<string>('');
|
||||||
const currentBranchContactIdEdit = ref<string>('');
|
const currentBranchContactIdEdit = ref<string>('');
|
||||||
const showCurrentBranch = ref<Branch>();
|
const showCurrentBranch = ref<Branch>();
|
||||||
|
|
@ -161,6 +166,8 @@ async function getTree() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
subBranch.value = false;
|
subBranch.value = false;
|
||||||
|
showCurrentBranch.value = undefined;
|
||||||
|
currentHeadOfficeId.value = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -391,6 +398,13 @@ async function fetchSubBranch(id: string) {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
|
if (result.isHeadOffice) {
|
||||||
|
currentHeadOfficeId.value = result.id;
|
||||||
|
currentHeadOfficeName.value = {
|
||||||
|
nameTh: result.name,
|
||||||
|
nameEn: result.nameEN,
|
||||||
|
};
|
||||||
|
}
|
||||||
rowsBranch.value = result.branch.map((v) => ({
|
rowsBranch.value = result.branch.map((v) => ({
|
||||||
id: v.id,
|
id: v.id,
|
||||||
name: v.code,
|
name: v.code,
|
||||||
|
|
@ -401,6 +415,8 @@ async function fetchSubBranch(id: string) {
|
||||||
type: v.isHeadOffice,
|
type: v.isHeadOffice,
|
||||||
status: v.status,
|
status: v.status,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
showCurrentBranch.value = undefined;
|
||||||
subBranch.value = true;
|
subBranch.value = true;
|
||||||
openCardDetails.value = false;
|
openCardDetails.value = false;
|
||||||
openTableCard.value = true;
|
openTableCard.value = true;
|
||||||
|
|
@ -462,10 +478,39 @@ onMounted(async () => {
|
||||||
<AppBox class="bg-card-branch-title" style="border-radius: 0">
|
<AppBox class="bg-card-branch-title" style="border-radius: 0">
|
||||||
<div class="row items-center">
|
<div class="row items-center">
|
||||||
<span
|
<span
|
||||||
|
v-if="false"
|
||||||
class="col q-pl-md text-h6 text-weight-bold color-card-branch-title"
|
class="col q-pl-md text-h6 text-weight-bold color-card-branch-title"
|
||||||
>
|
>
|
||||||
{{ $t('headQuarters') }}
|
{{ $t('headQuarters') }}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
<span class="col text-h7 text-weight-bold color-card-branch-title">
|
||||||
|
<div class="row" style="width: 300px">
|
||||||
|
<div class="column q-px-sm" @click="getTree()">ทั้งหมด</div>
|
||||||
|
<div class="column q-px-sm" v-if="currentHeadOfficeId">></div>
|
||||||
|
<div
|
||||||
|
class="column q-px-sm"
|
||||||
|
v-if="currentHeadOfficeId"
|
||||||
|
@click="fetchSubBranch(currentHeadOfficeId)"
|
||||||
|
>
|
||||||
|
{{ currentHeadOfficeName.nameTh }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="column q-px-sm"
|
||||||
|
v-if="showCurrentBranch && !showCurrentBranch.isHeadOffice"
|
||||||
|
>
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="column q-px-sm"
|
||||||
|
v-if="showCurrentBranch && !showCurrentBranch.isHeadOffice"
|
||||||
|
>
|
||||||
|
{{ showCurrentBranch.code }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
|
|
||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
<q-input
|
<q-input
|
||||||
class="bordered rounded q-px-md"
|
class="bordered rounded q-px-md"
|
||||||
|
|
@ -507,7 +552,18 @@ onMounted(async () => {
|
||||||
>
|
>
|
||||||
<template #default-header="prop">
|
<template #default-header="prop">
|
||||||
<div
|
<div
|
||||||
@click="fetchSubBranch(prop.node.id)"
|
@click="
|
||||||
|
() => {
|
||||||
|
fetchSubBranch(prop.node.id);
|
||||||
|
|
||||||
|
if (
|
||||||
|
!expanded.includes(prop.node.name) &&
|
||||||
|
expanded.length <= 1
|
||||||
|
) {
|
||||||
|
expanded.push(prop.node.name);
|
||||||
|
} else expanded[1] = prop.node.name;
|
||||||
|
}
|
||||||
|
"
|
||||||
class="q-px-sm color-brach-tree-text"
|
class="q-px-sm color-brach-tree-text"
|
||||||
:class="{
|
:class="{
|
||||||
'color-tree-active': expanded.includes(prop.node.name),
|
'color-tree-active': expanded.includes(prop.node.name),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue