2025-05-12 00:35:02 +08:00
|
|
|
|
import type { VbenFormSchema } from '#/adapter/form';
|
2025-09-04 21:31:24 +08:00
|
|
|
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
2025-09-05 00:46:57 +08:00
|
|
|
|
import type { SystemNoticeApi } from '#/api/system/notice';
|
2025-05-12 00:35:02 +08:00
|
|
|
|
|
2025-09-05 00:46:57 +08:00
|
|
|
|
import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps, } from '#/utils';
|
2025-05-12 00:35:02 +08:00
|
|
|
|
|
|
|
|
|
|
/** 新增/修改的表单 */
|
|
|
|
|
|
export function useFormSchema(): VbenFormSchema[] {
|
|
|
|
|
|
return [
|
|
|
|
|
|
{
|
|
|
|
|
|
fieldName: 'id',
|
|
|
|
|
|
component: 'Input',
|
|
|
|
|
|
dependencies: {
|
|
|
|
|
|
triggerFields: [''],
|
|
|
|
|
|
show: () => false,
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
fieldName: 'title',
|
|
|
|
|
|
label: '公告标题',
|
|
|
|
|
|
rules: 'required',
|
2025-09-05 00:46:57 +08:00
|
|
|
|
component: 'Input',
|
2025-05-12 00:35:02 +08:00
|
|
|
|
componentProps: {
|
2025-09-05 00:46:57 +08:00
|
|
|
|
placeholder: '请输入公告标题',
|
2025-05-12 00:35:02 +08:00
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
fieldName: 'content',
|
|
|
|
|
|
label: '公告内容',
|
2025-09-05 00:46:57 +08:00
|
|
|
|
rules: 'required',
|
2025-05-12 00:35:02 +08:00
|
|
|
|
component: 'RichTextarea',
|
2025-09-05 00:46:57 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
fieldName: 'type',
|
|
|
|
|
|
label: '公告类型(1通知 2公告)',
|
2025-05-12 00:35:02 +08:00
|
|
|
|
rules: 'required',
|
2025-09-05 00:46:57 +08:00
|
|
|
|
component: 'Select',
|
|
|
|
|
|
componentProps: {
|
|
|
|
|
|
options: getDictOptions(DICT_TYPE.SYSTEM_NOTICE_TYPE, 'number'),
|
|
|
|
|
|
placeholder: '请选择公告类型(1通知 2公告)',
|
|
|
|
|
|
},
|
2025-05-12 00:35:02 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
fieldName: 'status',
|
2025-09-05 00:46:57 +08:00
|
|
|
|
label: '公告状态(0正常 1关闭)',
|
|
|
|
|
|
rules: 'required',
|
2025-05-12 00:35:02 +08:00
|
|
|
|
component: 'RadioGroup',
|
|
|
|
|
|
componentProps: {
|
2025-09-05 00:46:57 +08:00
|
|
|
|
options: [],
|
2025-05-12 00:35:02 +08:00
|
|
|
|
buttonStyle: 'solid',
|
|
|
|
|
|
optionType: 'button',
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 列表的搜索表单 */
|
|
|
|
|
|
export function useGridFormSchema(): VbenFormSchema[] {
|
|
|
|
|
|
return [
|
|
|
|
|
|
{
|
|
|
|
|
|
fieldName: 'title',
|
|
|
|
|
|
label: '公告标题',
|
|
|
|
|
|
component: 'Input',
|
|
|
|
|
|
componentProps: {
|
2025-09-05 00:46:57 +08:00
|
|
|
|
allowClear: true,
|
2025-05-12 00:35:02 +08:00
|
|
|
|
placeholder: '请输入公告标题',
|
2025-09-05 00:46:57 +08:00
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
fieldName: 'content',
|
|
|
|
|
|
label: '公告内容',
|
|
|
|
|
|
component: 'Input',
|
|
|
|
|
|
componentProps: {
|
2025-05-12 00:35:02 +08:00
|
|
|
|
allowClear: true,
|
2025-09-05 00:46:57 +08:00
|
|
|
|
placeholder: '请输入公告内容',
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
fieldName: 'type',
|
|
|
|
|
|
label: '公告类型(1通知 2公告)',
|
|
|
|
|
|
component: 'Select',
|
|
|
|
|
|
componentProps: {
|
|
|
|
|
|
allowClear: true,
|
|
|
|
|
|
options: getDictOptions(DICT_TYPE.SYSTEM_NOTICE_TYPE, 'number'),
|
|
|
|
|
|
placeholder: '请选择公告类型(1通知 2公告)',
|
2025-05-12 00:35:02 +08:00
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
fieldName: 'status',
|
2025-09-05 00:46:57 +08:00
|
|
|
|
label: '公告状态(0正常 1关闭)',
|
2025-05-12 00:35:02 +08:00
|
|
|
|
component: 'Select',
|
|
|
|
|
|
componentProps: {
|
2025-09-05 00:46:57 +08:00
|
|
|
|
allowClear: true,
|
|
|
|
|
|
options: [],
|
|
|
|
|
|
placeholder: '请选择公告状态(0正常 1关闭)',
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
fieldName: 'createTime',
|
|
|
|
|
|
label: '创建时间',
|
|
|
|
|
|
component: 'RangePicker',
|
|
|
|
|
|
componentProps: {
|
|
|
|
|
|
...getRangePickerDefaultProps(),
|
2025-05-12 00:35:02 +08:00
|
|
|
|
allowClear: true,
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 列表的字段 */
|
2025-09-05 00:46:57 +08:00
|
|
|
|
export function useGridColumns(): VxeTableGridOptions<SystemNoticeApi.Notice>['columns'] {
|
2025-05-12 00:35:02 +08:00
|
|
|
|
return [
|
2025-09-04 21:31:24 +08:00
|
|
|
|
{ type: 'checkbox', width: 40 },
|
2025-05-12 00:35:02 +08:00
|
|
|
|
{
|
|
|
|
|
|
field: 'id',
|
2025-09-05 00:46:57 +08:00
|
|
|
|
title: '公告ID',
|
|
|
|
|
|
minWidth: 120,
|
2025-05-12 00:35:02 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
field: 'title',
|
|
|
|
|
|
title: '公告标题',
|
2025-09-05 00:46:57 +08:00
|
|
|
|
minWidth: 120,
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
field: 'content',
|
|
|
|
|
|
title: '公告内容',
|
|
|
|
|
|
minWidth: 120,
|
2025-05-12 00:35:02 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
field: 'type',
|
2025-09-05 00:46:57 +08:00
|
|
|
|
title: '公告类型(1通知 2公告)',
|
|
|
|
|
|
minWidth: 120,
|
2025-05-12 00:35:02 +08:00
|
|
|
|
cellRender: {
|
|
|
|
|
|
name: 'CellDict',
|
|
|
|
|
|
props: { type: DICT_TYPE.SYSTEM_NOTICE_TYPE },
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
field: 'status',
|
2025-09-05 00:46:57 +08:00
|
|
|
|
title: '公告状态(0正常 1关闭)',
|
|
|
|
|
|
minWidth: 120,
|
2025-05-12 00:35:02 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
field: 'createTime',
|
|
|
|
|
|
title: '创建时间',
|
2025-09-05 00:46:57 +08:00
|
|
|
|
minWidth: 120,
|
2025-05-12 00:35:02 +08:00
|
|
|
|
formatter: 'formatDateTime',
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: '操作',
|
2025-09-05 00:46:57 +08:00
|
|
|
|
width: 200,
|
2025-05-12 00:35:02 +08:00
|
|
|
|
fixed: 'right',
|
2025-09-04 21:31:24 +08:00
|
|
|
|
slots: { default: 'actions' },
|
2025-05-12 00:35:02 +08:00
|
|
|
|
},
|
|
|
|
|
|
];
|
|
|
|
|
|
}
|