From 452bbbc9662b1a86517c233ba824b737a0692cb7 Mon Sep 17 00:00:00 2001 From: "Ray.Hao" <1490493387@qq.com> Date: Sat, 31 Jan 2026 16:23:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=AD=A6=E5=91=8A=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/codegen/index.vue | 24 ++++++++++++------------ src/views/system/notice/index.vue | 21 ++++++++++++--------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/src/views/codegen/index.vue b/src/views/codegen/index.vue index d398b3f2..d3084e1b 100644 --- a/src/views/codegen/index.vue +++ b/src/views/codegen/index.vue @@ -153,8 +153,8 @@ - 普通 - 封装(CURD) + 普通 + 封装(CURD) @@ -367,13 +367,13 @@
预览范围 - 全部 - 前端 - 后端 + 全部 + 前端 + 后端 类型 - + {{ t }} @@ -475,16 +475,16 @@ - 全部 - 仅前端 - 仅后端 + 全部 + 仅前端 + 仅后端 - 覆盖 - 跳过已存在 - 仅在变更时覆盖 + 覆盖 + 跳过已存在 + 仅在变更时覆盖 diff --git a/src/views/system/notice/index.vue b/src/views/system/notice/index.vue index fe01f5db..07926978 100644 --- a/src/views/system/notice/index.vue +++ b/src/views/system/notice/index.vue @@ -359,11 +359,12 @@ function handleOpenDialog(id?: string) { if (id) { dialog.title = "修改公告"; NoticeAPI.getFormData(id).then((data) => { - const normalized = { + Object.assign(formData, { ...data, - targetUsers: normalizeTargetUsers(data?.targetUsers), - }; - Object.assign(formData, normalized); + targetUsers: normalizeTargetUsers( + (data as NoticeForm & { targetUserIds?: unknown }).targetUserIds + ), + }); }); } else { Object.assign(formData, { level: "L", targetType: 1, targetUsers: [] }); @@ -392,12 +393,14 @@ function handleSubmit() { dataFormRef.value.validate((valid: any) => { if (valid) { loading.value = true; - if (formData.targetType !== 2) { - formData.targetUsers = []; - } + const payload = { + ...formData, + targetUserIds: formData.targetType === 2 ? (formData.targetUsers ?? []) : [], + } as NoticeForm & { targetUserIds: number[] }; + delete (payload as NoticeForm).targetUsers; const id = formData.id; if (id) { - NoticeAPI.update(id, formData) + NoticeAPI.update(id, payload) .then(() => { ElMessage.success("修改成功"); handleCloseDialog(); @@ -405,7 +408,7 @@ function handleSubmit() { }) .finally(() => (loading.value = false)); } else { - NoticeAPI.create(formData) + NoticeAPI.create(payload) .then(() => { ElMessage.success("新增成功"); handleCloseDialog();