import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' import * as ItembasicApi from '@/api/wms/itembasic' import { Itembasic } from '../itembasic/itembasic.data' // 表单校验 export const ProductionitemcodeSpareitemcodeRules = reactive({ productionItemCode: [required], spareItemCode: [required], available: [required], }) export const ProductionitemcodeSpareitemcode = useCrudSchemas(reactive([ { label: '量产件', field: 'productionItemCode', sort: 'custom', isSearch: true, form: { // labelMessage: '信息提示说明!!!', componentProps: { enterSearch: true, //可输入回车 isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择物料代码', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '物料基础信息', // 查询弹窗标题 searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类 searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法 searchCondition: [{ key: 'available', value: 'TRUE', isMainValue: false },{ key: 'category', value: 'LCJ', isMainValue: false },{ key: 'type', value: 'CCP', isMainValue: false }], verificationParams: [{ key: 'code', action: '==', value: '', isMainValue: false, isSearch: 'true', isFormModel: true }], // 失去焦点校验参数 } } }, { label: '备件', field: 'spareItemCode', sort: 'custom', isSearch: true, form: { // labelMessage: '信息提示说明!!!', componentProps: { enterSearch: true, //可输入回车 isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择物料代码', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '物料基础信息', // 查询弹窗标题 searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类 searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法 searchCondition: [{ key: 'available', value: 'TRUE', isMainValue: false },{ key: 'category', value: 'BJ', isMainValue: false },{ key: 'type', value: 'CCP', isMainValue: false }], verificationParams: [{ key: 'code', action: '==', value: '', isMainValue: false, isSearch: 'true', isFormModel: true }], // 失去焦点校验参数 } } }, { label: '是否可用', field: 'available', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', sort: 'custom', table: { width: 150 }, form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } } }, { label: '备注', field: 'remark', sort: 'custom', isSearch: true, }, { label: '创建时间', field: 'createTime', sort: 'custom', formatter: dateFormatter, isSearch: true, 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: 'creator', sort: 'custom', isForm: false, isTable: true, table: { width: 150 }, }, { label: '最后更新时间', field: 'updateTime', sort: 'custom', formatter: dateFormatter, isForm: false, isTable: true, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, table: { width: 150 }, }, { label: '最后更新者', field: 'updater', sort: 'custom', isForm: false, isTable: true, table: { width: 150 }, }, { label: '操作', field: 'action', isForm: false, table: { width: 150, fixed: 'right' } } ]))