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/views/wxcp/notice/modules/form.vue |   37 +++++++++++++++++++++++++++++++++++--
 1 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/src/views/wxcp/notice/modules/form.vue b/src/views/wxcp/notice/modules/form.vue
index cd835ac..cab9ba2 100644
--- a/src/views/wxcp/notice/modules/form.vue
+++ b/src/views/wxcp/notice/modules/form.vue
@@ -15,7 +15,7 @@
   updateNotice,
 } from '#/api/wxcp/notice';
 
-import { useNoticeFormSchema } from '../data';
+import { NOTICE_TYPE, useNoticeFormSchema } from '../data';
 
 defineOptions({ name: 'WxCpNoticeForm' });
 
@@ -59,12 +59,25 @@
       modalApi.lock();
       try {
         const detail = await getNotice(data.id);
-        await formApi.setValues(detail as unknown as Record<string, unknown>);
+        const values: Record<string, unknown> = { ...detail };
+        // 鏂囦欢閫氱煡锛氭妸 blobId 杩樺師鎴愪笂浼犵粍浠跺彲璇嗗埆鐨勬枃浠跺璞�
+        if (detail.noticeType === NOTICE_TYPE.FILE && detail.fileBlobId) {
+          values.fileBlobId = [
+            {
+              uid: String(detail.fileBlobId),
+              name: detail.fileName || '',
+              status: 'done',
+              id: detail.fileBlobId,
+            },
+          ];
+        }
+        await formApi.setValues(values);
       } finally {
         modalApi.unlock();
       }
     } else {
       await formApi.resetForm();
+      await formApi.setValues({ noticeType: NOTICE_TYPE.TEXT }, false);
     }
   },
 });
@@ -77,6 +90,26 @@
   submitting.value = true;
   try {
     const data = (await formApi.getValues()) as WxCpNoticeApi.Notice;
+    // 淇濆瓨鏃跺彧鍋氭枃浠跺綊涓�鍖栵紱鍏蜂綋妯℃澘蹇呭~椤瑰湪鎺ㄩ�佹椂鎸夋墍閫夋ā鏉挎牎楠�
+    const noticeType = data.noticeType ?? NOTICE_TYPE.TEXT;
+    if (noticeType === NOTICE_TYPE.FILE) {
+      const raw = data.fileBlobId as unknown;
+      let blobId: number | undefined;
+      if (Array.isArray(raw)) {
+        const first = raw[0];
+        blobId =
+          typeof first === 'number'
+            ? first
+            : (first as { id?: number } | undefined)?.id;
+      } else if (typeof raw === 'number') {
+        blobId = raw;
+      } else if (raw && typeof raw === 'object') {
+        blobId = (raw as { id?: number }).id;
+      }
+      data.fileBlobId = blobId;
+    } else {
+      data.fileBlobId = undefined;
+    }
     if (id.value) {
       await updateNotice({ ...data, id: id.value });
       message.success('淇敼鎴愬姛');

--
Gitblit v1.9.3