From fe2d6627b8f1002af7a31b08f6f43bec034d04ee Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期三, 21 十月 2026 18:29:07 +0800
Subject: [PATCH] feat: 完善课题、会员、财务、企微页面并新增资产/用车/采购

---
 src/components/upload/image-upload.vue |   28 ++++++++++++++++++++--------
 1 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/src/components/upload/image-upload.vue b/src/components/upload/image-upload.vue
index ab5fa85..500311d 100644
--- a/src/components/upload/image-upload.vue
+++ b/src/components/upload/image-upload.vue
@@ -8,15 +8,15 @@
 
 import { computed, ref, toRefs, watch } from 'vue';
 
-import { IconifyIcon } from '../../packages/icons/src';
-import { $t } from '../../packages/locales/src';
+import { IconifyIcon } from '@vben/icons';
+import { $t } from '@vben/locales';
 import {
   defaultImageAccepts,
   isFunction,
   isImage,
   isObject,
   isString,
-} from '../../packages/utils/src';
+} from '@vben/utils';
 
 import { message, Modal, Upload } from 'ant-design-vue';
 
@@ -32,7 +32,7 @@
   disabled: false,
   listType: 'picture-card',
   helpText: '',
-  maxSize: 2,
+  maxSize: 50,
   maxNumber: 1,
   accept: () => defaultImageAccepts,
   multiple: false,
@@ -104,6 +104,10 @@
           return null;
         })
         .filter(Boolean) as UploadProps['fileList'];
+    } else {
+      // v 涓虹┖锛坣ull/undefined锛夋椂蹇呴』娓呯┖鍒楄〃锛氬惁鍒欏垏鎹㈣褰曟椂锛堜緥濡傜紪杈戣繃甯﹀皝闈㈢殑娲诲姩
+      // 鍐嶇偣鏂板缓銆佹垨璇︽儏鏃嬭浆鍒板彟涓�鏉★級浼氭畫鐣欎笂涓�鏉$殑鍥剧墖锛岀湅璧锋潵鏄�屽浘杩樺湪浣嗘崲涓嶄簡銆�
+      fileList.value = [];
     }
     if (!isFirstRender.value) {
       emit('change', value);
@@ -169,8 +173,11 @@
  * @returns 鏄惁鍏佽涓婁紶
  */
 async function beforeUpload(file: File) {
-  // 妫�鏌ユ枃浠舵暟閲忛檺鍒�
-  if (fileList.value!.length >= props.maxNumber) {
+  // 妫�鏌ユ枃浠舵暟閲忛檺鍒躲��
+  // maxNumber=1 鏃惰繖閲屽繀椤绘斁琛岋紝鍚﹀垯銆岀紪杈戙�嶇被鍦烘櫙锛堣繘琛ㄥ崟鏃跺凡鏈� 1 寮犲洖鏄惧浘锛�
+  // 浼氭案杩滄崲涓嶄簡鍥撅細antd 鐨� onInternalChange 鍦� maxCount===1 涓嬩細 slice(-1) 鍙暀鏈�鏂颁竴寮狅紝
+  // 鏂板浘澶╃劧瑕嗙洊鏃у浘锛屼笉闇�瑕佸湪 beforeUpload 閲屾嫤銆�
+  if (fileList.value!.length >= props.maxNumber && props.maxNumber !== 1) {
     message.error($t('ui.upload.maxNumber', [props.maxNumber]));
     return Upload.LIST_IGNORE;
   }
@@ -239,8 +246,10 @@
   // 娣诲姞鍒颁复鏃朵笂浼犲垪琛�
   const fileUrl = res?.url || res?.data || res;
   uploadList.value.push({
-    name: file.name,
+    name: res?.name || file.name,
     url: fileUrl,
+    id: res?.id,
+    response: res,
     status: UploadResultStatus.DONE,
     uid: file.name + Date.now(),
   });
@@ -320,8 +329,11 @@
       @preview="handlePreview"
       @remove="handleRemove"
     >
+      <!-- maxNumber=1 鏃跺嵆浣垮凡鏈変竴寮犱篃瑕佷繚鐣欎笂浼犲叆鍙o紙鐢ㄤ簬銆屾崲涓�寮犮�嶏級锛�
+           鎻掓Ы涓�鏃︿负绌猴紝antd 浼氱敤 appendActionVisible=false 鎶婃暣涓笂浼犳寜閽� v-show 鎺夛紝
+           缂栬緫鍦烘櫙涓嬪氨褰诲簳娌℃湁鍙偣鐨勪笂浼犲叆鍙d簡 -->
       <div
-        v-if="fileList && fileList.length < maxNumber"
+        v-if="fileList && (fileList.length < maxNumber || maxNumber === 1)"
         class="flex flex-col items-center justify-center"
       >
         <IconifyIcon icon="lucide:cloud-upload" />

--
Gitblit v1.9.3