From dce5b66f794e5a85e387ec8fb2b5db7d8f6fc37d Mon Sep 17 00:00:00 2001 From: Net <93821485+somnetsak123@users.noreply.github.com> Date: Fri, 28 Jun 2024 11:14:58 +0700 Subject: [PATCH] =?UTF-8?q?fix:=20=E0=B8=AA=E0=B8=B2=E0=B8=82=E0=B8=B2=20?= =?UTF-8?q?=20code=20=E0=B9=84=E0=B8=A1=E0=B9=88=E0=B8=A1=E0=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/01_branch-management/MainPage.vue | 26 ++++++++++++++------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/pages/01_branch-management/MainPage.vue b/src/pages/01_branch-management/MainPage.vue index dd8d8197..0eb893f9 100644 --- a/src/pages/01_branch-management/MainPage.vue +++ b/src/pages/01_branch-management/MainPage.vue @@ -162,13 +162,13 @@ const formType = ref<'create' | 'edit' | 'delete' | 'view'>('create'); const formTypeBranch = ref<'headOffice' | 'subBranch'>('headOffice'); const currentHq = ref<{ id: string; code: string }>({ id: '', code: '' }); const currentEdit = ref<{ id: string; code: string }>({ id: '', code: '' }); -const formData = ref>( - structuredClone(defaultFormData), -); +const formData = ref< + Omit +>(structuredClone(defaultFormData)); -const prevFormData = ref>( - structuredClone(defaultFormData), -); +const prevFormData = ref< + Omit +>(structuredClone(defaultFormData)); const modalDrawer = ref(false); @@ -242,6 +242,11 @@ function triggerCreate( }; } + if (type === 'subBranch' && id && code) { + formData.value.headOfficeId = id; + formData.value.codeHeadOffice = code; + } + formType.value = 'create'; openDialog(); } @@ -333,6 +338,7 @@ async function onSubmit() { if (formType.value === 'create') { if (formTypeBranch.value === 'subBranch') { formData.value.headOfficeId = currentHq.value.id; + delete formData.value['codeHeadOffice']; } await branchStore.create({ @@ -493,7 +499,11 @@ watch(locale, () => { if (!currentHq.id) { triggerCreate('headOffice'); } else { - triggerCreate('subBranch'); + triggerCreate( + 'subBranch', + currentHq.id, + currentHq.code, + ); } } " @@ -879,7 +889,7 @@ watch(locale, () => { >