feat: enhance employee form to support image uploads and track image edits
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 7s
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 7s
This commit is contained in:
parent
34f5b6474b
commit
b9f1d04105
2 changed files with 11 additions and 3 deletions
|
|
@ -664,6 +664,14 @@ watch(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => currentFromDataEmployee.value.image,
|
||||||
|
() => {
|
||||||
|
if (currentFromDataEmployee.value.image !== null)
|
||||||
|
employeeFormState.value.isImageEdit = true;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
const emptyCreateDialog = ref(false);
|
const emptyCreateDialog = ref(false);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -810,7 +810,7 @@ export const useEmployeeForm = defineStore('form-employee', () => {
|
||||||
ocr: false,
|
ocr: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const defaultFormData: EmployeeCreate = {
|
const defaultFormData: EmployeeCreate & { image?: File } = {
|
||||||
id: '',
|
id: '',
|
||||||
code: '',
|
code: '',
|
||||||
customerBranchId: '',
|
customerBranchId: '',
|
||||||
|
|
@ -937,7 +937,7 @@ export const useEmployeeForm = defineStore('form-employee', () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
let resetEmployeeData = structuredClone(defaultFormData);
|
let resetEmployeeData = structuredClone(defaultFormData);
|
||||||
const currentFromDataEmployee = ref<EmployeeCreate>(
|
const currentFromDataEmployee = ref<EmployeeCreate & { image?: File }>(
|
||||||
structuredClone(defaultFormData),
|
structuredClone(defaultFormData),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1250,7 +1250,7 @@ export const useEmployeeForm = defineStore('form-employee', () => {
|
||||||
await assignFormDataEmployee(currentFromDataEmployee.value.id);
|
await assignFormDataEmployee(currentFromDataEmployee.value.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function submitPersonal(imgList: {
|
async function submitPersonal(imgList?: {
|
||||||
selectedImage: string;
|
selectedImage: string;
|
||||||
list: { url: string; imgFile: File | null; name: string }[];
|
list: { url: string; imgFile: File | null; name: string }[];
|
||||||
}) {
|
}) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue