129 lines
2.5 KiB
TypeScript
129 lines
2.5 KiB
TypeScript
|
import type { FormSchemaGetter } from '#/adapter/form';
|
||
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||
|
|
||
|
import { getDictOptions } from '#/utils/dict';
|
||
|
import { renderDict } from '#/utils/render';
|
||
|
|
||
|
export const querySchema: FormSchemaGetter = () => [
|
||
|
{
|
||
|
component: 'Input',
|
||
|
fieldName: 'title',
|
||
|
label: '标题',
|
||
|
},
|
||
|
{
|
||
|
component: 'Select',
|
||
|
componentProps: {
|
||
|
options: getDictOptions('pro_activity_status'),
|
||
|
},
|
||
|
fieldName: 'status',
|
||
|
label: '状态',
|
||
|
},
|
||
|
];
|
||
|
|
||
|
export const columns: VxeGridProps['columns'] = [
|
||
|
{ type: 'checkbox', width: 60 },
|
||
|
{
|
||
|
title: '序号',
|
||
|
field: 'id',
|
||
|
slots: {
|
||
|
default: ({ rowIndex }) => {
|
||
|
return (rowIndex + 1).toString();
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
title: '标题',
|
||
|
field: 'title',
|
||
|
},
|
||
|
{
|
||
|
title: '创建人',
|
||
|
field: 'title',
|
||
|
},
|
||
|
{
|
||
|
title: '开始时间',
|
||
|
field: 'startTime',
|
||
|
},
|
||
|
{
|
||
|
title: '结束时间',
|
||
|
field: 'endTime',
|
||
|
},
|
||
|
{
|
||
|
title: '状态',
|
||
|
field: 'status',
|
||
|
slots: {
|
||
|
default: ({ row }) => {
|
||
|
// 可选从DictEnum中获取 DictEnum.PRO_ACTIVITY_STATUS 便于维护
|
||
|
return renderDict(row.status, 'pro_activity_status');
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
field: 'action',
|
||
|
fixed: 'right',
|
||
|
slots: { default: 'action' },
|
||
|
title: '操作',
|
||
|
width: 180,
|
||
|
},
|
||
|
];
|
||
|
|
||
|
export const modalSchema: FormSchemaGetter = () => [
|
||
|
{
|
||
|
label: '主键',
|
||
|
fieldName: 'id',
|
||
|
component: 'Input',
|
||
|
dependencies: {
|
||
|
show: () => false,
|
||
|
triggerFields: [''],
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
label: '标题',
|
||
|
fieldName: 'title',
|
||
|
component: 'Input',
|
||
|
rules: 'required',
|
||
|
},
|
||
|
{
|
||
|
label: '头部照片',
|
||
|
fieldName: 'headImgUrl',
|
||
|
component: 'ImageUpload',
|
||
|
componentProps: {
|
||
|
maxCount: 1,
|
||
|
},
|
||
|
formItemClass: 'col-span-2',
|
||
|
rules: 'required',
|
||
|
},
|
||
|
{
|
||
|
label: '开始时间',
|
||
|
fieldName: 'startTime',
|
||
|
component: 'DatePicker',
|
||
|
componentProps: {
|
||
|
showTime: true,
|
||
|
format: 'YYYY-MM-DD HH:mm:ss',
|
||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||
|
},
|
||
|
rules: 'required',
|
||
|
},
|
||
|
{
|
||
|
label: '结束时间',
|
||
|
fieldName: 'endTime',
|
||
|
component: 'DatePicker',
|
||
|
componentProps: {
|
||
|
showTime: true,
|
||
|
format: 'YYYY-MM-DD HH:mm:ss',
|
||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||
|
},
|
||
|
rules: 'required',
|
||
|
},
|
||
|
{
|
||
|
label: '活动内容',
|
||
|
fieldName: 'activeContent',
|
||
|
component: 'RichTextarea',
|
||
|
formItemClass: 'col-span-2',
|
||
|
componentProps: {
|
||
|
// disabled: false, // 是否只读
|
||
|
// height: 400 // 高度 默认400
|
||
|
},
|
||
|
rules: 'required',
|
||
|
},
|
||
|
];
|