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' } ], classification: [{ required: true, message: '请选择备件分类', trigger: 'blur' }] }) export const Item = useCrudSchemas( reactive([ { label: '备件编号', field: 'number', sort: 'custom', isSearch: true, isForm: false, table: { width: 180, fixed: 'left' } }, { label: '备件名称', field: 'name', sort: 'custom', isSearch: true, table: { width: 110 } }, { label: '规格', field: 'specifications', sort: 'custom' }, { label: '是否常储', field: 'isConstant', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isSearch: false, isTable: true, sort: 'custom', table: { width: 110 }, tableForm: { type: 'Select', inactiveValue: 'FALSE', disabled: true }, form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } } }, { label: '科目', field: 'subject', sort: 'custom', dictType: DICT_TYPE.SUBJECT, dictClass: 'string', isSearch: false, isTable: true, tableForm: { type: 'Select' } }, { label: '科目代码', field: 'subjectCode', sort: 'custom', isTable: true }, { label: '单位', field: 'uom', sort: 'custom', dictType: DICT_TYPE.UOM, dictClass: 'string', isSearch: false, isTable: true, tableForm: { type: 'Select' } }, { label: '类别', field: 'category', sort: 'custom', dictType: DICT_TYPE.ITEM_CATEGORY, dictClass: 'string', isSearch: false, isTable: true, tableForm: { type: 'Select' } }, { label: '备件分类', field: 'classification', sort: 'custom', dictType: DICT_TYPE.PART_CLASS, dictClass: 'string', isSearch: false, isTable: true, tableForm: { type: 'Select' } }, { label: '区域', field: 'region', sort: 'custom', dictType: DICT_TYPE.REGION, dictClass: 'string', isSearch: false, isTable: true, tableForm: { type: 'Select' } }, { label: '重采购点', field: 'reprocurement', sort: 'custom', table: { width: 110 }, form: { component: 'InputNumber', value: 0 } }, { label: '安全库存', field: 'safetyStock', sort: 'custom', table: { width: 110 }, form: { component: 'InputNumber', value: 0 } }, { label: '成本中心', field: 'cost', sort: 'custom', table: { width: 110 } }, { label: '采购员', field: 'purchaser', sort: 'custom', table: { width: 100 } }, { label: '财务', field: 'financer', sort: 'custom' }, { label: '是否以旧换新', field: 'isRadeIn', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isSearch: false, isTable: true, sort: 'custom', table: { width: 140 }, tableForm: { type: 'Select', inactiveValue: 'FALSE', disabled: true }, form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } } }, { label: '是否框架协议', field: 'isFramework', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isSearch: false, isTable: true, sort: 'custom', table: { width: 140 }, tableForm: { type: 'Select', inactiveValue: 'FALSE', disabled: true }, form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } } }, // { // label: '是否可用', // field: 'available', // dictType: DICT_TYPE.TRUE_FALSE, // dictClass: 'string', // isSearch: false, // isTable: true, // sort: 'custom', // table: { // width: 150 // }, // tableForm: { // type: 'Select', // inactiveValue: 'FALSE', // disabled: true // }, // form: { // component: 'Switch', // value: 'TRUE', // componentProps: { // inactiveValue: 'FALSE', // activeValue: 'TRUE' // } // } // }, { label: '创建时间', field: 'createTime', sort: 'custom', formatter: dateFormatter, isForm: false, table: { width: 170 } }, { label: '描述', field: 'describes', sort: 'custom' }, { label: '图片', field: 'upload', isTable: true }, { label: '文件', field: 'filePathListView', sort: 'custom', isTable: false, table: {}, form: { component: 'UploadFile', componentProps: {} } }, { label: '文件', field: 'filePathList', sort: 'custom', isTable: false, isForm: false, table: {}, form: { component: 'UploadFile', componentProps: {} } }, { label: '操作', field: 'action', isForm: false, table: { width: 180, fixed: 'right' } } ]) ) export const ItemSearchTable = useCrudSchemas( reactive([ { label: '备件编号', field: 'number', sort: 'custom', isSearch: true, isForm: false, table: { fixed: 'left' } }, { label: '备件名称', field: 'name', sort: 'custom', isSearch: true, table: {} }, { label: '数量', field: 'qty', sort: 'custom' } ]) )