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();