refactor: by data

This commit is contained in:
Net 2024-08-27 16:19:59 +07:00 committed by Methapon Metanipat
parent feea208480
commit 87cd106c43

View file

@ -54,7 +54,8 @@ import {
columnsCustomer, columnsCustomer,
columnsEmployee, columnsEmployee,
formMenuIconEmployee, formMenuIconEmployee,
uploadFileList, uploadFileListEmployee,
uploadFileListCustomer,
} from './constant'; } from './constant';
import { useCustomerForm, useEmployeeForm } from './form'; import { useCustomerForm, useEmployeeForm } from './form';
import { storeToRefs } from 'pinia'; import { storeToRefs } from 'pinia';
@ -2466,8 +2467,8 @@ const emptyCreateDialog = ref(false);
" "
:show=" :show="
async () => { async () => {
await fetchListOfOptionBranch(); // await fetchListOfOptionBranch();
customerFormStore.resetForm(customerFormState.dialogType === 'create'); // customerFormStore.resetForm(true);
} }
" "
:before-close=" :before-close="
@ -2477,6 +2478,7 @@ const emptyCreateDialog = ref(false);
return false; return false;
} else { } else {
fetchListCustomer(); fetchListCustomer();
customerFormStore.resetForm(true);
customerFormState.branchIndex = -1; customerFormState.branchIndex = -1;
} }
return false; return false;
@ -2680,6 +2682,23 @@ const emptyCreateDialog = ref(false);
); );
} }
customerFormData.customerBranch[idx].file?.forEach(
(v) => {
if (!v.file) return;
const ext = v.file.name.split('.').at(-1);
let filename = v.group + '-' + new Date().getTime();
if (ext) filename += `.${ext}`;
customerStore.putAttachment({
branchId:
customerFormData.customerBranch?.[idx].id || '',
file: v.file,
filename,
});
},
);
await customerFormStore.assignFormData( await customerFormStore.assignFormData(
customerFormState.editCustomerId, customerFormState.editCustomerId,
); );
@ -2694,6 +2713,7 @@ const emptyCreateDialog = ref(false);
v-model:customer-branch=" v-model:customer-branch="
customerFormData.customerBranch[idx] customerFormData.customerBranch[idx]
" "
:tree-file="customerFormState.treeFile"
:customer-type="customerFormData.customerType" :customer-type="customerFormData.customerType"
:customer-name="`${customerFormData.firstName} ${customerFormData.lastName}`" :customer-name="`${customerFormData.firstName} ${customerFormData.lastName}`"
:action-disabled=" :action-disabled="
@ -3080,11 +3100,11 @@ const emptyCreateDialog = ref(false);
/> />
<UploadFile <UploadFile
:tree="[]" :treeFile="[]"
:dropdown-list="uploadFileList" :dropdown-list="uploadFileListEmployee"
@send-ocr=" @send-ocr="
async (v: any, f: any) => { async (v: any, f: any) => {
console.log(v, f);
await ocrStore.sendOcr({ file: f }); await ocrStore.sendOcr({ file: f });
} }