refactor:基于 lint 处理排版
This commit is contained in:
@@ -66,7 +66,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||
}
|
||||
|
||||
/** 列表的字段 */
|
||||
export function useGridColumns<T = SystemNotifyMessageApi.SystemNotifyMessage>(
|
||||
export function useGridColumns<T = SystemNotifyMessageApi.NotifyMessage>(
|
||||
onActionClick: OnActionClickFn<T>,
|
||||
): VxeTableGridOptions['columns'] {
|
||||
return [
|
||||
|
||||
@@ -25,7 +25,7 @@ function onRefresh() {
|
||||
}
|
||||
|
||||
/** 查看站内信详情 */
|
||||
function onDetail(row: SystemNotifyMessageApi.SystemNotifyMessage) {
|
||||
function onDetail(row: SystemNotifyMessageApi.NotifyMessage) {
|
||||
detailModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ function onDetail(row: SystemNotifyMessageApi.SystemNotifyMessage) {
|
||||
function onActionClick({
|
||||
code,
|
||||
row,
|
||||
}: OnActionClickParams<SystemNotifyMessageApi.SystemNotifyMessage>) {
|
||||
}: OnActionClickParams<SystemNotifyMessageApi.NotifyMessage>) {
|
||||
switch (code) {
|
||||
case 'detail': {
|
||||
onDetail(row);
|
||||
@@ -68,7 +68,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
refresh: { code: 'query' },
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<SystemNotifyMessageApi.SystemNotifyMessage>,
|
||||
} as VxeTableGridOptions<SystemNotifyMessageApi.NotifyMessage>,
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import { Descriptions } from 'ant-design-vue';
|
||||
import { DictTag } from '#/components/dict-tag';
|
||||
import { DICT_TYPE } from '#/utils/dict';
|
||||
|
||||
const formData = ref<SystemNotifyMessageApi.SystemNotifyMessage>();
|
||||
const formData = ref<SystemNotifyMessageApi.NotifyMessage>();
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
async onOpenChange(isOpen: boolean) {
|
||||
@@ -19,7 +19,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<SystemNotifyMessageApi.SystemNotifyMessage>();
|
||||
const data = modalApi.getData<SystemNotifyMessageApi.NotifyMessage>();
|
||||
if (!data || !data.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||
}
|
||||
|
||||
/** 列表的字段 */
|
||||
export function useGridColumns<T = SystemNotifyMessageApi.SystemNotifyMessage>(
|
||||
export function useGridColumns<T = SystemNotifyMessageApi.NotifyMessage>(
|
||||
onActionClick: OnActionClickFn<T>,
|
||||
): VxeTableGridOptions['columns'] {
|
||||
return [
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
<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 { DocAlert } from '#/components/doc-alert';
|
||||
import Detail from './modules/detail.vue';
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { MdiCheckboxMarkedCircleOutline } from '@vben/icons';
|
||||
|
||||
import { Button, message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
@@ -14,8 +16,10 @@ import {
|
||||
updateAllNotifyMessageRead,
|
||||
updateNotifyMessageRead,
|
||||
} from '#/api/system/notify/message';
|
||||
import { DocAlert } from '#/components/doc-alert';
|
||||
|
||||
import { useGridColumns, useGridFormSchema } from './data';
|
||||
import Detail from './modules/detail.vue';
|
||||
|
||||
const [DetailModal, detailModalApi] = useVbenModal({
|
||||
connectedComponent: Detail,
|
||||
@@ -28,12 +32,12 @@ function onRefresh() {
|
||||
}
|
||||
|
||||
/** 查看站内信详情 */
|
||||
function onDetail(row: SystemNotifyMessageApi.SystemNotifyMessage) {
|
||||
function onDetail(row: SystemNotifyMessageApi.NotifyMessage) {
|
||||
detailModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
/** 标记一条站内信已读 */
|
||||
async function onRead(row: SystemNotifyMessageApi.SystemNotifyMessage) {
|
||||
async function onRead(row: SystemNotifyMessageApi.NotifyMessage) {
|
||||
message.loading({
|
||||
content: '正在标记已读...',
|
||||
duration: 0,
|
||||
@@ -63,7 +67,7 @@ async function onMarkRead() {
|
||||
return;
|
||||
}
|
||||
|
||||
const ids = rows.map((row: SystemNotifyMessageApi.SystemNotifyMessage) => row.id);
|
||||
const ids = rows.map((row: SystemNotifyMessageApi.NotifyMessage) => row.id);
|
||||
message.loading({
|
||||
content: '正在标记已读...',
|
||||
duration: 0,
|
||||
@@ -99,7 +103,10 @@ async function onMarkAllRead() {
|
||||
}
|
||||
|
||||
/** 表格操作按钮的回调函数 */
|
||||
function onActionClick({ code, row }: OnActionClickParams<SystemNotifyMessageApi.SystemNotifyMessage>) {
|
||||
function onActionClick({
|
||||
code,
|
||||
row,
|
||||
}: OnActionClickParams<SystemNotifyMessageApi.NotifyMessage>) {
|
||||
switch (code) {
|
||||
case 'detail': {
|
||||
onDetail(row);
|
||||
@@ -139,10 +146,11 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
search: true,
|
||||
},
|
||||
checkboxConfig: {
|
||||
checkMethod: (params: { row: SystemNotifyMessageApi.SystemNotifyMessage }) => !params.row.readStatus,
|
||||
checkMethod: (params: { row: SystemNotifyMessageApi.NotifyMessage }) =>
|
||||
!params.row.readStatus,
|
||||
highlight: true,
|
||||
},
|
||||
} as VxeTableGridOptions<SystemNotifyMessageApi.SystemNotifyMessage>,
|
||||
} as VxeTableGridOptions<SystemNotifyMessageApi.NotifyMessage>,
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
|
||||
@@ -11,7 +11,7 @@ import { Descriptions } from 'ant-design-vue';
|
||||
import { DictTag } from '#/components/dict-tag';
|
||||
import { DICT_TYPE } from '#/utils/dict';
|
||||
|
||||
const formData = ref<SystemNotifyMessageApi.SystemNotifyMessage>();
|
||||
const formData = ref<SystemNotifyMessageApi.NotifyMessage>();
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
async onOpenChange(isOpen: boolean) {
|
||||
@@ -19,7 +19,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<SystemNotifyMessageApi.SystemNotifyMessage>();
|
||||
const data = modalApi.getData<SystemNotifyMessageApi.NotifyMessage>();
|
||||
if (!data || !data.id) {
|
||||
return;
|
||||
}
|
||||
@@ -43,6 +43,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||
<Descriptions.Item label="发送人">
|
||||
{{ formData?.templateNickname }}
|
||||
</Descriptions.Item>
|
||||
<!-- TODO @芋艿:报错 -->
|
||||
<Descriptions.Item label="发送时间">
|
||||
{{ formatDateTime(formData?.createTime) }}
|
||||
</Descriptions.Item>
|
||||
|
||||
@@ -64,7 +64,10 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
label: '模板类型',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE, 'number'),
|
||||
options: getDictOptions(
|
||||
DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE,
|
||||
'number',
|
||||
),
|
||||
class: 'w-full',
|
||||
placeholder: '请选择模板类型',
|
||||
},
|
||||
@@ -128,7 +131,10 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||
label: '模板类型',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE, 'number'),
|
||||
options: getDictOptions(
|
||||
DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE,
|
||||
'number',
|
||||
),
|
||||
allowClear: true,
|
||||
placeholder: '请选择模板类型',
|
||||
},
|
||||
@@ -221,7 +227,7 @@ export function useSendNotifyFormSchema(): VbenFormSchema[] {
|
||||
}
|
||||
|
||||
/** 列表的字段 */
|
||||
export function useGridColumns<T = SystemNotifyTemplateApi.SystemNotifyTemplate>(
|
||||
export function useGridColumns<T = SystemNotifyTemplateApi.NotifyTemplate>(
|
||||
onActionClick: OnActionClickFn<T>,
|
||||
): VxeTableGridOptions['columns'] {
|
||||
return [
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
<script lang="ts" setup>
|
||||
import type { OnActionClickParams, VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type {
|
||||
OnActionClickParams,
|
||||
VxeTableGridOptions,
|
||||
} from '#/adapter/vxe-table';
|
||||
import type { SystemNotifyTemplateApi } from '#/api/system/notify/template';
|
||||
|
||||
import { DocAlert } from '#/components/doc-alert';
|
||||
@@ -10,7 +13,11 @@ import { Download, Plus } from '@vben/icons';
|
||||
import { Button, message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { deleteNotifyTemplate, exportNotifyTemplate, getNotifyTemplatePage } from '#/api/system/notify/template';
|
||||
import {
|
||||
deleteNotifyTemplate,
|
||||
exportNotifyTemplate,
|
||||
getNotifyTemplatePage,
|
||||
} from '#/api/system/notify/template';
|
||||
import { $t } from '#/locales';
|
||||
import { downloadByData } from '#/utils/download';
|
||||
|
||||
@@ -43,17 +50,17 @@ function onCreate() {
|
||||
}
|
||||
|
||||
/** 编辑站内信模板 */
|
||||
function onEdit(row: SystemNotifyTemplateApi.SystemNotifyTemplate) {
|
||||
function onEdit(row: SystemNotifyTemplateApi.NotifyTemplate) {
|
||||
formModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
/** 发送测试站内信 */
|
||||
function onSend(row: SystemNotifyTemplateApi.SystemNotifyTemplate) {
|
||||
function onSend(row: SystemNotifyTemplateApi.NotifyTemplate) {
|
||||
sendModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
/** 删除站内信模板 */
|
||||
async function onDelete(row: SystemNotifyTemplateApi.SystemNotifyTemplate) {
|
||||
async function onDelete(row: SystemNotifyTemplateApi.NotifyTemplate) {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||
duration: 0,
|
||||
@@ -72,7 +79,10 @@ async function onDelete(row: SystemNotifyTemplateApi.SystemNotifyTemplate) {
|
||||
}
|
||||
|
||||
/** 表格操作按钮的回调函数 */
|
||||
function onActionClick({ code, row }: OnActionClickParams<SystemNotifyTemplateApi.SystemNotifyTemplate>) {
|
||||
function onActionClick({
|
||||
code,
|
||||
row,
|
||||
}: OnActionClickParams<SystemNotifyTemplateApi.NotifyTemplate>) {
|
||||
switch (code) {
|
||||
case 'delete': {
|
||||
onDelete(row);
|
||||
@@ -115,7 +125,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
refresh: { code: 'query' },
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<SystemNotifyTemplateApi.SystemNotifyTemplate>,
|
||||
} as VxeTableGridOptions<SystemNotifyTemplateApi.NotifyTemplate>,
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -127,11 +137,20 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
<SendModal />
|
||||
<Grid table-title="站内信模板列表">
|
||||
<template #toolbar-tools>
|
||||
<Button type="primary" @click="onCreate" v-access:code="['system:notify-template:create']">
|
||||
<Button
|
||||
type="primary"
|
||||
@click="onCreate"
|
||||
v-access:code="['system:notify-template:create']"
|
||||
>
|
||||
<Plus class="size-5" />
|
||||
{{ $t('ui.actionTitle.create', ['站内信模板']) }}
|
||||
</Button>
|
||||
<Button type="primary" class="ml-2" @click="onExport" v-access:code="['system:notify-template:export']">
|
||||
<Button
|
||||
type="primary"
|
||||
class="ml-2"
|
||||
@click="onExport"
|
||||
v-access:code="['system:notify-template:export']"
|
||||
>
|
||||
<Download class="size-5" />
|
||||
{{ $t('ui.actionTitle.export') }}
|
||||
</Button>
|
||||
|
||||
@@ -5,16 +5,22 @@ import { useVbenModal } from '@vben/common-ui';
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { createNotifyTemplate, getNotifyTemplate, updateNotifyTemplate } from '#/api/system/notify/template';
|
||||
import {
|
||||
createNotifyTemplate,
|
||||
getNotifyTemplate,
|
||||
updateNotifyTemplate,
|
||||
} from '#/api/system/notify/template';
|
||||
import { $t } from '#/locales';
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { useFormSchema } from '../data';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<SystemNotifyTemplateApi.SystemNotifyTemplate>();
|
||||
const formData = ref<SystemNotifyTemplateApi.NotifyTemplate>();
|
||||
const getTitle = computed(() => {
|
||||
return formData.value?.id ? $t('ui.actionTitle.edit', ['站内信模板']) : $t('ui.actionTitle.create', ['站内信模板']);
|
||||
return formData.value?.id
|
||||
? $t('ui.actionTitle.edit', ['站内信模板'])
|
||||
: $t('ui.actionTitle.create', ['站内信模板']);
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
@@ -31,9 +37,12 @@ const [Modal, modalApi] = useVbenModal({
|
||||
}
|
||||
modalApi.lock();
|
||||
// 提交表单
|
||||
const data = (await formApi.getValues()) as SystemNotifyTemplateApi.SystemNotifyTemplate;
|
||||
const data =
|
||||
(await formApi.getValues()) as SystemNotifyTemplateApi.NotifyTemplate;
|
||||
try {
|
||||
await (formData.value?.id ? updateNotifyTemplate(data) : createNotifyTemplate(data));
|
||||
await (formData.value?.id
|
||||
? updateNotifyTemplate(data)
|
||||
: createNotifyTemplate(data));
|
||||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
@@ -51,7 +60,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||
}
|
||||
|
||||
// 加载数据
|
||||
const data = modalApi.getData<SystemNotifyTemplateApi.SystemNotifyTemplate>();
|
||||
const data = modalApi.getData<SystemNotifyTemplateApi.NotifyTemplate>();
|
||||
if (!data || !data.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import { ref } from 'vue';
|
||||
import { useSendNotifyFormSchema } from '../data';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<SystemNotifyTemplateApi.SystemNotifyTemplate>();
|
||||
const formData = ref<SystemNotifyTemplateApi.NotifyTemplate>();
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
layout: 'horizontal',
|
||||
@@ -37,7 +37,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||
paramsObj[param] = values[`param_${param}`];
|
||||
});
|
||||
}
|
||||
const data: SystemNotifyTemplateApi.SystemNotifySendReqVO = {
|
||||
const data: SystemNotifyTemplateApi.NotifySendReqVO = {
|
||||
userId: values.userId,
|
||||
userType: values.userType,
|
||||
templateCode: formData.value?.code || '',
|
||||
@@ -65,7 +65,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||
return;
|
||||
}
|
||||
// 获取数据
|
||||
const data = modalApi.getData<SystemNotifyTemplateApi.SystemNotifyTemplate>();
|
||||
const data = modalApi.getData<SystemNotifyTemplateApi.NotifyTemplate>();
|
||||
if (!data || !data.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user