213 lines
4.2 KiB
TypeScript
213 lines
4.2 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: 'name',
|
||
label: '会议室名称',
|
||
},
|
||
{
|
||
component: 'InputNumber',
|
||
fieldName: 'personNumber',
|
||
label: '可容纳人数',
|
||
componentProps: {
|
||
min: 1,
|
||
step: 1,
|
||
precision:0,
|
||
}
|
||
},
|
||
{
|
||
component: 'Select',
|
||
componentProps: {
|
||
options: getDictOptions('meeting_room_status'),
|
||
},
|
||
fieldName: 'status',
|
||
label: '状态',
|
||
},
|
||
];
|
||
|
||
export const columns: VxeGridProps['columns'] = [
|
||
{type: 'checkbox', width: 60},
|
||
{
|
||
title: '会议室名称',
|
||
field: 'name',
|
||
minWidth:100,
|
||
},
|
||
{
|
||
title: '会议室类型',
|
||
field: 'meetingRoomType',
|
||
slots: {
|
||
default: ({row}) => {
|
||
return renderDict(row.meetingRoomType, 'meeting_room_type');
|
||
},
|
||
},
|
||
minWidth:100,
|
||
},
|
||
// {
|
||
// title: '会议室地址',
|
||
// field: 'locationName',
|
||
// width:210,
|
||
// },
|
||
{
|
||
title: '配套设备',
|
||
field: 'baseService',
|
||
width:210,
|
||
},
|
||
{
|
||
title: '可容纳人数',
|
||
field: 'personNumber',
|
||
width:100,
|
||
},
|
||
{
|
||
title: '费用模式',
|
||
field: 'expenseType',
|
||
slots: {
|
||
default: ({row}) => {
|
||
return renderDict(row.expenseType, 'wy_fyms');
|
||
},
|
||
},
|
||
width:100,
|
||
},
|
||
{
|
||
title: '开放时段',
|
||
field: 'openHours',
|
||
width:100,
|
||
},
|
||
{
|
||
title: '状态',
|
||
field: 'status',
|
||
slots: {
|
||
default: 'status'
|
||
},
|
||
width:100,
|
||
},
|
||
{
|
||
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: 'name',
|
||
component: 'Input',
|
||
rules: 'required',
|
||
},
|
||
{
|
||
label: '会议室类型',
|
||
fieldName: 'meetingRoomType',
|
||
component: 'Select',
|
||
componentProps: {
|
||
options: getDictOptions('meeting_room_type'),
|
||
},
|
||
rules: 'selectRequired',
|
||
},
|
||
{
|
||
label: '可容纳人数',
|
||
fieldName: 'personNumber',
|
||
component: 'InputNumber',
|
||
rules: 'required',
|
||
formItemClass: 'col-span-1',
|
||
componentProps: {
|
||
min: 1,
|
||
step: 1,
|
||
precision:0,
|
||
}
|
||
},
|
||
{
|
||
label: '会议室地址',
|
||
fieldName: 'location',
|
||
component: 'TreeSelect',
|
||
rules: 'selectRequired',
|
||
},
|
||
{
|
||
label: '配套设备',
|
||
fieldName: 'baseService',
|
||
component: 'Textarea',
|
||
rules: 'required',
|
||
},
|
||
{
|
||
label: '负责人',
|
||
fieldName: 'principals',
|
||
component: 'Select',
|
||
rules: 'selectRequired',
|
||
},
|
||
{
|
||
label: '费用模式',
|
||
fieldName: 'expenseType',
|
||
component: 'RadioGroup',
|
||
componentProps: {
|
||
buttonStyle: 'solid',
|
||
options: getDictOptions('wy_fyms'),
|
||
},
|
||
formItemClass: 'col-span-1',
|
||
rules: 'required',
|
||
},
|
||
{
|
||
label: '付费金额',
|
||
fieldName: 'basePrice',
|
||
component: 'InputNumber',
|
||
componentProps: {
|
||
min: 0,
|
||
step: 1,
|
||
precision:2,
|
||
},
|
||
formItemClass: 'col-span-1',
|
||
dependencies: {
|
||
// 仅当 费用模式 为 2(付费) 时显示
|
||
show: (formValues: any) => formValues.expenseType === '2',
|
||
triggerFields: ['expenseType'],
|
||
},
|
||
rules: 'required',
|
||
},
|
||
{
|
||
label: '会议室图片',
|
||
fieldName: 'picture',
|
||
component: 'ImageUpload',
|
||
componentProps: {
|
||
maxCount: 10, // 最大上传文件数 默认为1 为1会绑定为string而非string[]类型
|
||
},
|
||
},
|
||
{
|
||
label: '预约是否需要审核',
|
||
fieldName: 'isCheck',
|
||
component: 'RadioGroup',
|
||
componentProps: {
|
||
buttonStyle: 'solid',
|
||
options: getDictOptions('wy_sf'),
|
||
},
|
||
labelWidth:130,
|
||
rules: 'required',
|
||
},
|
||
{
|
||
label: '开放时段',
|
||
fieldName: 'openHours',
|
||
component: 'Input',
|
||
slots: {default: 'openHours'},
|
||
formItemClass: 'col-span-1',
|
||
rules: 'required',
|
||
},
|
||
{
|
||
label: '会议室描述',
|
||
fieldName: 'descs',
|
||
component: 'Textarea',
|
||
},
|
||
];
|