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: 'classificationId', label: '分类id', }, { component: 'Input', fieldName: 'roomBookId', label: '预订id', }, { component: 'Input', fieldName: 'serveNum', label: '服务数量', }, { component: 'Input', fieldName: 'serveType', label: '服务分类', }, { component: 'Input', fieldName: 'serveName', label: '产品名称', }, { component: 'RadioGroup', componentProps: { // 可选从DictEnum中获取 DictEnum.WY_QRZT 便于维护 options: getDictOptions('wy_qrzt'), buttonStyle: 'solid', optionType: 'button', }, fieldName: 'serveStatus', label: '预订状态', }, { component: 'DatePicker', componentProps: { showTime: true, format: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'YYYY-MM-DD HH:mm:ss', }, fieldName: 'beginTime', label: '服务开始时间', }, { component: 'DatePicker', componentProps: { showTime: true, format: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'YYYY-MM-DD HH:mm:ss', }, fieldName: 'endTime', label: '服务结束时间', }, { component: 'Input', fieldName: 'servePrice', label: '服务总价格', }, { component: 'Input', fieldName: 'serveImage', label: '产品图片', }, { component: 'Input', fieldName: 'sort', label: '排序', }, ]; // 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新 // export const columns: () => VxeGridProps['columns'] = () => [ export const columns: VxeGridProps['columns'] = [ { type: 'checkbox', width: 60 }, { title: '分类id', field: 'classificationId', }, { title: '预订id', field: 'roomBookId', }, { title: '服务数量', field: 'serveNum', }, { title: '服务分类', field: 'serveType', slots: { default: ({ row }) => { // 可选从DictEnum中获取 DictEnum.WY_FWFL 便于维护 return renderDict(row.serveType, 'wy_fwfl'); }, }, }, { title: '产品名称', field: 'serveName', }, { title: '预订状态', field: 'serveStatus', slots: { default: ({ row }) => { // 可选从DictEnum中获取 DictEnum.WY_QRZT 便于维护 return renderDict(row.serveStatus, 'wy_qrzt'); }, }, }, { title: '服务开始时间', field: 'beginTime', }, { title: '服务结束时间', field: 'endTime', }, { title: '服务总价格', field: 'servePrice', }, { title: '产品图片', field: 'serveImage', }, { title: '排序', field: 'sort', }, { 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: '分类id', fieldName: 'classificationId', component: 'Input', rules: 'required', }, { label: '预订id', fieldName: 'roomBookId', component: 'Input', rules: 'required', }, { label: '服务数量', fieldName: 'serveNum', component: 'Input', rules: 'required', }, { label: '服务分类', fieldName: 'serveType', component: 'Input', rules: 'required', }, { label: '产品名称', fieldName: 'serveName', component: 'Input', rules: 'required', }, { label: '预订状态', fieldName: 'serveStatus', component: 'RadioGroup', componentProps: { // 可选从DictEnum中获取 DictEnum.WY_QRZT 便于维护 options: getDictOptions('wy_qrzt'), buttonStyle: 'solid', optionType: 'button', }, rules: 'selectRequired', }, { label: '服务开始时间', fieldName: 'beginTime', component: 'DatePicker', componentProps: { showTime: true, format: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'YYYY-MM-DD HH:mm:ss', }, rules: 'required', }, { label: '服务结束时间', fieldName: 'endTime', component: 'DatePicker', componentProps: { showTime: true, format: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'YYYY-MM-DD HH:mm:ss', }, rules: 'required', }, { label: '服务总价格', fieldName: 'servePrice', component: 'Input', rules: 'required', }, { label: '产品图片', fieldName: 'serveImage', component: 'ImageUpload', componentProps: { // accept: 'image/*', // 可选拓展名或者mime类型 ,拼接 // maxCount: 1, // 最大上传文件数 默认为1 为1会绑定为string而非string[]类型 }, rules: 'required', }, { label: '排序', fieldName: 'sort', component: 'Input', rules: 'required', }, ];