Files
admin-vben5/apps/web-antd/src/views/property/room/data.ts

148 lines
3.0 KiB
TypeScript
Raw Normal View History

2025-06-28 02:41:09 +08:00
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
2025-06-28 22:49:40 +08:00
import { getPopupContainer } from '@vben/utils';
import { getDictOptions } from '#/utils/dict';
import { DictEnum } from '@vben/constants';
import { renderDict } from '#/utils/render';
2025-06-26 18:04:51 +08:00
export const querySchema: FormSchemaGetter = () => [
{
component: 'Input',
2025-06-28 02:41:09 +08:00
fieldName: 'communityName',
label: '社区',
2025-06-26 18:04:51 +08:00
},
{
component: 'Select',
2025-06-28 22:49:40 +08:00
componentProps: {
getPopupContainer,
options: getDictOptions(DictEnum.wy_fjzt),
},
2025-06-26 18:04:51 +08:00
fieldName: 'status',
2025-06-28 02:41:09 +08:00
label: '状态',
2025-06-26 18:04:51 +08:00
},
];
2025-06-28 02:41:09 +08:00
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
2025-06-26 18:04:51 +08:00
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{
title: '房间号',
field: 'roomNumber',
},
{
title: '房间类型',
2025-06-28 22:49:40 +08:00
field: 'roomTypeName',
2025-06-26 18:04:51 +08:00
},
{
title: '建筑面积',
2025-06-26 18:04:51 +08:00
field: 'area',
},
{
title: '使用面积',
field: 'insideInArea',
},
2025-06-26 18:04:51 +08:00
{
title: '是否重要',
field: 'isMatter',
slots:{
default:({row})=>{
return renderDict(row.isMatter,'wy_fjzydj')
}
}
2025-06-26 18:04:51 +08:00
},
2025-06-26 18:04:51 +08:00
{
2025-06-28 02:41:09 +08:00
title: '状态',
2025-06-28 22:49:40 +08:00
field: 'statusName',
2025-06-26 18:04:51 +08:00
},
{
field: 'action',
fixed: 'right',
slots: { default: 'action' },
title: '操作',
width: 180,
},
];
export const modalSchema: FormSchemaGetter = () => [
{
2025-06-28 02:41:09 +08:00
label: '',
2025-06-26 18:04:51 +08:00
fieldName: 'id',
component: 'Input',
dependencies: {
show: () => false,
triggerFields: [''],
},
},
{
2025-06-28 22:49:40 +08:00
component: 'TreeSelect',
2025-06-28 02:41:09 +08:00
fieldName: 'floorId',
2025-06-28 22:49:40 +08:00
defaultValue: undefined,
label: '社区建筑',
rules: 'selectRequired',
formItemClass: 'col-span-2',
2025-06-26 18:04:51 +08:00
},
{
2025-06-28 22:49:40 +08:00
label: '房间号',
2025-06-26 18:04:51 +08:00
fieldName: 'roomNumber',
component: 'Input',
rules: 'required',
},
{
label: '房间类型',
fieldName: 'roomType',
component: 'Select',
2025-06-28 22:49:40 +08:00
componentProps: {
getPopupContainer,
options: getDictOptions(DictEnum.wy_room_type),
},
rules:'selectRequired'
2025-06-26 18:04:51 +08:00
},
{
label: '建筑面积',
2025-06-26 18:04:51 +08:00
fieldName: 'area',
component: 'InputNumber',
componentProps:{
min:0,
},
rules:'required'
2025-06-26 18:04:51 +08:00
},
{
label: '使用面积',
fieldName: 'insideInArea',
component: 'InputNumber',
componentProps:{
min:0,
2025-06-28 22:49:40 +08:00
},
rules:'required'
2025-06-26 18:04:51 +08:00
},
{
label: '是否重要',
fieldName: 'isMatter',
component: 'Select',
componentProps: {
options: getDictOptions('wy_fjzydj'),
},
rules:'selectRequired'
2025-06-26 18:04:51 +08:00
},
{
2025-06-28 02:41:09 +08:00
label: '状态',
2025-06-26 18:04:51 +08:00
fieldName: 'status',
component: 'Select',
2025-06-28 22:49:40 +08:00
componentProps: {
getPopupContainer,
options: getDictOptions(DictEnum.wy_fjzt),
},
rules:'selectRequired'
},
{
label: '房间图片',
fieldName: 'imgUrl',
component: 'ImageUpload',
componentProps: {
maxCount: 1, // 最大上传文件数 默认为1 为1会绑定为string而非string[]类型
},
formItemClass: 'col-span-2',
2025-06-26 18:04:51 +08:00
},
];