refactor: img dialog => remove img function

This commit is contained in:
puriphatt 2024-09-12 16:41:09 +07:00
parent 42bb43f618
commit 7ab9f69ef8
6 changed files with 82 additions and 78 deletions

View file

@ -1817,66 +1817,66 @@ watch(currentHq, () => {
</template>
<template v-if="currentTab === 'attachment'">
<AddressForm
id="form-address"
dense
outlined
separator
prefix-id="default"
:title="'form.address'"
v-model:address="formData.address"
v-model:addressEN="formData.addressEN"
v-model:province-id="formData.provinceId"
v-model:district-id="formData.districtId"
v-model:sub-district-id="formData.subDistrictId"
v-model:zip-code="formData.zipCode"
/>
<FormLocation
id="form-location"
:readonly="formType === 'view'"
:separator="true"
v-model:latitude="formData.latitude"
v-model:longitude="formData.longitude"
outlined
dense
title="branch.form.group.location"
/>
<FormQr
id="form-qr"
title="QR Code"
:separator="true"
:qr="qrCodeimageUrl"
:readonly="formType === 'view'"
@view-qr="
() => {
triggerEditQrCodeLine();
}
"
@edit-qr="() => refQrCodeUpload && refQrCodeUpload.browse()"
/>
<FormBank
id="form-bank"
title="branch.form.group.bankAccount"
dense
v-model:bank-book-list="formBankBook"
@view-qr="
(i) => {
currentIndexQrCodeBank = i;
triggerEditQrCodeBank();
}
"
@edit-qr="
(i) => {
currentIndexQrCodeBank = i;
refQrCodeUpload && refQrCodeUpload.browse();
}
"
/>
<FormBranchAdmin
id="form-branch-admin-view"
:admin="currentBranchAdmin"
/>
<!-- <FormImage
<AddressForm
id="form-address"
dense
outlined
separator
prefix-id="default"
:title="'form.address'"
v-model:address="formData.address"
v-model:addressEN="formData.addressEN"
v-model:province-id="formData.provinceId"
v-model:district-id="formData.districtId"
v-model:sub-district-id="formData.subDistrictId"
v-model:zip-code="formData.zipCode"
/>
<FormLocation
id="form-location"
:readonly="formType === 'view'"
:separator="true"
v-model:latitude="formData.latitude"
v-model:longitude="formData.longitude"
outlined
dense
title="branch.form.group.location"
/>
<FormQr
id="form-qr"
title="QR Code"
:separator="true"
:qr="qrCodeimageUrl"
:readonly="formType === 'view'"
@view-qr="
() => {
triggerEditQrCodeLine();
}
"
@edit-qr="() => refQrCodeUpload && refQrCodeUpload.browse()"
/>
<FormBank
id="form-bank"
title="branch.form.group.bankAccount"
dense
v-model:bank-book-list="formBankBook"
@view-qr="
(i) => {
currentIndexQrCodeBank = i;
triggerEditQrCodeBank();
}
"
@edit-qr="
(i) => {
currentIndexQrCodeBank = i;
refQrCodeUpload && refQrCodeUpload.browse();
}
"
/>
<FormBranchAdmin
id="form-branch-admin-view"
:admin="currentBranchAdmin"
/>
<!-- <FormImage
:readonly="formType === 'view'"
v-model:image="imageUrl"
@upload="
@ -2355,7 +2355,7 @@ watch(currentHq, () => {
if (!currentId) return;
const name = v.split('/').pop() || '';
await branchStore.deleteImageByName(currentId, name);
await fetchImageList(currentId, name);
await fetchImageList(currentId, formData.selectedImage || '');
}
"
@submit="

View file

@ -1972,10 +1972,9 @@ watch(
async (v) => {
if (!v) return;
if (!currentUser) return;
const name = v.split('/').pop() || '';
await userStore.deleteImageByName(currentUser?.id, name);
await fetchImageList(currentUser?.id, name);
await fetchImageList(currentUser?.id, currentUser.selectedImage || '');
}
"
@submit="

View file

@ -2739,7 +2739,7 @@ const emptyCreateDialog = ref(false);
);
await fetchImageList(
customerFormState.editCustomerId,
name,
customerFormData.selectedImage || '',
'customer',
);
}
@ -2844,7 +2844,11 @@ const emptyCreateDialog = ref(false);
if (!currentFromDataEmployee.id) return;
const name = v.split('/').pop() || '';
await employeeStore.deleteImageByName(currentFromDataEmployee.id, name);
await fetchImageList(currentFromDataEmployee.id, name, 'employee');
await fetchImageList(
currentFromDataEmployee.id,
currentFromDataEmployee.selectedImage || '',
'employee',
);
}
"
@submit="

View file

@ -4280,15 +4280,15 @@ watch(
@add-image="
async (v) => {
if (!v) return;
if (!currentIdProduct) return;
if (!currentIdProduct && !currentIdService) return;
const res = await productServiceStore.addImageList(
v,
currentIdProduct,
dialogProductEdit ? currentIdProduct : currentIdService,
Date.now(),
dialogProductEdit ? 'product' : 'service',
);
await fetchImageList(
currentIdProduct,
dialogProductEdit ? currentIdProduct : currentIdService,
res,
dialogProductEdit ? 'product' : 'service',
);
@ -4308,7 +4308,9 @@ watch(
);
await fetchImageList(
dialogProductEdit ? currentIdProduct : currentIdService,
name,
dialogProductEdit
? formDataProduct.selectedImage || ''
: formDataProductService.selectedImage || '',
type,
);
}