import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import * as LocationApi from '@/api/eam/basic/location' import { Location } from '@/views/eam/basic/location/location.data' import { validateNumber } from '@/utils/validator' import { dateFormatter } from '@/utils/formatTime' // 表单校验 export const ItemInLocationRules = reactive({ number: [required], itemNumber: [required], locationNumber: [required], qty: [ required, { validator: validateNumber, message: '数量不能等于0', trigger: 'blur' }, ], returner: [ { max: 50, message: '不得超过20个字符', trigger: 'blur' }, ], }) export const ItemInLocation = useCrudSchemas(reactive([ { label: '库位编号', field: 'locationNumber', sort: 'custom', isSearch: true, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择库位编号', // 输入框占位文本 searchField: 'number', // 查询弹窗赋值字段 searchTitle: '库位信息', // 查询弹窗标题 searchAllSchemas: Location.allSchemas, // 查询弹窗所需类 searchPage: LocationApi.getLocationPage, // 查询弹窗所需分页方法 searchCondition: [ { key: 'available', value: 'TRUE', isMainValue: false } // , // { // key: 'areaNumber', // value: 'areaNumber', // isMainValue: true // }, ] } } }, { label: '库位名称', field: 'locationName', sort: 'custom', isSearch: false, isForm:false }, { label: '备件编号', field: 'itemNumber', sort: 'custom', isSearch: true, form:{ componentProps:{ disabled:true } } }, { label: '备件名称', field: 'itemName', sort: 'custom', isSearch: false, form:{ componentProps:{ disabled:true } } }, { label: '归还人', field: 'returner', sort: 'custom', isSearch: false, }, // { // label: '出库类型', // field: 'type', // sort: 'custom', // isSearch: false, // form: { // component: 'Select' // }, // }, { label: '归还数量', field: 'qty', sort: 'custom', table: { width: 110 }, form:{ component: 'InputNumber', componentProps:{ min: 0,//最小值` precision: 2//精度` } } }, { 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 }, { label: '操作', field: 'action', isForm: false, isTable:false, table: { width: 150, fixed: 'right' } } ]))