From 8f114ae7618f7a105c9f64e99c3819d3935ddc26 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 10 八月 2026 15:41:33 +0800
Subject: [PATCH] 银川 1.新增开票管理页面 2.联调回款管理和回款计划页面 3.新增设备类型的子级时,没有展示出来 4.部署不同公司时配置公司api逻辑添加
---
src/components/upload/file-upload.vue | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/src/components/upload/file-upload.vue b/src/components/upload/file-upload.vue
index 35c7fe6..6296579 100644
--- a/src/components/upload/file-upload.vue
+++ b/src/components/upload/file-upload.vue
@@ -84,23 +84,29 @@
} else {
value.push(v);
}
+ const existingMap = new Map<string | number, UploadFile>();
+ for (const f of fileList.value ?? []) {
+ const id = (f as any)?.response?.[props.valueKey] ?? (f as any)?.[props.valueKey] ?? f?.uid;
+ if (id != null) existingMap.set(id, f);
+ }
fileList.value = value
.map((item, i) => {
if (item && isString(item)) {
- return {
+ return existingMap.get(item) ?? {
uid: `${-i}`,
name: item.slice(Math.max(0, item.lastIndexOf('/') + 1)),
status: UploadResultStatus.DONE,
url: item,
};
} else if (item && isObject(item)) {
- return item;
+ const key = item[props.valueKey] ?? item.uid;
+ return (key != null && existingMap.get(key)) || { ...item, url: String((item as any).url ?? '') };
} else if (item && (typeof item === 'number' || typeof item === 'string')) {
- return {
+ return existingMap.get(item) ?? {
uid: `${-i}`,
name: `鏂囦欢 ${String(item)}`,
status: UploadResultStatus.DONE,
- url: item,
+ url: String(item),
response: { [props.valueKey]: item },
} as UploadFile;
}
@@ -135,6 +141,12 @@
/** 澶勭悊鏂囦欢棰勮 */
function handlePreview(file: UploadFile) {
+ const url = (file as any)?.url || (file as any)?.response?.url || (file as any)?.response;
+ if (!url) {
+ message.warning('鏂囦欢鍦板潃涓嶅瓨鍦紝鏃犳硶棰勮');
+ return;
+ }
+ window.open(url, '_blank');
emit('preview', file);
}
@@ -207,7 +219,7 @@
fileList.value?.splice(index!, 1);
}
- const fileUrl = res?.url || res?.data || res;
+ const fileUrl = res?.url || res?.data || (typeof res === 'string' ? res : '');
uploadList.value.push({
name: res?.name || file.name,
url: fileUrl,
--
Gitblit v1.9.3