import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' // 表单校验 export const ItemRules = reactive({ name: [ { required: true, message: '请输入备件名称', trigger: 'blur' }, { max: 50, message: '不得超过50个字符', trigger: 'blur' } ], uom: [ { required: true, message: '请选择备件单位', trigger: 'blur' }, { max: 50, message: '不得超过50个字符', trigger: 'blur' } ], maxInventory: [ { required: true, message: '请输入最高库存', trigger: 'blur' } ], minInventory: [ { required: true, message: '请输入最高库存', trigger: 'blur' } ], }) export const Item = useCrudSchemas(reactive([ { label: '零件编码', field: 'number', sort: 'custom', isSearch: true, table: { width: 180, fixed: 'left' }, }, { label: '零件名称', field: 'name', sort: 'custom', isSearch: true, table: { width: 110 }, }, { label: '规格型号', field: 'specifications', sort: 'custom', isSearch: false, table: { width: 110 }, }, { label: '单位', field: 'uom', sort: 'custom', isSearch: false, table: { width: 110 }, }, { label: '供应商名称', field: 'supplierName', sort: 'custom', isSearch: false, table: { width: 130 }, }, { label: '生产厂家', field: 'brand', sort: 'custom', isSearch: false, table: { width: 110 }, }, { label: '最高库存', field: 'maxInventory', sort: 'custom', isSearch: false, form: { component: 'InputNumber', value: 0 }, table: { width: 110 }, }, { label: '最低库存', field: 'minInventory', sort: 'custom', isSearch: false, form: { component: 'InputNumber', value: 0 }, table: { width: 110 }, }, { label: '采购周期(周)', field: 'procurementCycle', sort: 'custom', isSearch: false, form: { component: 'InputNumber', value: 0 }, table: { width: 150 }, }, { label: 'ABC分类', field: 'classification', sort: 'custom', isSearch: false, table: { width: 110 }, }, { label: '使用地点', field: 'usePlace', sort: 'custom', isSearch: false, table: { width: 110 }, }, { label: '项目', field: 'project', sort: 'custom', isSearch: false, table: { width: 110 }, }, { label: '价格', field: 'price', sort: 'custom', isSearch: false, table: { width: 110 }, }, { label: '描述', field: 'describes', sort: 'custom', isSearch: false, table: { width: 110 }, }, { label: '创建时间', field: 'createTime', sort: 'custom', formatter: dateFormatter, isSearch: false, search: { component: 'DatePicker', componentProps: { valueFormat: 'YYYY-MM-DD HH:mm:ss', type: 'daterange', defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] } }, isForm: false, table: { width: 180 }, }, { label: '操作', field: 'action', isForm: false, table: { width: 150, fixed: 'right' } } ]))