import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' import { fa } from 'element-plus/es/locale' import * as PackageunitApi from '@/api/wms/packageunit' import { Select } from '@element-plus/icons-vue/dist/types' export const Packageunit = useCrudSchemas(reactive([ { label: '包装代码', field: 'code', sort: 'custom', isSearch: true, table: { width: 150 }, }, // { // label: '父包装代码', // field: 'parentCode', // sort: 'custom', // table: { // width: 150 // }, // }, { label: '包装名称', field: 'name', sort: 'custom', isSearch: true, table: { width: 150 }, }, { label: '包装类型', field: 'type', dictType: DICT_TYPE.PACK_UNIT_TYPE, dictClass: 'string', sort: 'custom', isSearch: true, table: { width: 150 }, }, { label: '长', field: 'length', sort: 'custom', form: { component: 'InputNumber', value: 0 }, }, { label: '宽', field: 'width', sort: 'custom', form: { component: 'InputNumber', value: 0 }, }, { label: '高', field: 'height', sort: 'custom', form: { component: 'InputNumber', value: 0 }, }, { label: '重量', field: 'weight', sort: 'custom', form: { component: 'InputNumber', value: 0 }, }, { label: '单位', field: 'unit', sort: 'custom', dictType: DICT_TYPE.UOM, dictClass: 'string', isSearch: false, table: { width: 150 }, }, { label: '是否可用', field: 'available', sort: 'custom', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } }, table: { width: 150 }, }, { label: '包装描述', field: 'desc', sort: 'custom', isSearch: false, table: { width: 150 }, }, { label: '是否重复使用', field: 'reuse', sort: 'custom', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isSearch: false, form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } }, table: { width: 150 }, }, { label: '是否管理包装库存', field: 'manageBalance', sort: 'custom', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isSearch: false, form: { component: 'Switch', value: 'FALSE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } }, table: { width: 180 }, }, { label: '生效时间', field: 'activeTime', sort: 'custom', table: { width: 180 }, formatter: dateFormatter, form: { component: 'DatePicker', componentProps: { type: 'datetime', valueFormat: 'x' } }, }, { label: '失效时间', field: 'expireTime', sort: 'custom', table: { width: 180 }, formatter: dateFormatter, form: { component: 'DatePicker', componentProps: { type: 'datetime', valueFormat: 'x' } }, }, { label: '创建时间', field: 'createTime', sort: 'custom', table: { width: 180 }, formatter: dateFormatter, isForm: false, }, { label: '创建者', field: 'creator', isForm: false, isTable: true }, { label: '最后更新时间', field: 'updateTime', sort: 'custom', isDetail: true, isForm: false, isTable: false, formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, table: { width: 180 }, form: { component: 'DatePicker', componentProps: { style: {width:'100%'}, type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } } }, { label: '最后更新者', field: 'updater', isDetail: true, isForm: false, isTable: false, table: { width: 150 } }, { label: '备注', field: 'remark', sort: 'custom', table: { width: 150 }, }, { label: '删除时间', field: 'deletionTime', sort: 'custom', isForm: false, isTable: false, isDetail: false, table: { width: 180 }, formatter: dateFormatter, form: { component: 'DatePicker', componentProps: { type: 'datetime', valueFormat: 'x' } }, }, { label: '删除者', field: 'deleterId', sort: 'custom', isDetail: false, isForm: false, isTable: false, table: { width: 150 }, }, { label: '扩展属性', field: 'extraProperties', sort: 'custom', isForm: false, isDetail: false, isTable: false, table: { width: 150 }, }, { label: '并发乐观锁', field: 'concurrencyStamp', sort: 'custom', isForm: false, isDetail: false, isTable: false, table: { width: 150 }, form: { component: 'InputNumber', value: 0 }, }, { label: '地点', field: 'siteId', sort: 'custom', isForm: false, isDetail: false, isTable: false, table: { width: 150 }, }, { label: '操作', field: 'action', isForm: false, isDetail: false, table: { width: 150, fixed: 'right' } } ])) // 表单校验 export const PackageunitRules = reactive({ code: [ { required: true, message: '请输入包装代码', trigger: 'change' } ], name: [ { required: true, message: '请输入包装名称', trigger: 'change' } ], type: [ { required: true, message: '请选择包装类型', trigger: 'change' } ], desc: [ { max: 50, message: '不得超过50个字符', trigger: 'blur' }, { required: true, message: '请输入包装描述', trigger: 'change' } ], }) //新增时针对父包装代码copy出的实体 export const PackageunitCopy = useCrudSchemas(reactive([ { label: '包装代码', field: 'code', sort: 'custom', isSearch: true, table: { width: 150 }, }, { label: '父包装代码', field: 'parentCode', sort: 'custom', table: { width: 150 } }, { label: '包装名称', field: 'name', sort: 'custom', isSearch: true, table: { width: 150 }, }, { label: '包装类型', field: 'type', dictType: DICT_TYPE.PACK_UNIT_TYPE, dictClass: 'string', sort: 'custom', isSearch: true, table: { width: 150 }, }, { label: '长', field: 'length', sort: 'custom', form: { component: 'InputNumber', value: 0 }, }, { label: '宽', field: 'width', sort: 'custom', form: { component: 'InputNumber', value: 0 }, }, { label: '高', field: 'height', sort: 'custom', form: { component: 'InputNumber', value: 0 }, }, { label: '重量', field: 'weight', sort: 'custom', form: { component: 'InputNumber', value: 0 }, }, { label: '单位', field: 'unit', sort: 'custom', dictType: DICT_TYPE.PACK_UNIT, dictClass: 'string', isSearch: true, table: { width: 150 }, }, { label: '是否可用', field: 'available', sort: 'custom', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } }, table: { width: 150 }, }, { label: '包装描述', field: 'desc', sort: 'custom', isSearch: false, table: { width: 150 }, }, { label: '是否重复使用', field: 'reuse', sort: 'custom', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isSearch: false, form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } }, table: { width: 150 }, }, { label: '是否管理包装库存', field: 'manageBalance', sort: 'custom', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isSearch: false, form: { component: 'Switch', value: 'FALSE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } }, table: { width: 180 }, }, { label: '生效时间', field: 'activeTime', sort: 'custom', table: { width: 180 }, formatter: dateFormatter, form: { component: 'DatePicker', componentProps: { type: 'datetime', valueFormat: 'x' } }, }, { label: '失效时间', field: 'expireTime', sort: 'custom', table: { width: 180 }, formatter: dateFormatter, form: { component: 'DatePicker', componentProps: { type: 'datetime', valueFormat: 'x' } }, }, { label: '创建时间', field: 'createTime', sort: 'custom', table: { width: 180 }, formatter: dateFormatter, isForm: false, }, { label: '备注', field: 'remark', sort: 'custom', table: { width: 150 }, }, { label: '删除时间', field: 'deletionTime', sort: 'custom', isForm: false, isTable: false, table: { width: 180 }, formatter: dateFormatter, form: { component: 'DatePicker', componentProps: { type: 'datetime', valueFormat: 'x' } }, }, { label: '删除者', field: 'deleterId', sort: 'custom', isForm: false, isTable: false, table: { width: 150 }, }, { label: '扩展属性', field: 'extraProperties', sort: 'custom', isForm: false, isTable: false, table: { width: 150 }, }, { label: '并发乐观锁', field: 'concurrencyStamp', sort: 'custom', isForm: false, isTable: false, table: { width: 150 }, form: { component: 'InputNumber', value: 0 }, }, { label: '地点', field: 'siteId', sort: 'custom', isForm: false, isTable: false, table: { width: 150 }, }, { label: '操作', field: 'action', isForm: false, table: { width: 150, fixed: 'right' } } ]))