Files
ruoyi-plus-vben5/apps/web-antd/src/views/system/notice/data.ts

130 lines
2.7 KiB
TypeScript
Raw Normal View History

2024-10-17 15:16:22 +08:00
import type { VxeGridProps } from '#/adapter/vxe-table';
2024-09-12 16:00:53 +08:00
import { DictEnum } from '@vben/constants';
2024-09-24 11:23:02 +08:00
import { getPopupContainer } from '@vben/utils';
2024-09-12 16:00:53 +08:00
2024-10-17 15:16:22 +08:00
import { type FormSchemaGetter } from '#/adapter/form';
2024-09-12 16:00:53 +08:00
import { getDictOptions } from '#/utils/dict';
2024-10-05 16:06:20 +08:00
import { renderDict } from '#/utils/render';
2024-09-12 16:00:53 +08:00
2024-09-24 11:23:02 +08:00
export const querySchema: FormSchemaGetter = () => [
{
component: 'Input',
fieldName: 'noticeTitle',
label: '公告标题',
},
{
component: 'Input',
fieldName: 'createBy',
label: '创建人',
},
{
component: 'Select',
componentProps: {
getPopupContainer,
options: getDictOptions(DictEnum.SYS_NOTICE_TYPE),
},
fieldName: 'noticeType',
label: '公告类型',
},
];
2024-10-05 16:06:20 +08:00
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{
title: '公告标题',
field: 'noticeTitle',
},
{
title: '公告类型',
field: 'noticeType',
width: 120,
slots: {
default: ({ row }) => {
return renderDict(row.noticeType, DictEnum.SYS_NOTICE_TYPE);
},
},
},
{
title: '状态',
field: 'status',
width: 120,
slots: {
default: ({ row }) => {
return renderDict(row.status, DictEnum.SYS_NOTICE_STATUS);
},
},
},
{
title: '创建人',
field: 'createByName',
width: 150,
},
{
title: '创建时间',
field: 'createTime',
},
{
field: 'action',
fixed: 'right',
slots: { default: 'action' },
title: '操作',
width: 180,
},
];
2024-09-12 16:00:53 +08:00
export const modalSchema: FormSchemaGetter = () => [
{
component: 'Input',
dependencies: {
show: () => false,
triggerFields: [''],
},
fieldName: 'noticeId',
label: '主键',
},
{
component: 'Input',
fieldName: 'noticeTitle',
formItemClass: 'col-span-2',
label: '公告标题',
rules: 'required',
},
{
component: 'RadioGroup',
componentProps: {
buttonStyle: 'solid',
class: 'grid-cols-2',
options: getDictOptions(DictEnum.SYS_NOTICE_STATUS),
optionType: 'button',
},
defaultValue: '0',
fieldName: 'status',
label: '公告状态',
rules: 'required',
},
{
component: 'RadioGroup',
componentProps: {
buttonStyle: 'solid',
class: 'grid-cols-2',
options: getDictOptions(DictEnum.SYS_NOTICE_TYPE),
optionType: 'button',
},
defaultValue: '1',
fieldName: 'noticeType',
label: '公告类型',
rules: 'required',
},
{
2024-09-25 17:22:22 +08:00
component: 'RichTextarea',
componentProps: {
width: '100%',
},
2024-09-12 16:00:53 +08:00
fieldName: 'noticeContent',
formItemClass: 'col-span-2',
label: '公告内容',
rules: 'required',
},
];