fix: แก้ code ของสำนักงานใหญ่ไม่มา
This commit is contained in:
parent
c34b7008c0
commit
d62f401375
1 changed files with 30 additions and 5 deletions
|
|
@ -262,6 +262,7 @@ async function triggerEdit(
|
||||||
openFormType: string,
|
openFormType: string,
|
||||||
id: string,
|
id: string,
|
||||||
typeBranch: 'headOffice' | 'subBranch',
|
typeBranch: 'headOffice' | 'subBranch',
|
||||||
|
code?: string,
|
||||||
) {
|
) {
|
||||||
await fetchBranchById(id);
|
await fetchBranchById(id);
|
||||||
if (openFormType === 'form') {
|
if (openFormType === 'form') {
|
||||||
|
|
@ -269,10 +270,16 @@ async function triggerEdit(
|
||||||
openDialog();
|
openDialog();
|
||||||
}
|
}
|
||||||
if (openFormType === 'drawer') {
|
if (openFormType === 'drawer') {
|
||||||
|
console.log(code);
|
||||||
|
|
||||||
formType.value = 'view';
|
formType.value = 'view';
|
||||||
openDrawer();
|
openDrawer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeBranch === 'headOffice') {
|
||||||
|
formData.value.codeHeadOffice = code;
|
||||||
|
}
|
||||||
|
|
||||||
const currentRecord = branchData.value.result.find((x) => x.id === id);
|
const currentRecord = branchData.value.result.find((x) => x.id === id);
|
||||||
|
|
||||||
if (!currentRecord) return;
|
if (!currentRecord) return;
|
||||||
|
|
@ -287,6 +294,8 @@ async function triggerEdit(
|
||||||
(x) => x.id === currentRecord.headOfficeId,
|
(x) => x.id === currentRecord.headOfficeId,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
formData.value.codeHeadOffice = currentRecordHead?.code;
|
||||||
|
|
||||||
if (currentRecordHead) {
|
if (currentRecordHead) {
|
||||||
currentHq.value.id = currentRecordHead.id;
|
currentHq.value.id = currentRecordHead.id;
|
||||||
currentHq.value.code = currentRecordHead.code;
|
currentHq.value.code = currentRecordHead.code;
|
||||||
|
|
@ -294,6 +303,7 @@ async function triggerEdit(
|
||||||
currentHq.value = currentEdit.value;
|
currentHq.value = currentEdit.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
formTypeBranch.value = typeBranch;
|
formTypeBranch.value = typeBranch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -320,6 +330,8 @@ function triggerDelete(id: string) {
|
||||||
|
|
||||||
async function onSubmit() {
|
async function onSubmit() {
|
||||||
if (formType.value === 'edit') {
|
if (formType.value === 'edit') {
|
||||||
|
delete formData.value['codeHeadOffice'];
|
||||||
|
|
||||||
await branchStore.editById(
|
await branchStore.editById(
|
||||||
currentEdit.value.id,
|
currentEdit.value.id,
|
||||||
{
|
{
|
||||||
|
|
@ -556,7 +568,12 @@ watch(locale, () => {
|
||||||
:id="`view-detail-btn-${node.name}-view`"
|
:id="`view-detail-btn-${node.name}-view`"
|
||||||
@click.stop="
|
@click.stop="
|
||||||
if (node.isHeadOffice) {
|
if (node.isHeadOffice) {
|
||||||
triggerEdit('drawer', node.id, 'headOffice');
|
triggerEdit(
|
||||||
|
'drawer',
|
||||||
|
node.id,
|
||||||
|
'headOffice',
|
||||||
|
node.code,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
triggerEdit('drawer', node.id, 'subBranch');
|
triggerEdit('drawer', node.id, 'subBranch');
|
||||||
}
|
}
|
||||||
|
|
@ -576,6 +593,7 @@ watch(locale, () => {
|
||||||
{{ $t('viewDetail') }}
|
{{ $t('viewDetail') }}
|
||||||
</span>
|
</span>
|
||||||
</q-item>
|
</q-item>
|
||||||
|
|
||||||
<q-item
|
<q-item
|
||||||
:id="`view-detail-btn-${node.name}-edit`"
|
:id="`view-detail-btn-${node.name}-edit`"
|
||||||
clickable
|
clickable
|
||||||
|
|
@ -585,7 +603,12 @@ watch(locale, () => {
|
||||||
@click="
|
@click="
|
||||||
() => {
|
() => {
|
||||||
if (node.isHeadOffice) {
|
if (node.isHeadOffice) {
|
||||||
triggerEdit('form', node.id, 'headOffice');
|
triggerEdit(
|
||||||
|
'form',
|
||||||
|
node.id,
|
||||||
|
'headOffice',
|
||||||
|
node.code,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
triggerEdit('form', node.id, 'subBranch');
|
triggerEdit('form', node.id, 'subBranch');
|
||||||
}
|
}
|
||||||
|
|
@ -851,12 +874,14 @@ watch(locale, () => {
|
||||||
:badge-field="['branchLabelStatus']"
|
:badge-field="['branchLabelStatus']"
|
||||||
:inactive="item.status === 'INACTIVE'"
|
:inactive="item.status === 'INACTIVE'"
|
||||||
@view-detail="
|
@view-detail="
|
||||||
(v) =>
|
(v) => {
|
||||||
triggerEdit(
|
triggerEdit(
|
||||||
'drawer',
|
'drawer',
|
||||||
v.id,
|
v.id,
|
||||||
v.isHeadOffice ? 'headOffice' : 'subBranch',
|
v.isHeadOffice ? 'headOffice' : 'subBranch',
|
||||||
)
|
v.code,
|
||||||
|
);
|
||||||
|
}
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -986,7 +1011,7 @@ watch(locale, () => {
|
||||||
>
|
>
|
||||||
<template #information>
|
<template #information>
|
||||||
<FormBranchInformation
|
<FormBranchInformation
|
||||||
v-model:code="currentHq.code"
|
v-model:code="formData.codeHeadOffice"
|
||||||
v-model:code-sub-branch="currentEdit.code"
|
v-model:code-sub-branch="currentEdit.code"
|
||||||
v-model:taxNo="formData.taxNo"
|
v-model:taxNo="formData.taxNo"
|
||||||
v-model:name="formData.name"
|
v-model:name="formData.name"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue