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: 'title', label: '标题', }, { component: 'Input', fieldName: 'applicat', label: '申请人id', }, { component: 'Input', fieldName: 'phone', label: '申请人手机号', }, { component: 'Input', fieldName: 'supplier', label: '供应商id', }, { component: 'Input', fieldName: 'capitalId', label: '资产id', }, { component: 'Select', componentProps: {}, fieldName: 'buyType', label: '采购方式', }, { component: 'Input', fieldName: 'buyUnitPrice', label: '采购单价', }, { component: 'Input', fieldName: 'buyAmount', label: '采购金额', }, { component: 'Select', componentProps: { // 可选从DictEnum中获取 DictEnum.WY_ZCSQSHZT 便于维护 options: getDictOptions('wy_zcsqshzt'), }, fieldName: 'state', label: '状态', }, { component: 'DatePicker', componentProps: { showTime: true, format: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'YYYY-MM-DD HH:mm:ss', }, fieldName: 'applicationTime', 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: '标题', field: 'title', }, { title: '申请人id', field: 'applicat', }, { title: '申请人手机号', field: 'phone', }, { title: '供应商id', field: 'supplier', }, { title: '资产id', field: 'capitalId', }, { title: '采购方式', field: 'buyType', }, { title: '采购单价', field: 'buyUnitPrice', }, { title: '采购金额', field: 'buyAmount', }, { title: '状态', field: 'state', slots: { default: ({ row }) => { // 可选从DictEnum中获取 DictEnum.WY_ZCSQSHZT 便于维护 return renderDict(row.state, 'wy_zcsqshzt'); }, }, }, { title: '备注', field: 'remark', }, { title: '申请时间', field: 'applicationTime', }, { 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: '标题', fieldName: 'title', component: 'Input', rules: 'required', }, { label: '申请人id', fieldName: 'applicat', component: 'Input', rules: 'required', }, { label: '申请人手机号', fieldName: 'phone', component: 'Input', rules: 'required', }, { label: '供应商id', fieldName: 'supplier', component: 'Input', rules: 'required', }, { label: '资产id', fieldName: 'capitalId', component: 'Input', rules: 'required', }, { label: '采购方式', fieldName: 'buyType', component: 'Select', componentProps: {}, rules: 'selectRequired', }, { label: '采购单价', fieldName: 'buyUnitPrice', component: 'Input', }, { label: '采购金额', fieldName: 'buyAmount', component: 'Input', }, { label: '状态', fieldName: 'state', component: 'Select', componentProps: { // 可选从DictEnum中获取 DictEnum.WY_ZCSQSHZT 便于维护 options: getDictOptions('wy_zcsqshzt'), }, }, { label: '备注', fieldName: 'remark', component: 'Input', }, { label: '申请时间', fieldName: 'applicationTime', component: 'DatePicker', componentProps: { showTime: true, format: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'YYYY-MM-DD HH:mm:ss', }, }, { label: '搜索值', fieldName: 'searchValue', component: 'Input', }, ];