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

150 lines
3.0 KiB
TypeScript

import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
import { getPopupContainer } from '@vben/utils';
import { getDictOptions } from '#/utils/dict';
import { DictEnum } from '@vben/constants';
import { renderDict } from '#/utils/render';
export const querySchema: FormSchemaGetter = () => [
{
component: 'Input',
fieldName: 'communityName',
label: '社区',
},
{
component: 'Input',
fieldName: 'orientation',
label: '朝向',
componentProps: {
getPopupContainer,
options: getDictOptions(DictEnum.wy_direction_towards),
},
},
{
component: 'Select',
componentProps: {
getPopupContainer,
options: getDictOptions(DictEnum.wy_fjzt),
},
fieldName: 'status',
label: '状态',
},
];
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{
title: '房间号',
field: 'roomNumber',
},
{
title: '房间类型',
field: 'roomTypeName',
},
{
title: '面积',
field: 'area',
},
{
title: '户型',
field: 'layout',
},
{
title: '朝向',
field: 'orientationName',
},
{
title: '是否可售',
field: 'isForSale',
slots: {
default: ({ row }) => {
return renderDict(row.isForSale, DictEnum.wy_sf);
},
},
},
{
title: '状态',
field: 'statusName',
},
{
field: 'action',
fixed: 'right',
slots: { default: 'action' },
title: '操作',
width: 180,
},
];
export const modalSchema: FormSchemaGetter = () => [
{
label: '',
fieldName: 'id',
component: 'Input',
dependencies: {
show: () => false,
triggerFields: [''],
},
},
{
component: 'TreeSelect',
fieldName: 'floorId',
defaultValue: undefined,
label: '社区建筑',
rules: 'selectRequired',
},
{
label: '房间号',
fieldName: 'roomNumber',
component: 'Input',
rules: 'required',
},
{
label: '房间类型',
fieldName: 'roomType',
component: 'Select',
componentProps: {
getPopupContainer,
options: getDictOptions(DictEnum.wy_room_type),
},
},
{
label: '面积',
fieldName: 'area',
component: 'Input',
},
{
label: '户型',
fieldName: 'layout',
component: 'Input',
},
{
label: '朝向',
fieldName: 'orientation',
component: 'Select',
componentProps: {
getPopupContainer,
options: getDictOptions(DictEnum.wy_direction_towards),
},
},
{
label: '是否可售',
fieldName: 'isForSale',
component: 'Select',
componentProps: {
getPopupContainer,
options: getDictOptions(DictEnum.wy_sf),
},
},
{
label: '状态',
fieldName: 'status',
component: 'Select',
componentProps: {
getPopupContainer,
options: getDictOptions(DictEnum.wy_fjzt),
},
},
];