From 5b7530ef74e75333aa9181e41c4ada6debba768f Mon Sep 17 00:00:00 2001 From: dap1 <15891557205@163.com> Date: Fri, 19 May 2023 13:50:23 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E7=AB=99=E5=86=85=E4=BF=A1?= =?UTF-8?q?=E5=8F=91=E9=80=81=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/system/notify/template.ts | 27 ++++++ src/locales/lang/zh-CN/action.ts | 3 +- .../codegen/components/ImportTableModal.vue | 3 +- .../notify/template/SendNotifyModal.vue | 89 +++++++++++++++++++ src/views/system/notify/template/index.vue | 16 +++- .../system/notify/template/template.data.ts | 26 ++++++ 6 files changed, 161 insertions(+), 3 deletions(-) create mode 100644 src/views/system/notify/template/SendNotifyModal.vue diff --git a/src/api/system/notify/template.ts b/src/api/system/notify/template.ts index ebf8a9e..f595415 100644 --- a/src/api/system/notify/template.ts +++ b/src/api/system/notify/template.ts @@ -34,3 +34,30 @@ export function listSimplePosts() { export function exportNotifyTemplateExcel(params) { return defHttp.download({ url: '/system/notify-template/export-excel', params }, '导出站内信模板.xls') } + +export type SendNotifyParam = { + userId: number + templateCode: string + templateParams: { + [key: string]: string + } +} + +export type NotifyTemplate = { + name: string + code: string + type: number + nickname: string + content: string + status: number + remark?: any + id: number + params: string[] + createTime: number + key: string +} + +// 发送 +export function sendNotify(data: SendNotifyParam) { + return defHttp.post({ url: '/system/notify-template/send-notify', data }) +} diff --git a/src/locales/lang/zh-CN/action.ts b/src/locales/lang/zh-CN/action.ts index eaa422e..270cf12 100644 --- a/src/locales/lang/zh-CN/action.ts +++ b/src/locales/lang/zh-CN/action.ts @@ -9,5 +9,6 @@ export default { export: '导出', import: '导入', sync: '同步', - cancel: '取消' + cancel: '取消', + send: '发送' } diff --git a/src/views/infra/codegen/components/ImportTableModal.vue b/src/views/infra/codegen/components/ImportTableModal.vue index 0452071..92ffcd2 100644 --- a/src/views/infra/codegen/components/ImportTableModal.vue +++ b/src/views/infra/codegen/components/ImportTableModal.vue @@ -24,7 +24,8 @@ const [registerTable, { getSelectRowKeys, getForm }] = useTable({ useSearchForm: true, pagination: false, showTableSetting: false, - showIndexColumn: false + showIndexColumn: false, + immediate: false }) const [registerModal, { setModalProps, closeModal }] = useModalInner(async () => { diff --git a/src/views/system/notify/template/SendNotifyModal.vue b/src/views/system/notify/template/SendNotifyModal.vue new file mode 100644 index 0000000..fc86a15 --- /dev/null +++ b/src/views/system/notify/template/SendNotifyModal.vue @@ -0,0 +1,89 @@ + + + + + diff --git a/src/views/system/notify/template/index.vue b/src/views/system/notify/template/index.vue index c4b76e1..d9a24da 100644 --- a/src/views/system/notify/template/index.vue +++ b/src/views/system/notify/template/index.vue @@ -10,6 +10,12 @@ + + diff --git a/src/views/system/notify/message/index.vue b/src/views/system/notify/message/index.vue index e27b9d2..25d48c4 100644 --- a/src/views/system/notify/message/index.vue +++ b/src/views/system/notify/message/index.vue @@ -1,15 +1,36 @@ diff --git a/src/views/system/notify/message/message.data.ts b/src/views/system/notify/message/message.data.ts index f7c7ab0..e241d7e 100644 --- a/src/views/system/notify/message/message.data.ts +++ b/src/views/system/notify/message/message.data.ts @@ -1,5 +1,8 @@ import { BasicColumn, FormSchema, useRender } from '@/components/Table' import { DICT_TYPE, getDictOptions } from '@/utils/dict' +import { JsonPreview } from '@/components/CodeEditor' +import { DescItem } from '@/components/Description/index' +import { h } from 'vue' export const columns: BasicColumn[] = [ { @@ -56,6 +59,9 @@ export const columns: BasicColumn[] = [ dataIndex: 'readTime', width: 180, customRender: ({ text }) => { + if (!text) { + return useRender.renderTag('未阅读') + } return useRender.renderDate(text) } }, @@ -104,3 +110,95 @@ export const searchFormSchema: FormSchema[] = [ colProps: { span: 8 } } ] + +// 站内信详情modal +export const infoSchema: DescItem[] = [ + { + field: 'id', + label: '编号', + labelMinWidth: 50 + }, + { + field: 'readStatus', + label: '是否已读', + render: (value) => { + return useRender.renderDict(value, DICT_TYPE.INFRA_BOOLEAN_STRING) + } + }, + { + field: 'userType', + label: '用户类型', + render: (value) => { + console.log(value) + return useRender.renderDict(value, DICT_TYPE.USER_TYPE) + } + }, + { + field: 'userType', + label: '用户编号' + }, + { + field: 'templateId', + label: '模板编号' + }, + { + field: 'templateCode', + label: '模板编码' + }, + { + field: 'templateNickname', + label: '发送人名称' + }, + { + field: 'templateContent', + label: '模板内容' + }, + { + field: 'templateParams', + label: '模板参数', + render: (value) => { + return h(JsonPreview, { data: value }) + } + }, + { + field: 'templateType', + label: '模板类型', + render: (value) => { + return useRender.renderDict(value, DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE) + } + }, + { + field: 'readTime', + label: '阅读时间', + render: (value) => { + if (!value) { + return useRender.renderTag('未阅读') + } + return useRender.renderDate(value) + } + }, + { + field: 'createTime', + label: '创建时间', + render: (value) => { + return useRender.renderDate(value) + } + } +] + +// 站内信详情 +export interface MessageInfo { + userId: number + userType: number + templateId: number + templateCode: string + templateNickname: string + templateContent: string + templateType: number + templateParams: { [key: string]: string } + readStatus: boolean + readTime?: any + id: number + createTime: number + key: string +}