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,
columnsEmployee,
formMenuIconEmployee,
uploadFileList,
uploadFileListEmployee,
uploadFileListCustomer,
} from './constant';
import { useCustomerForm, useEmployeeForm } from './form';
import { storeToRefs } from 'pinia';
@ -2466,8 +2467,8 @@ const emptyCreateDialog = ref(false);
"
:show="
async () => {
await fetchListOfOptionBranch();
customerFormStore.resetForm(customerFormState.dialogType === 'create');
// await fetchListOfOptionBranch();
// customerFormStore.resetForm(true);
}
"
:before-close="
@ -2477,6 +2478,7 @@ const emptyCreateDialog = ref(false);
return false;
} else {
fetchListCustomer();
customerFormStore.resetForm(true);
customerFormState.branchIndex = -1;
}
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(
customerFormState.editCustomerId,
);
@ -2694,6 +2713,7 @@ const emptyCreateDialog = ref(false);
v-model:customer-branch="
customerFormData.customerBranch[idx]
"
:tree-file="customerFormState.treeFile"
:customer-type="customerFormData.customerType"
:customer-name="`${customerFormData.firstName} ${customerFormData.lastName}`"
:action-disabled="
@ -3080,11 +3100,11 @@ const emptyCreateDialog = ref(false);
/>
<UploadFile
:tree="[]"
:dropdown-list="uploadFileList"
:treeFile="[]"
:dropdown-list="uploadFileListEmployee"
@send-ocr="
async (v: any, f: any) => {
console.log(v, f);
await ocrStore.sendOcr({ file: f });
}