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: '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: 'insideInArea', }, { title: '是否重要', field: 'isMatter', slots:{ default:({row})=>{ return renderDict(row.isMatter,'wy_fjzydj') } } }, { 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', formItemClass: 'col-span-2', }, { label: '房间号', fieldName: 'roomNumber', component: 'Input', rules: 'required', }, { label: '房间类型', fieldName: 'roomType', component: 'Select', componentProps: { getPopupContainer, options: getDictOptions(DictEnum.wy_room_type), }, rules:'selectRequired' }, { label: '建筑面积', fieldName: 'area', component: 'InputNumber', componentProps:{ min:0, }, rules:'required' }, { label: '使用面积', fieldName: 'insideInArea', component: 'InputNumber', componentProps:{ min:0, }, rules:'required' }, { label: '是否重要', fieldName: 'isMatter', component: 'Select', componentProps: { options: getDictOptions('wy_fjzydj'), }, rules:'selectRequired' }, { label: '状态', fieldName: 'status', component: 'Select', 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', }, ];