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: 'carNumber', label: '车牌号', }, { component: 'Input', fieldName: 'personId', label: '业主', }, { component: 'Select', componentProps: { // 可选从DictEnum中获取 DictEnum.WY_CSZT 便于维护 options: getDictOptions('wy_cszt'), }, fieldName: 'state', label: '状态', }, ]; // 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新 // export const columns: () => VxeGridProps['columns'] = () => [ export const columns: VxeGridProps['columns'] = [ { type: 'checkbox', width: 60 }, { title: '序号', field: 'id', slots: { default: ({ rowIndex }) => { return (rowIndex + 1).toString(); }, }, }, { title: '车牌号', field: 'carNumber', }, { title: '车位', field: 'location', }, { title: '业主', field: 'personId', }, { title: '状态', field: 'state', slots: { default: ({ row }) => { // 可选从DictEnum中获取 DictEnum.WY_CSZT 便于维护 return renderDict(row.state, 'wy_cszt'); }, }, }, { title: '收费项目', field: 'costItemsId', }, { title: '计费开始时间', field: 'starTime', }, { title: '计费结束时间', field: 'endTime', }, { title: '说明', field: 'remark', }, { field: 'action', fixed: 'right', slots: { default: 'action' }, title: '操作', width: 180, }, ]; //详情 export const modalSchema: FormSchemaGetter = () => [ { label: '主键', fieldName: 'id', component: 'Input', dependencies: { show: () => false, triggerFields: [''], }, }, { label: '车牌号', fieldName: 'carNumber', component: 'Input', rules: 'required', }, { label: '业主', fieldName: 'personId', component: 'Input', }, { label: '楼层', fieldName: 'floorId', component: 'Input', rules: 'required', }, { label: '车位', fieldName: 'location', component: 'Input', }, { label: '状态', fieldName: 'state', component: 'Select', componentProps: { // 可选从DictEnum中获取 DictEnum.WY_CSZT 便于维护 options: getDictOptions('wy_cszt'), }, }, { label: '收费项目', fieldName: 'costItemsId', component: 'Input', }, { label: '计费开始时间', fieldName: 'starTime', component: 'DatePicker', componentProps: { showTime: true, format: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'YYYY-MM-DD HH:mm:ss', }, }, { label: '计费结束时间', fieldName: 'endTime', component: 'DatePicker', componentProps: { showTime: true, format: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'YYYY-MM-DD HH:mm:ss', }, }, { label: '说明', fieldName: 'remark', component: 'Input', }, { label: '搜索值', fieldName: 'searchValue', component: 'Input', }, ]; //创建 export const addModalSchema: FormSchemaGetter = () => [ { label: '主键', fieldName: 'id', component: 'Input', dependencies: { show: () => false, triggerFields: [''], }, }, { label: '车牌号', fieldName: 'carNumber', component: 'Input', rules: 'required', }, // { // label: '费用类型',//一个费用下有对各费用项目 // fieldName: 'personId', // component: 'Input', // }, { label: '收费项目',//一个费用收费项目对应一个费用类型 fieldName: 'costItemsId', component: 'Input', rules: 'required', }, { label: '计费开始时间', fieldName: 'starTime', component: 'DatePicker', rules: 'required', componentProps: { showTime: true, format: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'YYYY-MM-DD HH:mm:ss', }, }, { label: '计费结束时间', fieldName: 'endTime', component: 'DatePicker', rules:'required', componentProps: { showTime: true, format: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'YYYY-MM-DD HH:mm:ss', }, }, { label: '说明', fieldName: 'remark', component: 'Input', }, ]; //缴费 export const payModalSchema: FormSchemaGetter = () => [ { label: '主键', fieldName: 'id', component: 'Input', dependencies: { show: () => false, triggerFields: [''], }, }, { label: '车牌号', fieldName: 'carNumber', component: 'Input', rules: 'required', }, // { // label: '费用类型',//一个费用下有对各费用项目 // fieldName: 'personId', // component: 'Input', // }, { label: '收费项目',//一个费用收费项目对应一个费用类型 fieldName: 'costItemsId', component: 'Input', rules: 'required', }, { label: '计费开始时间', fieldName: 'starTime', component: 'DatePicker', rules: 'required', componentProps: { showTime: true, format: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'YYYY-MM-DD HH:mm:ss', }, }, { label: '计费结束时间', fieldName: 'endTime', component: 'DatePicker', rules:'required', componentProps: { showTime: true, format: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'YYYY-MM-DD HH:mm:ss', }, }, { label: '说明', fieldName: 'remark', component: 'Input', }, { label: '支付方式', fieldName: 'carNumber', component: 'Input', rules: 'required', }, { label: '缴费周期', fieldName: 'personId', component: 'Input', }, { label: '实收金额', fieldName: 'costItemsId', component: 'Input', }, { label: '自定义周期', fieldName: 'remark', component: 'Input', }, ]; export const detailColumns: VxeGridProps['columns'] = [ { title: '序号', field: 'id', slots: { default: ({ rowIndex }) => { return (rowIndex + 1).toString(); }, }, }, { title: '费用项目', field: 'carNumber', }, { title: '费用标识', field: 'location', }, { title: '应收金额', field: 'personId', }, { title: '状态', field: 'state', slots: { default: ({ row }) => { // 可选从DictEnum中获取 DictEnum.WY_CSZT 便于维护 return renderDict(row.state, 'wy_cszt'); }, }, }, { title: '建帐时间', field: 'starTime', }, { title: '应收时间', field: 'endTime', }, { title: '说明', field: 'remark', }, { field: 'action', fixed: 'right', slots: { default: 'action' }, title: '操作', width: 180, }, ];