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.

186 lines
3.6 KiB

import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
const { t } = useI18n() // 国际化
/**
* @returns {Array}
*/
export const Bom = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '父物料代码',
field: 'productItemCode',
isSearch: true,
sort: 'custom',
table: {
width: 150,
fixed: 'left'
}
},
{
label: '子物料代码',
field: 'componentItemCode',
isSearch: true,
sort: 'custom',
table: {
width: 150
}
},
{
label: '子物料计量单位',
field: 'componentUom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
sort: 'custom',
isSearch: true,
isTable: true,
table: {
width: 150
}
},
{
label: '子物料数量',
field: 'componentQty',
isSearch: true,
sort: 'custom',
form: {
component: 'InputNumber',
},
table: {
width: 120
}
},
{
label: '工序代码',
field: 'processCode',
sort: 'custom',
table: {
width: 120
}
},
{
label: '版本',
field: 'version',
sort: 'custom'
},
{
label: '层级',
field: 'layer',
sort: 'custom',
// form: {
// component: 'Input',
// componentProps: {
// // focus: ()=>{console.log('111111111111111111111')},
// modelValue: '11111'
// }
// }
},
{
label: '生效时间',
field: 'activeTime',
isTable: true,
sort: 'custom',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
}
}
},
{
label: '失效时间',
field: 'expireTime',
isTable: true,
sort: 'custom',
formatter : dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
}
}
},
{
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: 'createTime',
isTable: true,
sort: 'custom',
formatter: dateFormatter,
isForm: false,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 180
}
},
{
label: '创建者',
field: 'creator',
isForm: false,
isTable: false
},
{ label: '备注', field: 'remark', isTable: false },
{
label: '操作',
field: 'action',
isDetail: false,
isForm: false ,
table: {
width: 150,
fixed: 'right'
}
}
]))
//表单校验
export const BomRules = reactive({
productItemCode: [
{ required: true, message: '请输入父物料代码', trigger: 'blur' }
],
componentItemCode: [
{ required: true, message: '请输入子物料代码', trigger: 'blur' }
],
componentUom: [
{ required: true, message: '请选择子物料计量单位', trigger: 'change' }
],
componentQty: [
{ required: true, message: '请输入子物料数量', trigger: 'blur' }
],
processCode: [
{ required: true, message: '请输入工序代码', trigger: 'blur' }
],
available: [
{ required: true, message: '请选择是否可用', trigger: 'change' }
],
})