|
|
|
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'
|
|
|
|
|
|
|
|
import * as ProcessApi from '@/api/wms/process'
|
|
|
|
import { Process } from '../../factoryModeling/process/process.data'
|
|
|
|
|
|
|
|
const { t } = useI18n() // 国际化
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @returns {Array} 基础物料清单
|
|
|
|
*/
|
|
|
|
export const Bom = useCrudSchemas(reactive<CrudSchema[]>([
|
|
|
|
{
|
|
|
|
label: '父物料代码',
|
|
|
|
field: 'productItemCode',
|
|
|
|
isSearch: true,
|
|
|
|
sort: 'custom',
|
|
|
|
table: {
|
|
|
|
width: 150,
|
|
|
|
fixed: 'left'
|
|
|
|
},
|
|
|
|
form: {
|
|
|
|
// labelMessage: '信息提示说明!!!',
|
|
|
|
componentProps: {
|
|
|
|
enterSearch: true,
|
|
|
|
isSearchList: true, // 开启查询弹窗
|
|
|
|
searchListPlaceholder: '请选择物料代码', // 输入框占位文本
|
|
|
|
searchField: 'code', // 查询弹窗赋值字段
|
|
|
|
searchTitle: '物料基础信息', // 查询弹窗标题
|
|
|
|
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
|
|
|
|
searchPage: ItembasicApi.selectItembasicPageToFgAndSemibasicPage, // 查询弹窗所需分页方法
|
|
|
|
verificationParams: [{
|
|
|
|
key: 'code',
|
|
|
|
action: '==',
|
|
|
|
value: '',
|
|
|
|
isMainValue: false,
|
|
|
|
isSearch: 'true',
|
|
|
|
isFormModel: true
|
|
|
|
}], // 失去焦点校验参数
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '子物料代码',
|
|
|
|
field: 'componentItemCode',
|
|
|
|
isSearch: true,
|
|
|
|
sort: 'custom',
|
|
|
|
table: {
|
|
|
|
width: 150
|
|
|
|
},
|
|
|
|
form: {
|
|
|
|
// labelMessage: '信息提示说明!!!',
|
|
|
|
componentProps: {
|
|
|
|
enterSearch: true,
|
|
|
|
isSearchList: true, // 开启查询弹窗
|
|
|
|
searchListPlaceholder: '请选择物料代码', // 输入框占位文本
|
|
|
|
searchField: 'code', // 查询弹窗赋值字段
|
|
|
|
searchTitle: '物料基础信息', // 查询弹窗标题
|
|
|
|
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
|
|
|
|
searchPage: ItembasicApi.selectTypeToItembasic, // 查询弹窗所需分页方法
|
|
|
|
verificationParams: [{
|
|
|
|
key: 'code',
|
|
|
|
action: '==',
|
|
|
|
value: '',
|
|
|
|
isMainValue: false,
|
|
|
|
isSearch: 'true',
|
|
|
|
isFormModel: true
|
|
|
|
}], // 失去焦点校验参数
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
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',
|
|
|
|
componentProps: {
|
|
|
|
min: 0,
|
|
|
|
precision: 6
|
|
|
|
}
|
|
|
|
},
|
|
|
|
table: {
|
|
|
|
width: 120
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '工序代码',
|
|
|
|
field: 'processCode',
|
|
|
|
sort: 'custom',
|
|
|
|
table: {
|
|
|
|
width: 120
|
|
|
|
},
|
|
|
|
form: {
|
|
|
|
// labelMessage: '信息提示说明!!!',
|
|
|
|
componentProps: {
|
|
|
|
enterSearch: true,
|
|
|
|
isSearchList: true, // 开启查询弹窗
|
|
|
|
searchListPlaceholder: '请选择工序代码', // 输入框占位文本
|
|
|
|
searchField: 'code', // 查询弹窗赋值字段
|
|
|
|
searchTitle: '工序信息', // 查询弹窗标题
|
|
|
|
searchAllSchemas: Process.allSchemas, // 查询弹窗所需类
|
|
|
|
searchPage: ProcessApi.getProcessPage, // 查询弹窗所需分页方法
|
|
|
|
searchCondition: [{
|
|
|
|
key: 'available',
|
|
|
|
value: 'TRUE',
|
|
|
|
isMainValue: false,
|
|
|
|
}],
|
|
|
|
verificationPage: ProcessApi.getProcessByCodes, // 失去焦点校验输入框的数据内容存在
|
|
|
|
verificationParams: [{
|
|
|
|
key: 'code',
|
|
|
|
action: '==',
|
|
|
|
value: '',
|
|
|
|
isMainValue: false,
|
|
|
|
isSearch: 'true',
|
|
|
|
isFormModel:true
|
|
|
|
}], // 失去焦点校验参数
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '版本',
|
|
|
|
field: 'version',
|
|
|
|
sort: 'custom',
|
|
|
|
form: {
|
|
|
|
labelMessage: '子物料要和父物料版本相同',
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
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: {
|
|
|
|
style: {width:'100%'},
|
|
|
|
type: 'datetime',
|
|
|
|
dateFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
|
|
valueFormat: 'x',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
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',
|
|
|
|
dateFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
|
|
valueFormat: 'x',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
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
|
|
|
|
},
|
|
|
|
form: {
|
|
|
|
component: 'DatePicker',
|
|
|
|
componentProps: {
|
|
|
|
style: {width:'100%'},
|
|
|
|
type: 'datetime',
|
|
|
|
dateFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
|
|
valueFormat: 'x',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
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', isTable: false },
|
|
|
|
{
|
|
|
|
label: '操作',
|
|
|
|
field: 'action',
|
|
|
|
isDetail: false,
|
|
|
|
isForm: false ,
|
|
|
|
table: {
|
|
|
|
width: 150,
|
|
|
|
fixed: 'right'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]))
|
|
|
|
|
|
|
|
//表单校验
|
|
|
|
export const BomRules = reactive({
|
|
|
|
productItemCode: [
|
|
|
|
{ required: true, message: '请输入父物料代码', trigger: 'change' }
|
|
|
|
],
|
|
|
|
componentItemCode: [
|
|
|
|
{ required: true, message: '请输入子物料代码', trigger: 'change' }
|
|
|
|
],
|
|
|
|
componentUom: [
|
|
|
|
{ required: true, message: '请选择子物料计量单位', trigger: 'change' }
|
|
|
|
],
|
|
|
|
componentQty: [
|
|
|
|
{ required: true, message: '请输入子物料数量', trigger: 'blur' }
|
|
|
|
],
|
|
|
|
processCode: [
|
|
|
|
{ required: true, message: '请输入工序代码', trigger: 'blur' },
|
|
|
|
{ max: 50, message: '不得超过50个字符', trigger: 'change' },
|
|
|
|
],
|
|
|
|
version: [
|
|
|
|
{ required: true, message: '请输入版本', trigger: 'blur' },
|
|
|
|
{ max: 50, message: '不得超过50个字符', trigger: 'change' }
|
|
|
|
],
|
|
|
|
layer: [
|
|
|
|
{ required: true, message: '请输入层级', trigger: 'blur' },
|
|
|
|
{ max: 50, message: '不得超过50个字符', trigger: 'change' }
|
|
|
|
],
|
|
|
|
remark: [
|
|
|
|
{ max: 50, message: '不得超过50个字符', trigger: 'change' }
|
|
|
|
],
|
|
|
|
available: [
|
|
|
|
{ required: true, message: '请选择是否可用', trigger: 'change' }
|
|
|
|
],
|
|
|
|
})
|