You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

282 lines
5.7 KiB

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'
const { t } = useI18n() // 国际化
/**
* @returns {Array}
*/
export const Itempackaging = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '物料代码',
field: 'itemCode',
sort: 'custom',
isSearch: true,
table: {
width: 150,
fixed: 'left'
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择物料代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '物料基础信息', // 查询弹窗标题
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
action: '==',
isSearch: true,
isMainValue: false
}]
}
}
},
{
label: '计量单位',
field: 'uom',
sort: 'custom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 120
}
},
{
label: '包装单位',
field: 'packUnit',
sort: 'custom',
dictType: DICT_TYPE.PACK_UNIT,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 120
}
},
{
label: '包装数量',
field: 'packQty',
sort: 'custom',
isSearch: true,
table: {
width: 120
},
form: {
component: 'InputNumber',
componentProps: {
min: 1,
precision: 6
}
}
},
{
label: '替代包装单位1',
field: 'altPackUnit1',
sort: 'custom',
dictType: DICT_TYPE.PACK_UNIT,
dictClass: 'string',
isTable: true,
table: {
width: 150
}
},
{
label: '替代包装量1',
field: 'altPackQty1',
sort: 'custom',
table: {
width: 130
},
form: {
component: 'InputNumber',
componentProps: {
min: 0,
precision: 6
}
}
},
{
label: '替代包装量2',
field: 'altPackQty2',
sort: 'custom',
table: {
width: 130
},
form: {
component: 'InputNumber',
componentProps: {
min: 0,
precision: 6
}
}
},
{
label: '替代包装单位3',
field: 'altPackUnit3',
sort: 'custom',
dictType: DICT_TYPE.PACK_UNIT,
dictClass: 'string',
isTable: true,
table: {
width: 150
}
},
{
label: '替代包装量3',
field: 'altPackQty3',
sort: 'custom',
table: {
width: 130
},
form: {
component: 'InputNumber',
componentProps: {
min: 0,
precision: 6
}
}
},
{
label: '替代包装单位4',
field: 'altPackUnit4',
sort: 'custom',
dictType: DICT_TYPE.PACK_UNIT,
dictClass: 'string',
table: {
width: 150
}
},
{
label: '替代包装量4',
field: 'altPackQty4',
sort: 'custom',
table: {
width: 130
},
form: {
component: 'InputNumber',
componentProps: {
min: 0,
precision: 6
}
}
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
table: {
width: 120
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
{
label: '生效时间',
field: 'activeTime',
sort: 'custom',
isTable: true,
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: 'expireTime',
sort: 'custom',
isTable: true,
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: 'createTime',
sort: 'custom',
isForm: false,
isTable: true,
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: 'creator',
isForm: false,
isTable: false
},
{
label: '操作',
field: 'action',
isDetail: false,
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))
// 表单校验
export const ItempackagingRules = reactive({
itemCode: [{ required: true, message: '物料代码不能为空', trigger: 'change' }],
uom: [{ required: true, message: '计量单位不能为空', trigger: 'change' }],
packUnit: [{ required: true, message: '包装单位不能为空', trigger: 'change' }],
packQty: [{ required: true, message: '包装数量不能为空', trigger: 'change' }],
available: [{ required: true, message: '是否可用不能为空', trigger: 'change' }]
})