From 8695c90110bb6876b64fab546eb73263bd813335 Mon Sep 17 00:00:00 2001 From: Net Date: Wed, 25 Sep 2024 10:57:57 +0700 Subject: [PATCH] refactor: add remark --- src/pages/01_branch-management/MainPage.vue | 48 ++++++++++++--------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/src/pages/01_branch-management/MainPage.vue b/src/pages/01_branch-management/MainPage.vue index 21fa061f..04257224 100644 --- a/src/pages/01_branch-management/MainPage.vue +++ b/src/pages/01_branch-management/MainPage.vue @@ -40,6 +40,7 @@ import FormBank from 'components/01_branch-management/FormBank.vue'; import ToggleButton from 'src/components/button/ToggleButton.vue'; import FormBranchAdmin from 'src/components/01_branch-management/FormBranchAdmin.vue'; import KebabAction from 'src/components/shared/KebabAction.vue'; +import RemarkComponent from 'src/components/RemarkComponent.vue'; import { User } from 'src/stores/user/types'; import { EditButton, @@ -158,7 +159,6 @@ const currentAttachmentList = ref< file?: File; }[] >([]); -const currentAttachmentSelected = ref(''); const statusQrCodeFile = ref(undefined); const statusQrCodeUrl = ref(''); @@ -203,19 +203,6 @@ const treeData = computed(() => { map[v.id] = { ...v, name, branch: v.branch || [] }; }); - // branchData.value?.result.forEach((v) => { - // const name = locale.value === 'eng' ? v.nameEN : v.name; - // if (v.isHeadOffice) map[v.id] = { ...v, name, branch: [] }; - // else children.push({ ...v, name }); - // }); - - // children.forEach((v) => { - // const name = locale.value === 'eng' ? v.nameEN : v.name; - // if (v.headOfficeId && map[v.headOfficeId]) { - // map[v.headOfficeId].branch.push({ ...v, name }); - // } - // }); - return Object.values(map); }); @@ -332,6 +319,7 @@ const splitterModel = ref(25); const defaultFormData = { headOfficeId: null, + remark: '', code: '', taxNo: '', nameEN: '', @@ -459,6 +447,7 @@ async function fetchBranchById(id: string) { } formData.value = { + remark: res.remark, code: res.code, headOfficeId: res.headOfficeId, taxNo: res.taxNo, @@ -1512,7 +1501,7 @@ watch(currentHq, () => { 'subBranch', ); } - await drawerEdit(); + drawerEdit(); formType = 'edit'; } " @@ -1642,7 +1631,7 @@ watch(currentHq, () => { 'subBranch', ); } - await drawerEdit(); + drawerEdit(); formType = 'edit'; } " @@ -1704,7 +1693,7 @@ watch(currentHq, () => { :toggleTitle="$t('status.title')" :caption=" formTypeBranch === 'headOffice' - ? `${formData.code}00000` + ? `${formData.code}` : `${formData.code?.slice(0, -5)}${(formLastSubBranch + 1).toString().padStart(5, '0')}` " v-model:toggle-status="formData.status" @@ -1954,6 +1943,7 @@ watch(currentHq, () => { } " /> + { if (file) { attachmentList.push(file); - await branchStore.putAttachment(currentId, attachmentList); + attachmentList.forEach(async (v) => { + await branchStore.putAttachment(currentId, v); + }); } } " @@ -1993,6 +1985,12 @@ watch(currentHq, () => { } " /> + + @@ -2311,7 +2309,10 @@ watch(currentHq, () => { async (_group, file) => { if (file) { attachmentList.push(file); - await branchStore.putAttachment(currentId, attachmentList); + + attachmentList.forEach(async (v) => { + await branchStore.putAttachment(currentId, v); + }); } } " @@ -2335,6 +2336,13 @@ watch(currentHq, () => { } " /> + + @@ -2480,7 +2488,7 @@ watch(currentHq, () => { v-model:file="statusQrCodeFile as File" v-model:image-url="statusQrCodeUrl" @save=" - (_file, imageUrl) => { + (_file) => { qrCodeDialog = false; if (currentIndexQrCodeBank === -1) { triggerEditQrCodeLine({ save: true });