import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import * as LocationApi from '@/api/wms/location' import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data' import * as SparePartApi from '@/api/eam/sparePart' import { SparePart } from '@/views/eam/sparePart/sparePart.data' import { dateFormatter } from '@/utils/formatTime' // 表单校验 export const ItemAccountsRules = reactive({ itemNumber: [required], singlePrice: [required], locationNumber: [required], qty: [required] }) export const ItemAccounts = useCrudSchemas( reactive([ { label: '备件编号', field: 'itemNumber', sort: 'custom', table: { width: 180, fixed: 'left' }, isSearch: false, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择备件编号', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '编号信息', // 查询弹窗标题 searchAllSchemas: SparePart.allSchemas, // 查询弹窗所需类 searchPage: SparePartApi.getSparePartPage, // 查询弹窗所需分页方法 searchCondition: [ // { // key: 'warehouseCode', // value: 'warehouseCode', // message: '请填写仓库代码!', // isMainValue: true // }, { key: 'available', value: 'TRUE', isMainValue: false } ] } } }, { label: '备件名称', field: 'name', sort: 'custom', isSearch: true, isForm: true, table: { width: 150 }, form: { componentProps: { disabled: true } } }, { label: '单价', field: 'singlePrice', sort: 'custom', isSearch: false, form: { component: 'InputNumber', value: 0 } }, { label: '库存数量', field: 'qty', sort: 'custom', isSearch: false, form: { component: 'InputNumber', value: 0 } }, { label: '库位编号', field: 'locationNumber', sort: 'custom', table: { width: 150 }, isSearch: true, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择库位编号', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '库位信息', // 查询弹窗标题 searchAllSchemas: Location.allSchemas, // 查询弹窗所需类 searchPage: LocationApi.getLocationPage, // 查询弹窗所需分页方法 searchCondition: [ // { // key: 'warehouseCode', // value: 'warehouseCode', // message: '请填写仓库代码!', // isMainValue: true // }, { key: 'available', value: 'TRUE', isMainValue: false } ] } } }, { label: '库区编号', field: 'areaNumber', sort: 'custom', isSearch: true, table: { width: 180 }, form: { componentProps: { disabled: true } } }, { label: '品牌', field: 'brand', sort: 'custom', isSearch: false, form: { componentProps: { disabled: true } } }, { label: '规格型号', field: 'specifications', sort: 'custom', isSearch: false, form: { componentProps: { disabled: true } } }, { label: '是否全局', field: 'isOverall', sort: 'custom', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 isSearch: false, form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE', disabled: true } } }, { label: '科目', field: 'subject', sort: 'custom', dictType: DICT_TYPE.SUBJECT, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 isSearch: false, form: { component: 'Select', componentProps: { disabled: true } } }, { label: '科目代码', field: 'subjectCode', sort: 'custom', isSearch: false, form: { componentProps: { disabled: true } } }, { label: '类别', field: 'type', sort: 'custom', isSearch: false, form: { componentProps: { disabled: true } } }, { label: '区域', field: 'region', sort: 'custom', dictType: DICT_TYPE.REGION, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 isSearch: false, form: { component: 'Select', componentProps: { disabled: true } } }, { label: '备件分类', field: 'classification', sort: 'custom', dictType: DICT_TYPE.PART_CLASS, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 isSearch: false, form: { component: 'Select', componentProps: { disabled: true } } }, { label: '计量单位', field: 'uom', sort: 'custom', dictType: DICT_TYPE.UOM, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 isSearch: false, form: { componentProps: { disabled: true } } }, { label: '生产厂家', field: 'manufacturer', sort: 'custom', isSearch: false, form: { componentProps: { disabled: true } } }, { label: '库存下限', field: 'minInventory', sort: 'custom', isSearch: false, form: { component: 'InputNumber', value: 0, componentProps: { disabled: true } } }, { label: '库存上限', field: 'maxInventory', sort: 'custom', isSearch: false, form: { component: 'InputNumber', value: 0, componentProps: { disabled: true } } }, { label: '更换周期', field: 'replacementCycle', sort: 'custom', isSearch: false, form: { component: 'InputNumber', value: 0, componentProps: { disabled: true } } }, { label: '存放位置描述', field: 'storageLocation', sort: 'custom', isSearch: false, form: { componentProps: { disabled: true } } }, { label: '备注', field: 'remark', sort: 'custom', isSearch: false, componentProps: { disabled: true } }, { label: '是否可用', field: 'available', sort: 'custom', isSearch: false, isTable: false, isForm: false, isDetail: false, componentProps: { disabled: true } }, { label: '操作', field: 'action', isForm: false, table: { width: 150, fixed: 'right' } } ]) )