change type in PhotoScroller

This commit is contained in:
Timi
2026-08-24 17:53:21 +08:00
parent 9b843fc921
commit f42e865430
9 changed files with 316 additions and 35 deletions
+10 -3
View File
@@ -53,7 +53,8 @@
<photo-scroller
title="客户照片列表"
v-model="customerPhotoList"
:photo-items="customerPhotoItemList"
v-model:photo-items="customerPhotoItemList"
:edit-mode="true"
:add-actions="customerPhotoAddActions"
:loading="customerPhotoUploading"
@add-photo="openCustomerPhotoPicker('PHOTO')"
@@ -109,6 +110,8 @@
<photo-scroller
title="登记事件照片"
v-model="recordPhotoList"
v-model:photo-items="recordPhotoItemList"
:edit-mode="true"
:loading="recordPhotoUploading"
@add="openRecordPhotoPicker"
/>
@@ -254,6 +257,7 @@ let latestDecodedText = "";
const inputCode = computed(() => currentCode.value || scanCode.value || "");
type QuickPhoto = {
attachType?: string;
tempFileId: string;
url: string;
};
@@ -671,7 +675,7 @@ async function saveRecord(): Promise<void> {
if (Toolkit.isNotEmpty(customer.eventRecordList)) {
customer.eventRecordList![0].attachmentList = recordPhotoItemList.value.map(item => ({
tempFileId: item.tempFileId,
attachType: "PHOTO"
attachType: item.attachType || "PHOTO"
}));
}
await EventRecordAPI.createWithCustomer(customer);
@@ -712,7 +716,10 @@ function resetFormAfterSubmit(): void {
function buildCustomerAttachmentList(): Attachment[] {
return customerPhotoItemList.value.flatMap(item => {
if (item.attachment) {
return [item.attachment];
return [{
...item.attachment,
attachType: item.attachType || item.attachment.attachType || "PHOTO"
}];
}
if (item.tempFileId) {
return [{