fix: uploand error
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 7s

This commit is contained in:
Thanaphon Frappet 2025-07-04 15:15:06 +07:00
parent 011c65dcf8
commit dd09a8cb23
8 changed files with 51 additions and 39 deletions

View file

@ -188,6 +188,7 @@ function formatCode(input: string | undefined, type: 'code' | 'number') {
:label="$t('customer.form.citizenId')"
for="input-citizen-id"
v-model="citizenId"
:rules="[(val: string) => !!val || $t('form.error.required')]"
/>
<DatePicker
@ -221,6 +222,7 @@ function formatCode(input: string | undefined, type: 'code' | 'number') {
:label="$t('customer.form.religion')"
for="input-religion"
v-model="religion"
:rules="[(val: string) => !!val || $t('form.error.required')]"
/>
<q-select
outlined
@ -305,6 +307,7 @@ function formatCode(input: string | undefined, type: 'code' | 'number') {
:label="$t('customer.form.firstName')"
for="input-first-name"
v-model="firstName"
:rules="[(val: string) => !!val || $t('form.error.required')]"
/>
<q-input
@ -316,6 +319,7 @@ function formatCode(input: string | undefined, type: 'code' | 'number') {
:label="$t('customer.form.lastName')"
for="input-last-name"
v-model="lastName"
:rules="[(val: string) => !!val || $t('form.error.required')]"
/>
<q-input

View file

@ -123,7 +123,7 @@ async function change(e: Event) {
...obj.value,
{
_meta: structuredClone(toRaw(selectedMenu.value)._meta || {}),
group: selectedMenu.value?.value,
group: selectedMenu.value?.group,
file: renamedFile,
},
];
@ -327,7 +327,7 @@ defineEmits<{
:rows="
obj
.filter((v) => {
if (!autoSave && v.group !== selectedMenu?.value) {
if (!autoSave && v.group !== selectedMenu?.group) {
return false;
}
return true;

View file

@ -2287,7 +2287,6 @@ const emptyCreateDialog = ref(false);
res = await customerStore.createBranch({
...customerFormData.customerBranch[idx],
customerId: customerFormState.editCustomerId || '',
id: undefined,
});
}
if (res) {
@ -2315,10 +2314,10 @@ const emptyCreateDialog = ref(false);
if (ext) filename += `.${ext}`;
const res = await customerStore.putAttachment({
branchId:
parentId:
customerFormData.customerBranch?.[idx].id || '',
file: v.file,
filename,
name: filename,
});
if (res) {
@ -3108,7 +3107,7 @@ const emptyCreateDialog = ref(false);
file: File | undefined,
) => {
let status: boolean = false;
if (group !== 'attachment') {
if (group === 'passport' || group === 'visa') {
if (file !== undefined && currentFromDataEmployee.id) {
const res = await employeeStore.postMeta({
parentId: currentFromDataEmployee.id || '',
@ -5171,7 +5170,7 @@ const emptyCreateDialog = ref(false);
file: File | undefined,
) => {
let status: boolean = false;
if (group !== 'attachment') {
if (group === 'passport' || group === 'visa') {
if (file !== undefined && currentFromDataEmployee.id) {
const res = await employeeStore.postMeta({
parentId: currentFromDataEmployee.id || '',

View file

@ -220,7 +220,6 @@ withDefaults(
hide-action
:ocr="
async (group, file) => {
console.log(group);
if (group !== 'attachment') {
const res = await ocrStore.sendOcr({
file: file,
@ -245,12 +244,20 @@ withDefaults(
:auto-save="item.id !== ''"
:download="
(obj) => {
customerStore.getFile({
parentId: item.id || '',
group: obj.group,
fileId: obj._meta.id,
download: true,
});
if (obj.group === 'citizen') {
customerStore.getFile({
parentId: item.id || '',
group: obj.group,
fileId: obj._meta.id,
download: true,
});
} else {
customerStore.getAttachment({
parentId: item.id || '',
name: obj._meta.id,
download: true,
});
}
}
"
:delete-item="
@ -279,7 +286,7 @@ withDefaults(
_meta: any,
file: File | undefined,
) => {
if (group !== 'attachment') {
if (group === 'citizen') {
if (file !== undefined && item.id) {
const res = await customerStore.postMeta({
parentId: item.id || '',
@ -347,7 +354,6 @@ withDefaults(
});
const tempValue = resMeta.map(async (v: any) => {
console.log(v.expireDate);
return {
_meta: { ...v },
name: `${group}-${dateFormat(v.expireDate)}`,
@ -368,7 +374,6 @@ withDefaults(
});
const tempValue = (res as string[]).map(async (i: any) => {
console.log(i);
return {
_meta: { id: i, name: i },
name: i || '',

View file

@ -69,19 +69,19 @@ export const uploadFileListCustomer: {
}[] = [
{
label: 'customer.typeFile.citizenId',
value: 'citizen',
group: 'citizen',
value: 'citizen',
},
{
label: 'customer.typeFile.registrationBook',
value: 'attachment',
group: 'houseRegistration',
value: 'attachment',
},
{
label: 'customer.typeFile.houseMap',
value: 'attachment',
group: 'vatRegistration',
value: 'attachment',
},
{
@ -92,7 +92,7 @@ export const uploadFileListCustomer: {
{
label: 'customer.typeFile.dbdCertificate',
group: 'powerOfAttorney',
group: 'dbdCertificate',
value: 'attachment',
},
@ -144,43 +144,43 @@ export const uploadFileListEmployee: {
},
{
label: 'customerEmployee.fileType.tm6',
value: 'attachment',
group: 'tm6',
value: 'attachment',
},
{
label: 'customerEmployee.fileType.workPermit',
value: 'attachment',
group: 'workPermit',
value: 'attachment',
},
{
label: 'customerEmployee.fileType.noticeJobEmployment',
value: 'attachment',
group: 'noticeJobEmployment',
value: 'attachment',
},
{
label: 'customerEmployee.fileType.noticeJobEntry',
value: 'attachment',
group: 'noticeJobEntry',
value: 'attachment',
},
{
label: 'customerEmployee.fileType.historyJob',
value: 'attachment',
group: 'historyJob',
value: 'attachment',
},
{
label: 'customerEmployee.fileType.acceptJob',
value: 'attachment',
group: 'acceptJob',
value: 'attachment',
},
{
label: 'customerEmployee.fileType.receipt',
value: 'attachment',
group: 'receipt',
value: 'attachment',
},
{
label: 'customerEmployee.fileType.other',
value: 'attachment',
group: 'other',
value: 'attachment',
},
];

View file

@ -1010,7 +1010,6 @@ watch(
"
/>
<!-- TODO: blind remark, urgent -->
{{ console.log(taskListGroup) }}
<RemarkExpansion
v-if="
view === TaskOrderStatus.Pending ||

View file

@ -79,7 +79,6 @@ const useCustomerStore = defineStore('api-customer', () => {
customerId?: string;
company?: boolean;
includeCustomer?: boolean;
activeRegisBranchOnly?: boolean;
registeredBranchId?: string;
status?: 'CREATED' | 'ACTIVE' | 'INACTIVE';
query?: string;
@ -281,18 +280,21 @@ const useCustomerStore = defineStore('api-customer', () => {
if (tempValue) {
tempValue.file?.forEach(async ({ group, _meta, file }) => {
if (file !== undefined) {
if (!file) return;
if (group === 'citizen') {
await metaManager.postMeta({
parentId: v.id,
group: group as
| 'citizen'
| 'house-registration'
| 'commercial-registration'
| 'vat-registration'
| 'power-of-attorney',
group: 'citizen',
meta: _meta,
file,
});
} else {
await attachmentManager.putAttachment({
parentId: v.id || '',
name: file.name,
file: file,
});
}
});
}

View file

@ -132,7 +132,10 @@ const useEmployeeStore = defineStore('api-employee', () => {
if (group === undefined) return;
if (group !== 'attachment' && _meta !== undefined) {
if (
(group === 'passport' || group === 'visa') &&
_meta !== undefined
) {
metaManager.postMeta({
parentId: res.data.id,
group: group as 'passport' | 'visa',