import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' // import * as AreaApi from '@/api/wms/areabasic' // import { Area } from '@/views/wms/basicDataManage/factoryModeling/areabasic/areabasic.data' import * as WarehouseApi from '@/api/spc/warehouse' import { Warehouse } from '@/views/spc/warehouse/warehouse.data' import * as LocationgroupApi from '@/api/spc/locationgroup' import { Locationgroup } from '@/views/spc/locationgroup/locationgroup.data' const { t } = useI18n() // 国际化 /** * @returns {Array} 库位 */ export const Location = useCrudSchemas(reactive([ { label: '代码', field: 'code', sort: 'custom', table: { width: 150, fixed: 'left' }, isSearch: true }, { label: '名称', field: 'name', sort: 'custom', table: { width: 150 }, }, { label: '仓库代码', field: 'warehouseCode', sort: 'custom', table: { width: 150 }, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择仓库代码', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '仓库信息', // 查询弹窗标题 searchAllSchemas: Warehouse.allSchemas, // 查询弹窗所需类 searchPage: WarehouseApi.getWarehousePage // 查询弹窗所需分页方法 } } }, { label: '库区代码', field: 'areaCode', sort: 'custom', table: { width: 150 }, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择库区代码', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '库区信息', // 查询弹窗标题 // searchAllSchemas: Area.allSchemas, // 查询弹窗所需类 // searchPage: AreaApi.getAreaPage // 查询弹窗所需分页方法 } } }, { label: '库位组代码', field: 'locationGroupCode', sort: 'custom', table: { width: 150 }, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择库区代码', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '库区信息', // 查询弹窗标题 searchAllSchemas: Locationgroup.allSchemas, // 查询弹窗所需类 searchPage: LocationgroupApi.getLocationgroupPage // 查询弹窗所需分页方法 } } }, { label: 'ERP库位代码', field: 'erpLocationCode', dictType: DICT_TYPE.ERP_LOCATION, dictClass: 'string', isSearch: true, isTable: true, sort: 'custom', table: { width: 150 } }, { label: '类型', field: 'type', dictType: DICT_TYPE.LOCATION_TYPE, dictClass: 'string', isSearch: true, isTable: true, sort: 'custom', table: { width: 150 }, }, { label: '巷道', field: 'aisle', sort: 'custom', table: { width: 150 }, }, { label: '货架', field: 'shelf', sort: 'custom', table: { width: 150 }, }, { label: '行', field: 'locationRow', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 1, precision: 6 } }, }, { label: '列', field: 'locationColum', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 1, precision: 6 } }, }, { label: '拣料优先级', field: 'pickPriority', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 1, precision: 6 } }, }, { label: '最大承重', field: 'maxWeight', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 1, precision: 6 } }, }, { label: '最大面积', field: 'maxArea', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 1, precision: 6 } }, }, { label: '最大体积', field: 'maxVolume', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 1, precision: 6 } }, }, { label: '用户组代码', field: 'userGroupCode', sort: 'custom', table: { width: 150 }, }, { label: '是否可用', field: 'available', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isTable: true, isSearch: true, sort: 'custom', table: { width: 150 }, form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } } }, { label: '生效时间', field: 'activeTime', isTable: true, formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, sort: 'custom', table: { width: 180 }, form: { component: 'DatePicker', componentProps: { style: {width:'100%'}, type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } }, }, { label: '失效时间', field: 'expireTime', isTable: true, formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, sort: 'custom', table: { width: 180 }, form: { component: 'DatePicker', componentProps: { style: {width:'100%'}, type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } }, }, { label: '备注', field: 'remark', sort: 'custom', table: { width: 150 }, }, { label: '创建时间', field: 'createTime', formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, sort: 'custom', table: { width: 180 }, form: { component: 'DatePicker', componentProps: { style: {width:'100%'}, type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } }, isForm: false, isTable: false }, { label: '创建者', field: 'creator', sort: 'custom', table: { width: 150 }, isForm: false, isTable: false }, { label: '操作', field: 'action', isDetail: false, isForm: false , table: { width: 150, fixed: 'right' } } ])) //表单校验 export const LocationRules = reactive({ code: [ { required: true, message: '请输入代码', trigger: 'blur' } ], warehouseCode: [ { required: true, message: '请输入仓库代码', trigger: 'change' } ], areaCode: [ { required: true, message: '请输入库区代码', trigger: 'change' } ], locationGroupCode: [ { required: true, message: '请输入库位组代码', trigger: 'change' } ], erpLocationCode: [ { required: true, message: '请选择ERP库位代码', trigger: 'change' } ], type: [ { required: true, message: '请选择类型', trigger: 'change' } ], pickPriority: [ { required: true, message: '请输入拣料优先级', trigger: 'blur' } ], userGroupCode: [ { required: true, message: '请输入用户组代码', trigger: 'blur' } ], available: [ { required: true, message: '请选择是否可用', trigger: 'change' } ], })