reactor:【system 系统管理】notify/template 进一步统一代码风格
parent
a38e55651b
commit
94d778c0df
|
|
@ -17,7 +17,7 @@ export namespace SystemNotifyTemplateApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 发送站内信请求 */
|
/** 发送站内信请求 */
|
||||||
export interface NotifySendReq {
|
export interface NotifySendReqVO {
|
||||||
userId: number;
|
userId: number;
|
||||||
userType: number;
|
userType: number;
|
||||||
templateCode: string;
|
templateCode: string;
|
||||||
|
|
@ -74,6 +74,6 @@ export function exportNotifyTemplate(params: any) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 发送站内信 */
|
/** 发送站内信 */
|
||||||
export function sendNotify(data: SystemNotifyTemplateApi.NotifySendReq) {
|
export function sendNotify(data: SystemNotifyTemplateApi.NotifySendReqVO) {
|
||||||
return requestClient.post('/system/notify-template/send-notify', data);
|
return requestClient.post('/system/notify-template/send-notify', data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,13 @@
|
||||||
import type { VbenFormSchema } from '#/adapter/form';
|
import type { VbenFormSchema } from '#/adapter/form';
|
||||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
|
|
||||||
import { CommonStatusEnum, UserTypeEnum } from '@vben/constants';
|
import { CommonStatusEnum, DICT_TYPE, UserTypeEnum } from '@vben/constants';
|
||||||
|
import { getDictOptions } from '@vben/hooks';
|
||||||
|
|
||||||
import { z } from '#/adapter/form';
|
import { z } from '#/adapter/form';
|
||||||
import { getSimpleUserList } from '#/api/system/user';
|
import { getSimpleUserList } from '#/api/system/user';
|
||||||
import { DICT_TYPE } from '@vben/constants';
|
|
||||||
import { getDictOptions } from '@vben/hooks';
|
|
||||||
|
|
||||||
import { getRangePickerDefaultProps } from '#/utils';
|
import { getRangePickerDefaultProps } from '#/utils';
|
||||||
|
|
||||||
/** 新增/修改的表单 */
|
/** 新增/修改的表单 */
|
||||||
export function useFormSchema(): VbenFormSchema[] {
|
export function useFormSchema(): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
|
|
@ -178,7 +177,7 @@ export function useSendNotifyFormSchema(): VbenFormSchema[] {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'userId',
|
fieldName: 'userId',
|
||||||
label: '接收人ID',
|
label: '接收人 ID',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '请输入用户编号',
|
placeholder: '请输入用户编号',
|
||||||
|
|
@ -228,26 +227,32 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||||
{
|
{
|
||||||
field: 'id',
|
field: 'id',
|
||||||
title: '编号',
|
title: '编号',
|
||||||
|
minWidth: 100,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'name',
|
field: 'name',
|
||||||
title: '模板名称',
|
title: '模板名称',
|
||||||
|
minWidth: 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'code',
|
field: 'code',
|
||||||
title: '模板编码',
|
title: '模板编码',
|
||||||
|
minWidth: 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'nickname',
|
field: 'nickname',
|
||||||
title: '发送人名称',
|
title: '发送人名称',
|
||||||
|
minWidth: 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'content',
|
field: 'content',
|
||||||
title: '模板内容',
|
title: '模板内容',
|
||||||
|
minWidth: 200,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'type',
|
field: 'type',
|
||||||
title: '模板类型',
|
title: '模板类型',
|
||||||
|
minWidth: 120,
|
||||||
cellRender: {
|
cellRender: {
|
||||||
name: 'CellDict',
|
name: 'CellDict',
|
||||||
props: { type: DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE },
|
props: { type: DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE },
|
||||||
|
|
@ -256,6 +261,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||||
{
|
{
|
||||||
field: 'status',
|
field: 'status',
|
||||||
title: '状态',
|
title: '状态',
|
||||||
|
minWidth: 100,
|
||||||
cellRender: {
|
cellRender: {
|
||||||
name: 'CellDict',
|
name: 'CellDict',
|
||||||
props: { type: DICT_TYPE.COMMON_STATUS },
|
props: { type: DICT_TYPE.COMMON_STATUS },
|
||||||
|
|
@ -264,10 +270,12 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||||
{
|
{
|
||||||
field: 'remark',
|
field: 'remark',
|
||||||
title: '备注',
|
title: '备注',
|
||||||
|
minWidth: 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'createTime',
|
field: 'createTime',
|
||||||
title: '创建时间',
|
title: '创建时间',
|
||||||
|
minWidth: 180,
|
||||||
formatter: 'formatDateTime',
|
formatter: 'formatDateTime',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import type { SystemNotifyTemplateApi } from '#/api/system/notify/template';
|
||||||
|
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
|
||||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||||
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
|
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
|
||||||
|
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
|
|
@ -33,7 +33,7 @@ const [SendModal, sendModalApi] = useVbenModal({
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 刷新表格 */
|
/** 刷新表格 */
|
||||||
function onRefresh() {
|
function handleRefresh() {
|
||||||
gridApi.query();
|
gridApi.query();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -62,15 +62,29 @@ function handleSend(row: SystemNotifyTemplateApi.NotifyTemplate) {
|
||||||
async function handleDelete(row: SystemNotifyTemplateApi.NotifyTemplate) {
|
async function handleDelete(row: SystemNotifyTemplateApi.NotifyTemplate) {
|
||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||||
key: 'action_key_msg',
|
duration: 0,
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await deleteNotifyTemplate(row.id as number);
|
await deleteNotifyTemplate(row.id as number);
|
||||||
message.success({
|
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
handleRefresh();
|
||||||
key: 'action_key_msg',
|
} finally {
|
||||||
});
|
hideLoading();
|
||||||
onRefresh();
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 批量删除站内信模板 */
|
||||||
|
async function handleDeleteBatch() {
|
||||||
|
await confirm($t('ui.actionMessage.deleteBatchConfirm'));
|
||||||
|
const hideLoading = message.loading({
|
||||||
|
content: $t('ui.actionMessage.deletingBatch'),
|
||||||
|
duration: 0,
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
await deleteNotifyTemplateList(checkedIds.value);
|
||||||
|
checkedIds.value = [];
|
||||||
|
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||||
|
handleRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
}
|
}
|
||||||
|
|
@ -85,23 +99,6 @@ function handleRowCheckboxChange({
|
||||||
checkedIds.value = records.map((item) => item.id!);
|
checkedIds.value = records.map((item) => item.id!);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 批量删除站内信模板 */
|
|
||||||
async function handleDeleteBatch() {
|
|
||||||
const hideLoading = message.loading({
|
|
||||||
content: $t('ui.actionMessage.deleting'),
|
|
||||||
duration: 0,
|
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
|
||||||
try {
|
|
||||||
await deleteNotifyTemplateList(checkedIds.value);
|
|
||||||
checkedIds.value = [];
|
|
||||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
|
||||||
onRefresh();
|
|
||||||
} finally {
|
|
||||||
hideLoading();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const [Grid, gridApi] = useVbenVxeGrid({
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
formOptions: {
|
formOptions: {
|
||||||
schema: useGridFormSchema(),
|
schema: useGridFormSchema(),
|
||||||
|
|
@ -140,10 +137,10 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
<template>
|
<template>
|
||||||
<Page auto-content-height>
|
<Page auto-content-height>
|
||||||
<template #doc>
|
<template #doc>
|
||||||
<DocAlert title="短信配置" url="https://doc.iocoder.cn/sms/" />
|
<DocAlert title="站内信" url="https://doc.iocoder.cn/notify/" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<FormModal @success="onRefresh" />
|
<FormModal @success="handleRefresh" />
|
||||||
<SendModal />
|
<SendModal />
|
||||||
<Grid table-title="站内信模板列表">
|
<Grid table-title="站内信模板列表">
|
||||||
<template #toolbar-tools>
|
<template #toolbar-tools>
|
||||||
|
|
@ -164,11 +161,11 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
onClick: handleExport,
|
onClick: handleExport,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '批量删除',
|
label: $t('ui.actionTitle.deleteBatch'),
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
danger: true,
|
danger: true,
|
||||||
disabled: isEmpty(checkedIds),
|
|
||||||
icon: ACTION_ICON.DELETE,
|
icon: ACTION_ICON.DELETE,
|
||||||
|
disabled: isEmpty(checkedIds),
|
||||||
auth: ['system:notify-template:delete'],
|
auth: ['system:notify-template:delete'],
|
||||||
onClick: handleDeleteBatch,
|
onClick: handleDeleteBatch,
|
||||||
},
|
},
|
||||||
|
|
@ -188,7 +185,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
{
|
{
|
||||||
label: '测试',
|
label: '测试',
|
||||||
type: 'link',
|
type: 'link',
|
||||||
icon: ACTION_ICON.ADD,
|
icon: ACTION_ICON.VIEW,
|
||||||
auth: ['system:notify-template:send-notify'],
|
auth: ['system:notify-template:send-notify'],
|
||||||
onClick: handleSend.bind(null, row),
|
onClick: handleSend.bind(null, row),
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ const [Form, formApi] = useVbenForm({
|
||||||
class: 'w-full',
|
class: 'w-full',
|
||||||
},
|
},
|
||||||
formItemClass: 'col-span-2',
|
formItemClass: 'col-span-2',
|
||||||
labelWidth: 80,
|
labelWidth: 120,
|
||||||
},
|
},
|
||||||
layout: 'horizontal',
|
layout: 'horizontal',
|
||||||
showDefaultActions: false,
|
showDefaultActions: false,
|
||||||
|
|
@ -43,7 +43,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
paramsObj[param] = values[`param_${param}`];
|
paramsObj[param] = values[`param_${param}`];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const data: SystemNotifyTemplateApi.NotifySendReq = {
|
const data: SystemNotifyTemplateApi.NotifySendReqVO = {
|
||||||
userId: values.userId,
|
userId: values.userId,
|
||||||
userType: values.userType,
|
userType: values.userType,
|
||||||
templateCode: formData.value?.code || '',
|
templateCode: formData.value?.code || '',
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
import type { VbenFormSchema } from '#/adapter/form';
|
import type { VbenFormSchema } from '#/adapter/form';
|
||||||
import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
import type { SystemNotifyTemplateApi } from '#/api/system/notify/template';
|
|
||||||
|
|
||||||
import { useAccess } from '@vben/access';
|
|
||||||
import { CommonStatusEnum, DICT_TYPE, UserTypeEnum } from '@vben/constants';
|
import { CommonStatusEnum, DICT_TYPE, UserTypeEnum } from '@vben/constants';
|
||||||
import { getDictOptions } from '@vben/hooks';
|
import { getDictOptions } from '@vben/hooks';
|
||||||
|
|
||||||
|
|
@ -10,8 +8,6 @@ import { z } from '#/adapter/form';
|
||||||
import { getSimpleUserList } from '#/api/system/user';
|
import { getSimpleUserList } from '#/api/system/user';
|
||||||
import { getRangePickerDefaultProps } from '#/utils';
|
import { getRangePickerDefaultProps } from '#/utils';
|
||||||
|
|
||||||
const { hasAccessByCodes } = useAccess();
|
|
||||||
|
|
||||||
/** 新增/修改的表单 */
|
/** 新增/修改的表单 */
|
||||||
export function useFormSchema(): VbenFormSchema[] {
|
export function useFormSchema(): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
|
|
@ -181,7 +177,7 @@ export function useSendNotifyFormSchema(): VbenFormSchema[] {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'userId',
|
fieldName: 'userId',
|
||||||
label: '接收人ID',
|
label: '接收人 ID',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '请输入用户编号',
|
placeholder: '请输入用户编号',
|
||||||
|
|
@ -225,14 +221,9 @@ export function useSendNotifyFormSchema(): VbenFormSchema[] {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 列表的字段 */
|
/** 列表的字段 */
|
||||||
export function useGridColumns<T = SystemNotifyTemplateApi.NotifyTemplate>(
|
export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||||
onActionClick: OnActionClickFn<T>,
|
|
||||||
): VxeTableGridOptions['columns'] {
|
|
||||||
return [
|
return [
|
||||||
{
|
{ type: 'checkbox', width: 40 },
|
||||||
type: 'checkbox',
|
|
||||||
width: 40,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
field: 'id',
|
field: 'id',
|
||||||
title: '编号',
|
title: '编号',
|
||||||
|
|
@ -288,34 +279,10 @@ export function useGridColumns<T = SystemNotifyTemplateApi.NotifyTemplate>(
|
||||||
formatter: 'formatDateTime',
|
formatter: 'formatDateTime',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'operation',
|
|
||||||
title: '操作',
|
title: '操作',
|
||||||
minWidth: 180,
|
width: 220,
|
||||||
align: 'center',
|
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
cellRender: {
|
slots: { default: 'actions' },
|
||||||
attrs: {
|
|
||||||
nameField: 'name',
|
|
||||||
nameTitle: '站内信模板',
|
|
||||||
onClick: onActionClick,
|
|
||||||
},
|
|
||||||
name: 'CellOperation',
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
code: 'edit',
|
|
||||||
show: hasAccessByCodes(['system:notify-template:update']),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
code: 'send',
|
|
||||||
text: '测试',
|
|
||||||
show: hasAccessByCodes(['system:notify-template:send-notify']),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
code: 'delete',
|
|
||||||
show: hasAccessByCodes(['system:notify-template:delete']),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,10 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type {
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
OnActionClickParams,
|
|
||||||
VxeTableGridOptions,
|
|
||||||
} from '#/adapter/vxe-table';
|
|
||||||
import type { SystemNotifyTemplateApi } from '#/api/system/notify/template';
|
import type { SystemNotifyTemplateApi } from '#/api/system/notify/template';
|
||||||
|
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
|
||||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||||
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
|
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
|
||||||
|
|
||||||
import { ElMessage } from 'element-plus';
|
import { ElMessage } from 'element-plus';
|
||||||
|
|
@ -36,59 +33,56 @@ const [SendModal, sendModalApi] = useVbenModal({
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 刷新表格 */
|
/** 刷新表格 */
|
||||||
function onRefresh() {
|
function handleRefresh() {
|
||||||
gridApi.query();
|
gridApi.query();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 导出表格 */
|
/** 导出表格 */
|
||||||
async function onExport() {
|
async function handleExport() {
|
||||||
const data = await exportNotifyTemplate(await gridApi.formApi.getValues());
|
const data = await exportNotifyTemplate(await gridApi.formApi.getValues());
|
||||||
downloadFileFromBlobPart({ fileName: '站内信模板.xls', source: data });
|
downloadFileFromBlobPart({ fileName: '站内信模板.xls', source: data });
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 创建站内信模板 */
|
/** 创建站内信模板 */
|
||||||
function onCreate() {
|
function handleCreate() {
|
||||||
formModalApi.setData(null).open();
|
formModalApi.setData(null).open();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 编辑站内信模板 */
|
/** 编辑站内信模板 */
|
||||||
function onEdit(row: SystemNotifyTemplateApi.NotifyTemplate) {
|
function handleEdit(row: SystemNotifyTemplateApi.NotifyTemplate) {
|
||||||
formModalApi.setData(row).open();
|
formModalApi.setData(row).open();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 发送测试站内信 */
|
/** 发送测试站内信 */
|
||||||
function onSend(row: SystemNotifyTemplateApi.NotifyTemplate) {
|
function handleSend(row: SystemNotifyTemplateApi.NotifyTemplate) {
|
||||||
sendModalApi.setData(row).open();
|
sendModalApi.setData(row).open();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 删除站内信模板 */
|
/** 删除站内信模板 */
|
||||||
async function onDelete(row: SystemNotifyTemplateApi.NotifyTemplate) {
|
async function handleDelete(row: SystemNotifyTemplateApi.NotifyTemplate) {
|
||||||
const loadingInstance = ElMessage({
|
const loadingInstance = ElMessage({
|
||||||
message: $t('ui.actionMessage.deleting', [row.name]),
|
message: $t('ui.actionMessage.deleting', [row.name]),
|
||||||
type: 'info',
|
|
||||||
duration: 0,
|
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await deleteNotifyTemplate(row.id as number);
|
await deleteNotifyTemplate(row.id as number);
|
||||||
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||||
onRefresh();
|
handleRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
loadingInstance.close();
|
loadingInstance.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 批量删除站内信模板 */
|
/** 批量删除站内信模板 */
|
||||||
async function onDeleteBatch() {
|
async function handleDeleteBatch() {
|
||||||
|
await confirm($t('ui.actionMessage.deleteBatchConfirm'));
|
||||||
const loadingInstance = ElMessage({
|
const loadingInstance = ElMessage({
|
||||||
message: $t('ui.actionMessage.deleting'),
|
message: $t('ui.actionMessage.deletingBatch'),
|
||||||
type: 'info',
|
|
||||||
duration: 0,
|
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await deleteNotifyTemplateList(checkedIds.value);
|
await deleteNotifyTemplateList(checkedIds.value);
|
||||||
checkedIds.value = [];
|
checkedIds.value = [];
|
||||||
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
|
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
|
||||||
onRefresh();
|
handleRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
loadingInstance.close();
|
loadingInstance.close();
|
||||||
}
|
}
|
||||||
|
|
@ -103,33 +97,12 @@ function handleRowCheckboxChange({
|
||||||
checkedIds.value = records.map((item) => item.id!);
|
checkedIds.value = records.map((item) => item.id!);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 表格操作按钮的回调函数 */
|
|
||||||
function onActionClick({
|
|
||||||
code,
|
|
||||||
row,
|
|
||||||
}: OnActionClickParams<SystemNotifyTemplateApi.NotifyTemplate>) {
|
|
||||||
switch (code) {
|
|
||||||
case 'delete': {
|
|
||||||
onDelete(row);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'edit': {
|
|
||||||
onEdit(row);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'send': {
|
|
||||||
onSend(row);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const [Grid, gridApi] = useVbenVxeGrid({
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
formOptions: {
|
formOptions: {
|
||||||
schema: useGridFormSchema(),
|
schema: useGridFormSchema(),
|
||||||
},
|
},
|
||||||
gridOptions: {
|
gridOptions: {
|
||||||
columns: useGridColumns(onActionClick),
|
columns: useGridColumns(),
|
||||||
height: 'auto',
|
height: 'auto',
|
||||||
keepSource: true,
|
keepSource: true,
|
||||||
proxyConfig: {
|
proxyConfig: {
|
||||||
|
|
@ -145,6 +118,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
},
|
},
|
||||||
rowConfig: {
|
rowConfig: {
|
||||||
keyField: 'id',
|
keyField: 'id',
|
||||||
|
isHover: true,
|
||||||
},
|
},
|
||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
refresh: true,
|
refresh: true,
|
||||||
|
|
@ -164,7 +138,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
<DocAlert title="站内信" url="https://doc.iocoder.cn/notify/" />
|
<DocAlert title="站内信" url="https://doc.iocoder.cn/notify/" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<FormModal @success="onRefresh" />
|
<FormModal @success="handleRefresh" />
|
||||||
<SendModal />
|
<SendModal />
|
||||||
<Grid table-title="站内信模板列表">
|
<Grid table-title="站内信模板列表">
|
||||||
<template #toolbar-tools>
|
<template #toolbar-tools>
|
||||||
|
|
@ -175,14 +149,14 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
icon: ACTION_ICON.ADD,
|
icon: ACTION_ICON.ADD,
|
||||||
auth: ['system:notify-template:create'],
|
auth: ['system:notify-template:create'],
|
||||||
onClick: onCreate,
|
onClick: handleCreate,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: $t('ui.actionTitle.export'),
|
label: $t('ui.actionTitle.export'),
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
icon: ACTION_ICON.DOWNLOAD,
|
icon: ACTION_ICON.DOWNLOAD,
|
||||||
auth: ['system:notify-template:export'],
|
auth: ['system:notify-template:export'],
|
||||||
onClick: onExport,
|
onClick: handleExport,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: $t('ui.actionTitle.deleteBatch'),
|
label: $t('ui.actionTitle.deleteBatch'),
|
||||||
|
|
@ -190,7 +164,40 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
icon: ACTION_ICON.DELETE,
|
icon: ACTION_ICON.DELETE,
|
||||||
disabled: isEmpty(checkedIds),
|
disabled: isEmpty(checkedIds),
|
||||||
auth: ['system:notify-template:delete'],
|
auth: ['system:notify-template:delete'],
|
||||||
onClick: onDeleteBatch,
|
onClick: handleDeleteBatch,
|
||||||
|
},
|
||||||
|
]"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template #actions="{ row }">
|
||||||
|
<TableAction
|
||||||
|
:actions="[
|
||||||
|
{
|
||||||
|
label: $t('common.edit'),
|
||||||
|
type: 'primary',
|
||||||
|
link: true,
|
||||||
|
icon: ACTION_ICON.EDIT,
|
||||||
|
auth: ['system:notify-template:update'],
|
||||||
|
onClick: handleEdit.bind(null, row),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '测试',
|
||||||
|
type: 'primary',
|
||||||
|
link: true,
|
||||||
|
icon: ACTION_ICON.VIEW,
|
||||||
|
auth: ['system:notify-template:send-notify'],
|
||||||
|
onClick: handleSend.bind(null, row),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: $t('common.delete'),
|
||||||
|
type: 'danger',
|
||||||
|
link: true,
|
||||||
|
icon: ACTION_ICON.DELETE,
|
||||||
|
auth: ['system:notify-template:delete'],
|
||||||
|
popConfirm: {
|
||||||
|
title: $t('ui.actionMessage.deleteConfirm', [row.name]),
|
||||||
|
confirm: handleDelete.bind(null, row),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
]"
|
]"
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ const [Form, formApi] = useVbenForm({
|
||||||
class: 'w-full',
|
class: 'w-full',
|
||||||
},
|
},
|
||||||
formItemClass: 'col-span-2',
|
formItemClass: 'col-span-2',
|
||||||
labelWidth: 80,
|
labelWidth: 120,
|
||||||
},
|
},
|
||||||
layout: 'horizontal',
|
layout: 'horizontal',
|
||||||
showDefaultActions: false,
|
showDefaultActions: false,
|
||||||
|
|
@ -86,7 +86,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 动态构建表单 schema */
|
/** 动态构建表单 schema */
|
||||||
const buildFormSchema = () => {
|
function buildFormSchema() {
|
||||||
const schema = useSendNotifyFormSchema();
|
const schema = useSendNotifyFormSchema();
|
||||||
if (formData.value?.params) {
|
if (formData.value?.params) {
|
||||||
formData.value.params.forEach((param: string) => {
|
formData.value.params.forEach((param: string) => {
|
||||||
|
|
@ -102,7 +102,7 @@ const buildFormSchema = () => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return schema;
|
return schema;
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue