import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' const { t } = useI18n() // 国际化 /** * @returns {Array} 客户物品 */ export const Customeritem = useCrudSchemas(reactive([ { label: '客户代码', field: 'customerCode', sort: 'custom', table: { width: 150, fixed: 'left' }, isSearch: true }, { label: '物料代码', field: 'itemCode', sort: 'custom', table: { width: 150 }, isSearch: true }, { label: '客户物料代码', field: 'customerItemCode', sort: 'custom', table: { width: 150 }, isSearch: true }, { label: '客户计量单位', field: 'cusotmerUom', dictType: DICT_TYPE.UOM, dictClass: 'string', isTable: true, sort: 'custom', table: { width: 150 }, }, { label: '转换率', field: 'convertRate', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', }, }, { label: '客户包装单位', field: 'packUnit', dictType: DICT_TYPE.PACK_UNIT, dictClass: 'string', isTable: true, sort: 'custom', table: { width: 150 }, }, { label: '客户包装量', field: 'packQty', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', }, }, { label: '客户替代包装单位', field: 'altPackUnit', dictType: DICT_TYPE.PACK_UNIT, dictClass: 'string', isTable: true, sort: 'custom', table: { width: 150 }, }, { label: '客户替代包装量', field: 'altPackQty', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', }, }, { label: '每器具包装数', field: 'packQtyOfContainer', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', }, }, { label: '是否可用', field: 'available', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isTable: true, sort: 'custom', table: { width: 150 }, form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } }, isSearch: true }, { label: '生效时间', field: 'activeTime', isTable: true, formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, sort: 'custom', table: { width: 150 }, form: { component: 'DatePicker', componentProps: { 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: 150 }, form: { component: 'DatePicker', componentProps: { 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: 150 }, form: { component: 'DatePicker', componentProps: { type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } }, isTable: false, isForm: false }, { label: '创建者', field: 'creator', sort: 'custom', table: { width: 150 }, isTable: false, isForm: false }, { label: '操作', field: 'action', isDetail: false, isForm: false , table: { width: 150, fixed: 'right' } } ])) //表单校验 export const CustomeritemRules = reactive({ customerCode: [ { required: true, message: '请输入客户代码', trigger: 'blur' } ], itemCode: [ { required: true, message: '请输入物品代码', trigger: 'blur' } ], packUnit: [ { required: true, message: '请选择客户包装单位', trigger: 'change' } ], packQty: [ { required: true, message: '请输入客户包装量', trigger: 'blur' } ], packQtyOfContainer: [ { required: true, message: '请输入每器具包装数', trigger: 'blur' } ], available: [ { required: true, message: '请选择是否可用', trigger: 'change' } ], })