From 4b5c5a3f6337b2df081f484530c2c9a2a6af0bf5 Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Mon, 23 Sep 2024 08:46:22 +0800 Subject: [PATCH] refactor: notice --- .../web-antd/src/views/system/notice/notice-modal.vue | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/web-antd/src/views/system/notice/notice-modal.vue b/apps/web-antd/src/views/system/notice/notice-modal.vue index 1db4e7ca..b08d0c32 100644 --- a/apps/web-antd/src/views/system/notice/notice-modal.vue +++ b/apps/web-antd/src/views/system/notice/notice-modal.vue @@ -5,7 +5,7 @@ import { useVbenModal } from '@vben/common-ui'; import { $t } from '@vben/locales'; import { useVbenForm } from '#/adapter'; -import { noticeAdd, noticeUpdate } from '#/api/system/notice'; +import { noticeAdd, noticeInfo, noticeUpdate } from '#/api/system/notice'; import { Tinymce } from '#/components/tinymce'; import { modalSchema } from './data'; @@ -14,7 +14,7 @@ const emit = defineEmits<{ reload: [] }>(); interface ModalProps { update: boolean; - record?: any; + id?: number | string; } const isUpdate = ref(false); @@ -38,11 +38,12 @@ const [BasicModal, modalApi] = useVbenModal({ return null; } modalApi.modalLoading(true); - const { record, update } = modalApi.getData() as ModalProps; + const { id, update } = modalApi.getData() as ModalProps; isUpdate.value = update; - if (update && record) { + if (update && id) { + const record = await noticeInfo(id); for (const key in record) { - await formApi.setFieldValue(key, record[key]); + await formApi.setFieldValue(key, record[key as keyof typeof record]); } } modalApi.modalLoading(false);