refactor:优化 notify 站内信的实现
This commit is contained in:
@@ -60,7 +60,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||
}
|
||||
|
||||
/** 列表的字段 */
|
||||
export function useGridColumns<T = SystemNotifyMessageApi.NotifyMessage>(
|
||||
export function useGridColumns<T = SystemNotifyMessageApi.SystemNotifyMessage>(
|
||||
onActionClick: OnActionClickFn<T>,
|
||||
): VxeTableGridOptions['columns'] {
|
||||
return [
|
||||
@@ -98,6 +98,7 @@ export function useGridColumns<T = SystemNotifyMessageApi.NotifyMessage>(
|
||||
title: '模版内容',
|
||||
minWidth: 200,
|
||||
},
|
||||
// TODO @puhui999:这个参数展示不对
|
||||
{
|
||||
field: 'templateParams',
|
||||
title: '模版参数',
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
<script lang="ts" setup>
|
||||
import type {
|
||||
OnActionClickParams,
|
||||
VxeTableGridOptions,
|
||||
} from '#/adapter/vxe-table';
|
||||
import type { OnActionClickParams, VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { SystemNotifyMessageApi } from '#/api/system/notify/message';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { getNotifyMessagePage } from '#/api/system/notify/message';
|
||||
import Detail from './modules/detail.vue';
|
||||
|
||||
import { useGridColumns, useGridFormSchema } from './data';
|
||||
import Detail from './modules/detail.vue';
|
||||
|
||||
const [DetailModal, detailModalApi] = useVbenModal({
|
||||
connectedComponent: Detail,
|
||||
@@ -24,7 +21,7 @@ function onRefresh() {
|
||||
}
|
||||
|
||||
/** 查看站内信详情 */
|
||||
function onView(row: SystemNotifyMessageApi.NotifyMessage) {
|
||||
function onView(row: SystemNotifyMessageApi.SystemNotifyMessage) {
|
||||
detailModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
@@ -32,7 +29,7 @@ function onView(row: SystemNotifyMessageApi.NotifyMessage) {
|
||||
function onActionClick({
|
||||
code,
|
||||
row,
|
||||
}: OnActionClickParams<SystemNotifyMessageApi.NotifyMessage>) {
|
||||
}: OnActionClickParams<SystemNotifyMessageApi.SystemNotifyMessage>) {
|
||||
switch (code) {
|
||||
case 'view': {
|
||||
onView(row);
|
||||
@@ -67,9 +64,10 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
refresh: { code: 'query' },
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<SystemNotifyMessageApi.NotifyMessage>,
|
||||
} as VxeTableGridOptions<SystemNotifyMessageApi.SystemNotifyMessage>,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<DetailModal @success="onRefresh" />
|
||||
|
||||
@@ -8,7 +8,7 @@ import { ref } from 'vue';
|
||||
import { formatDateTime } from '@vben/utils';
|
||||
import { DICT_TYPE, getDictLabel } from '#/utils/dict';
|
||||
|
||||
const messageData = ref<SystemNotifyMessageApi.NotifyMessage>();
|
||||
const messageData = ref<SystemNotifyMessageApi.SystemNotifyMessage>();
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
async onOpenChange(isOpen: boolean) {
|
||||
@@ -16,7 +16,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<SystemNotifyMessageApi.NotifyMessage>();
|
||||
const data = modalApi.getData<SystemNotifyMessageApi.SystemNotifyMessage>();
|
||||
if (!data || !data.id) {
|
||||
return;
|
||||
}
|
||||
@@ -31,7 +31,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal title="站内信详情">
|
||||
<Modal title="站内信详情" class="w-1/2">
|
||||
<Descriptions bordered :column="1" size="middle" class="mx-4">
|
||||
<Descriptions.Item label="编号">{{ messageData?.id }}</Descriptions.Item>
|
||||
<Descriptions.Item label="用户类型">
|
||||
@@ -61,23 +61,13 @@ const [Modal, modalApi] = useVbenModal({
|
||||
<Descriptions.Item label="模版类型">
|
||||
<!-- TODO @芋艿: 数据字典-->
|
||||
<Tag color="processing">
|
||||
{{
|
||||
getDictLabel(
|
||||
DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE,
|
||||
messageData?.templateType,
|
||||
)
|
||||
}}
|
||||
{{ getDictLabel(DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE, messageData?.templateType) }}
|
||||
</Tag>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="是否已读">
|
||||
<!-- TODO @芋艿: 数据字典-->
|
||||
<Tag color="processing">
|
||||
{{
|
||||
getDictLabel(
|
||||
DICT_TYPE.INFRA_BOOLEAN_STRING,
|
||||
messageData?.readStatus,
|
||||
)
|
||||
}}
|
||||
{{ getDictLabel(DICT_TYPE.INFRA_BOOLEAN_STRING, messageData?.readStatus) }}
|
||||
</Tag>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="阅读时间">
|
||||
|
||||
Reference in New Issue
Block a user