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: 'userId', label: '用户ID,关联用户表', }, { component: 'Input', fieldName: 'username', label: '申请人姓名', }, { component: 'Input', fieldName: 'departmentId', label: '部门ID,关联部门表', }, { component: 'Input', fieldName: 'departmentName', label: '部门名称', }, { component: 'Select', componentProps: { }, fieldName: 'leaveType', label: '请假类型', }, { component: 'DatePicker', componentProps: { showTime: true, format: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'YYYY-MM-DD HH:mm:ss', }, fieldName: 'startTime', 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: 'totalDuration', label: '合计时间,如3天5个小时', }, { component: 'Textarea', fieldName: 'reason', label: '请假事由', }, { component: 'Select', componentProps: { // 可选从DictEnum中获取 DictEnum.WY_SQZT 便于维护 options: getDictOptions('wy_sqzt'), }, fieldName: 'status', label: '申请状态', }, { component: 'Input', fieldName: 'searchValue', label: '搜索值', }, ]; // 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新 // export const columns: () => VxeGridProps['columns'] = () => [ export const columns: VxeGridProps['columns'] = [ { type: 'checkbox', width: 60 }, { title: '', field: 'id', }, { title: '用户ID,关联用户表', field: 'userId', }, { title: '申请人姓名', field: 'username', }, { title: '部门ID,关联部门表', field: 'departmentId', }, { title: '部门名称', field: 'departmentName', }, { title: '请假类型', field: 'leaveType', }, { title: '开始时间', field: 'startTime', }, { title: '结束时间', field: 'endTime', }, { title: '合计时间,如3天5个小时', field: 'totalDuration', }, { title: '请假事由', field: 'reason', }, { title: '申请状态', field: 'status', slots: { default: ({ row }) => { // 可选从DictEnum中获取 DictEnum.WY_SQZT 便于维护 return renderDict(row.status, 'wy_sqzt'); }, }, }, { title: '搜索值', field: 'searchValue', }, { field: 'action', fixed: 'right', slots: { default: 'action' }, title: '操作', width: 180, }, ]; export const modalSchema: FormSchemaGetter = () => [ { label: '', fieldName: 'id', component: 'Input', dependencies: { show: () => false, triggerFields: [''], }, }, { label: '用户ID,关联用户表', fieldName: 'userId', component: 'Input', }, { label: '申请人姓名', fieldName: 'username', component: 'Input', }, { label: '部门ID,关联部门表', fieldName: 'departmentId', component: 'Input', }, { label: '部门名称', fieldName: 'departmentName', component: 'Input', }, { label: '请假类型', fieldName: 'leaveType', component: 'Select', componentProps: { }, }, { label: '开始时间', fieldName: 'startTime', 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: '合计时间,如3天5个小时', fieldName: 'totalDuration', component: 'Input', }, { label: '请假事由', fieldName: 'reason', component: 'Textarea', }, { label: '申请状态', fieldName: 'status', component: 'Select', componentProps: { // 可选从DictEnum中获取 DictEnum.WY_SQZT 便于维护 options: getDictOptions('wy_sqzt'), }, }, { label: '搜索值', fieldName: 'searchValue', component: 'Input', }, ];