update registration event editor

This commit is contained in:
Timi
2026-08-02 00:20:13 +08:00
parent 11c48bf00c
commit 35dff786b1
10 changed files with 376 additions and 215 deletions
+30 -16
View File
@@ -52,6 +52,7 @@
<photo-field
v-model="supplementPhoto"
alt-text="客户照片"
:loading="supplementPhotoUploading"
:preview="false"
@add="selectSupplementPhoto"
@clear="clearSupplementPhoto"
@@ -76,6 +77,7 @@
<photo-scroller
title="登记事件照片"
v-model="photoList"
:loading="recordPhotoUploading"
@add="selectRecordPhoto"
/>
</div>
@@ -133,6 +135,8 @@ const supplementPhotoTempFileId = ref("");
const supplementPhotoInputRef = ref<HTMLInputElement>();
const recordPhotoInputRef = ref<HTMLInputElement>();
const recordPhotoTempFileIdList = ref<string[]>([]);
const supplementPhotoUploading = ref(false);
const recordPhotoUploading = ref(false);
const registrationEventList = ref<RegistrationEvent[]>([]);
const selectedRegistrationEventIdList = ref<string[]>([]);
const note = ref("");
@@ -375,15 +379,20 @@ async function handleSupplementPhotoSelected(event: Event): Promise<void> {
if (!file) {
return;
}
const compressedFile = await compressUploadImage(file);
const [tempFile] = await AttachmentAPI.uploadTemp(compressedFile);
if (!tempFile?.id) {
showToast("客户照片上传失败", "warning");
return;
supplementPhotoUploading.value = true;
try {
const compressedFile = await compressUploadImage(file);
const [tempFile] = await AttachmentAPI.uploadTemp(compressedFile);
if (!tempFile?.id) {
showToast("客户照片上传失败", "warning");
return;
}
supplementPhotoTempFileId.value = tempFile.id;
supplementPhoto.value = AttachmentAPI.getTempReadURL(tempFile.id);
} finally {
supplementPhotoUploading.value = false;
input.value = "";
}
supplementPhotoTempFileId.value = tempFile.id;
supplementPhoto.value = AttachmentAPI.getTempReadURL(tempFile.id);
input.value = "";
}
function selectRecordPhoto(): void {
@@ -396,16 +405,21 @@ async function handleRecordPhotoSelected(event: Event): Promise<void> {
if (!fileList.length) {
return;
}
const compressedFileList = await compressUploadImageList(fileList);
const tempFileList = await AttachmentAPI.uploadTemp(compressedFileList);
for (const item of tempFileList) {
if (!item.id) {
continue;
recordPhotoUploading.value = true;
try {
const compressedFileList = await compressUploadImageList(fileList);
const tempFileList = await AttachmentAPI.uploadTemp(compressedFileList);
for (const item of tempFileList) {
if (!item.id) {
continue;
}
recordPhotoTempFileIdList.value.push(item.id);
photoList.value.push(AttachmentAPI.getTempReadURL(item.id));
}
recordPhotoTempFileIdList.value.push(item.id);
photoList.value.push(AttachmentAPI.getTempReadURL(item.id));
} finally {
recordPhotoUploading.value = false;
input.value = "";
}
input.value = "";
}
// ---------- 提交 ----------