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: 'code', label: '流程编号', }, { component: 'Input', fieldName: 'name', label: '流程名称', }, { component: 'Select', componentProps: { // 可选从DictEnum中获取 DictEnum.WY_LCZT 便于维护 options: getDictOptions('wy_lczt'), }, fieldName: 'status', label: '流程状态(0:审批不通过,1:审批通过,2:审批中,3已取消)', }, { component: 'Input', fieldName: 'currentApprover', label: '当前审批人', }, { component: 'Input', fieldName: 'workflowSuggestion', 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: 'searchValue', label: '搜索值', }, ]; // 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新 // export const columns: () => VxeGridProps['columns'] = () => [ export const columns: VxeGridProps['columns'] = [ { type: 'checkbox', width: 60 }, { title: '主键id', field: 'id', }, { title: '流程编号', field: 'code', }, { title: '流程名称', field: 'name', }, { title: '流程状态(0:审批不通过,1:审批通过,2:审批中,3已取消)', field: 'status', slots: { default: ({ row }) => { // 可选从DictEnum中获取 DictEnum.WY_LCZT 便于维护 return renderDict(row.status, 'wy_lczt'); }, }, }, { title: '当前审批人', field: 'currentApprover', }, { title: '审批建议', field: 'workflowSuggestion', }, { title: '结束时间', field: 'endTime', }, { title: '搜索值', field: 'searchValue', }, { 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: 'code', component: 'Input', }, { label: '流程名称', fieldName: 'name', component: 'Input', }, { label: '流程状态(0:审批不通过,1:审批通过,2:审批中,3已取消)', fieldName: 'status', component: 'Select', componentProps: { // 可选从DictEnum中获取 DictEnum.WY_LCZT 便于维护 options: getDictOptions('wy_lczt'), }, }, { label: '当前审批人', fieldName: 'currentApprover', component: 'Input', }, { label: '审批建议', fieldName: 'workflowSuggestion', component: 'Input', }, { label: '结束时间', fieldName: 'endTime', component: 'DatePicker', componentProps: { showTime: true, format: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'YYYY-MM-DD HH:mm:ss', }, }, { label: '搜索值', fieldName: 'searchValue', component: 'Input', }, ];