From e3660e0b20f4515e1c524b079cfc8f6937e288ef Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 15 Apr 2023 17:07:41 +0800 Subject: [PATCH] =?UTF-8?q?REVIEW=20=E7=AB=99=E5=86=85=E4=BF=A1=E6=A8=A1?= =?UTF-8?q?=E7=89=88=E7=9A=84=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/system/notify/template/index.ts | 23 ++-- .../notify/template/NotifyTemplateForm.vue | 13 +- .../template/NotifyTemplateSendForm.vue | 127 ++++++++++++++++++ src/views/system/notify/template/index.vue | 117 ++-------------- 4 files changed, 152 insertions(+), 128 deletions(-) create mode 100644 src/views/system/notify/template/NotifyTemplateSendForm.vue diff --git a/src/api/system/notify/template/index.ts b/src/api/system/notify/template/index.ts index f2bf5d27..50196e85 100644 --- a/src/api/system/notify/template/index.ts +++ b/src/api/system/notify/template/index.ts @@ -1,24 +1,17 @@ import request from '@/config/axios' export interface NotifyTemplateVO { - id: number | null + id?: number name: string nickname: string code: string content: string - type: number | null + type: number params: string - status: number | null + status: number remark: string } -export interface NotifyTemplatePageReqVO extends PageParam { - name?: string - code?: string - status?: number - createTime?: Date[] -} - export interface NotifySendReqVO { userId: number | null templateCode: string @@ -26,22 +19,22 @@ export interface NotifySendReqVO { } // 查询站内信模板列表 -export const getNotifyTemplatePageApi = async (params: NotifyTemplatePageReqVO) => { +export const getNotifyTemplatePage = async (params: PageParam) => { return await request.get({ url: '/system/notify-template/page', params }) } // 查询站内信模板详情 -export const getNotifyTemplateApi = async (id: number) => { +export const getNotifyTemplate = async (id: number) => { return await request.get({ url: '/system/notify-template/get?id=' + id }) } // 新增站内信模板 -export const createNotifyTemplateApi = async (data: NotifyTemplateVO) => { +export const createNotifyTemplate = async (data: NotifyTemplateVO) => { return await request.post({ url: '/system/notify-template/create', data }) } // 修改站内信模板 -export const updateNotifyTemplateApi = async (data: NotifyTemplateVO) => { +export const updateNotifyTemplate = async (data: NotifyTemplateVO) => { return await request.put({ url: '/system/notify-template/update', data }) } @@ -51,6 +44,6 @@ export const deleteNotifyTemplateApi = async (id: number) => { } // 发送站内信 -export const sendNotifyApi = (data: NotifySendReqVO) => { +export const sendNotify = (data: NotifySendReqVO) => { return request.post({ url: '/system/notify-template/send-notify', data }) } diff --git a/src/views/system/notify/template/NotifyTemplateForm.vue b/src/views/system/notify/template/NotifyTemplateForm.vue index d600a59c..55e51ebd 100644 --- a/src/views/system/notify/template/NotifyTemplateForm.vue +++ b/src/views/system/notify/template/NotifyTemplateForm.vue @@ -25,7 +25,7 @@ v-for="dict in getIntDictOptions(DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE)" :key="dict.value" :label="dict.label" - :value="parseInt(dict.value)" + :value="dict.value" /> @@ -34,7 +34,7 @@ {{ dict.label }} @@ -81,6 +81,7 @@ const formRules = reactive({ }) const formRef = ref() // 表单 Ref +/** 打开弹窗 */ const open = async (type: string, id?: number) => { dialogVisible.value = true dialogTitle.value = type @@ -90,7 +91,7 @@ const open = async (type: string, id?: number) => { if (id) { formLoading.value = true try { - formData.value = await NotifyTemplateApi.getNotifyTemplateApi(id) + formData.value = await NotifyTemplateApi.getNotifyTemplate(id) } finally { formLoading.value = false } @@ -107,12 +108,12 @@ const submitForm = async () => { if (!valid) return formLoading.value = true try { - const data = formData.value as NotifyTemplateApi.NotifyTemplateVO + const data = formData.value as unknown as NotifyTemplateApi.NotifyTemplateVO if (formType.value === 'create') { - await NotifyTemplateApi.createNotifyTemplateApi(data) + await NotifyTemplateApi.createNotifyTemplate(data) message.success('新增成功') } else { - await NotifyTemplateApi.updateNotifyTemplateApi(data) + await NotifyTemplateApi.updateNotifyTemplate(data) message.success('修改成功') } dialogVisible.value = false diff --git a/src/views/system/notify/template/NotifyTemplateSendForm.vue b/src/views/system/notify/template/NotifyTemplateSendForm.vue new file mode 100644 index 00000000..9e292a8d --- /dev/null +++ b/src/views/system/notify/template/NotifyTemplateSendForm.vue @@ -0,0 +1,127 @@ + + diff --git a/src/views/system/notify/template/index.vue b/src/views/system/notify/template/index.vue index 9d37befb..6d1938ad 100644 --- a/src/views/system/notify/template/index.vue +++ b/src/views/system/notify/template/index.vue @@ -1,8 +1,8 @@