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: 'roomName', label: '会议室名称', }, { component: 'Input', fieldName: 'roomNo', label: '会议室编号', }, { component: 'Input', fieldName: 'roomLocation', label: '会议室位置', }, { component: 'Input', fieldName: 'roomArea', label: '会议室面积', }, { component: 'Input', fieldName: 'roomType', label: '会议室类型', }, { component: 'Input', fieldName: 'roomNumber', label: '会议室容纳人数', }, { component: 'Input', fieldName: 'roomFacilities', label: '会议室配套设施', }, { component: 'Select', componentProps: { // 可选从DictEnum中获取 DictEnum.WY_HYSJGLX 便于维护 options: getDictOptions('wy_hysjglx'), }, fieldName: 'feeType', label: '会议室价格类型', }, { component: 'Input', fieldName: 'feePrice', label: '费用金额', }, { component: 'Input', fieldName: 'responsiblePerson', label: '负责人', }, { component: 'Input', fieldName: 'contactNumber', label: '联系电话', }, { component: 'Input', fieldName: 'pictures', label: '会议室照片', }, { component: 'Input', fieldName: 'description', label: '会议室描述', }, { component: 'RadioGroup', componentProps: { // 可选从DictEnum中获取 DictEnum.WY_SF 便于维护 options: getDictOptions('wy_sf'), buttonStyle: 'solid', optionType: 'button', }, fieldName: 'review', label: '是否需要审核', }, { component: 'RadioGroup', componentProps: { // 可选从DictEnum中获取 DictEnum.WY_KG 便于维护 options: getDictOptions('wy_kg'), buttonStyle: 'solid', optionType: 'button', }, fieldName: 'enabledStatus', label: '启用状态', }, { component: 'Select', componentProps: { // 可选从DictEnum中获取 DictEnum.WY_XQ 便于维护 options: getDictOptions('wy_xq'), }, fieldName: 'openingWeek', label: '开放星期', }, { component: 'DatePicker', componentProps: { showTime: true, format: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'YYYY-MM-DD HH:mm:ss', }, fieldName: 'openingBeginTime', label: '开放开始时间', }, { component: 'DatePicker', componentProps: { showTime: true, format: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'YYYY-MM-DD HH:mm:ss', }, fieldName: 'openingEndTime', label: '开放结束时间', }, ]; // 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新 // export const columns: () => VxeGridProps['columns'] = () => [ export const columns: VxeGridProps['columns'] = [ { type: 'checkbox', width: 60 }, { title: '会议室名称', field: 'roomName', }, { title: '会议室编号', field: 'roomNo', }, { title: '会议室位置', field: 'roomLocation', }, { title: '会议室面积', field: 'roomArea', }, { title: '会议室类型', field: 'roomType', }, { title: '会议室容纳人数', field: 'roomNumber', }, { title: '会议室配套设施', field: 'roomFacilities', }, { title: '会议室价格类型', field: 'feeType', slots: { default: ({ row }) => { // 可选从DictEnum中获取 DictEnum.WY_HYSJGLX 便于维护 return renderDict(row.feeType, 'wy_hysjglx'); }, }, }, { title: '费用金额', field: 'feePrice', }, { title: '负责人', field: 'responsiblePerson', }, { title: '联系电话', field: 'contactNumber', }, { title: '会议室照片', field: 'pictures', }, { title: '会议室描述', field: 'description', }, { title: '是否需要审核', field: 'review', slots: { default: ({ row }) => { // 可选从DictEnum中获取 DictEnum.WY_SF 便于维护 return renderDict(row.review, 'wy_sf'); }, }, }, { title: '启用状态', field: 'enabledStatus', slots: { default: ({ row }) => { // 可选从DictEnum中获取 DictEnum.WY_KG 便于维护 return renderDict(row.enabledStatus, 'wy_kg'); }, }, }, { title: '开放星期', field: 'openingWeek', slots: { default: ({ row }) => { // 可选从DictEnum中获取 DictEnum.WY_XQ 便于维护 return renderDict(row.openingWeek, 'wy_xq'); }, }, }, { title: '开放开始时间', field: 'openingBeginTime', }, { title: '开放结束时间', field: 'openingEndTime', }, { field: 'action', fixed: 'right', slots: { default: 'action' }, title: '操作', width: 180, }, ]; export const modalSchema: FormSchemaGetter = () => [ { label: 'id', fieldName: 'id', component: 'Input', dependencies: { show: () => false, triggerFields: [''], }, }, { label: '会议室名称', fieldName: 'roomName', component: 'Input', rules: 'required', }, { label: '会议室编号', fieldName: 'roomNo', component: 'Input', rules: 'required', }, { label: '会议室位置', fieldName: 'roomLocation', component: 'Input', rules: 'required', }, { label: '会议室面积', fieldName: 'roomArea', component: 'Input', rules: 'required', }, { label: '会议室类型', fieldName: 'roomType', component: 'Input', rules: 'required', }, { label: '会议室容纳人数', fieldName: 'roomNumber', component: 'Input', rules: 'required', }, { label: '会议室配套设施', fieldName: 'roomFacilities', component: 'Input', rules: 'required', }, { label: '会议室价格类型', fieldName: 'feeType', component: 'Select', componentProps: { // 可选从DictEnum中获取 DictEnum.WY_HYSJGLX 便于维护 options: getDictOptions('wy_hysjglx'), }, rules: 'selectRequired', }, { label: '费用金额', fieldName: 'feePrice', component: 'Input', rules: 'required', }, { label: '负责人', fieldName: 'responsiblePerson', component: 'Input', rules: 'required', }, { label: '联系电话', fieldName: 'contactNumber', component: 'Input', rules: 'required', }, { label: '会议室照片', fieldName: 'pictures', component: 'Input', }, { label: '会议室描述', fieldName: 'description', component: 'Input', rules: 'required', }, { label: '是否需要审核', fieldName: 'review', component: 'RadioGroup', componentProps: { // 可选从DictEnum中获取 DictEnum.WY_SF 便于维护 options: getDictOptions('wy_sf'), buttonStyle: 'solid', optionType: 'button', }, rules: 'selectRequired', }, { label: '启用状态', fieldName: 'enabledStatus', component: 'RadioGroup', componentProps: { // 可选从DictEnum中获取 DictEnum.WY_KG 便于维护 options: getDictOptions('wy_kg'), buttonStyle: 'solid', optionType: 'button', }, rules: 'selectRequired', }, { label: '开放星期', fieldName: 'openingWeek', component: 'Select', componentProps: { // 可选从DictEnum中获取 DictEnum.WY_XQ 便于维护 options: getDictOptions('wy_xq'), }, rules: 'selectRequired', }, { label: '开放开始时间', fieldName: 'openingBeginTime', component: 'DatePicker', componentProps: { showTime: true, format: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'YYYY-MM-DD HH:mm:ss', }, rules: 'required', }, { label: '开放结束时间', fieldName: 'openingEndTime', component: 'DatePicker', componentProps: { showTime: true, format: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'YYYY-MM-DD HH:mm:ss', }, rules: 'required', }, ];