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.

368 lines
8.5 KiB

1 year ago
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() // 国际化
/**
1 year ago
* @returns {Array}
*/
export const Bom = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '父品番',
1 year ago
field: 'productItemCode',
isSearch: true,
sort: 'custom',
table: {
width: 150,
fixed: 'left'
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
enterSearch: true,
1 year ago
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择品番', // 输入框占位文本
1 year ago
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '物料基础信息', // 查询弹窗标题
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
searchPage: ItembasicApi.selectItembasicPageToFgAndSemibasicPage, // 查询弹窗所需分页方法
10 months ago
verificationParams: [{
10 months ago
key: 'code',
action: '==',
10 months ago
value: '',
10 months ago
isMainValue: false,
isSearch: 'true',
isFormModel: true
10 months ago
}], // 失去焦点校验参数
1 year ago
}
}
},
{
label: '父背番',
field: 'productBackNumber',
sort: 'custom',
isSearch: true,
hiddenSearchHigh:true,
table: {
width: 150
},
form:{
componentProps:{
disabled: true,
}
}
},
1 year ago
{
label: '子品番',
1 year ago
field: 'componentItemCode',
isSearch: true,
sort: 'custom',
table: {
width: 150
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
enterSearch: true,
1 year ago
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择品番', // 输入框占位文本
1 year ago
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '物料基础信息', // 查询弹窗标题
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
searchPage: ItembasicApi.selectTypeToItembasic, // 查询弹窗所需分页方法
10 months ago
verificationParams: [{
10 months ago
key: 'code',
action: '==',
10 months ago
value: '',
10 months ago
isMainValue: false,
isSearch: 'true',
isFormModel: true
10 months ago
}], // 失去焦点校验参数
1 year ago
}
}
},
{
label: '子背番',
field: 'componentBackNumber',
sort: 'custom',
isSearch: true,
hiddenSearchHigh:true,
table: {
width: 150
},
form:{
componentProps:{
disabled: true,
}
}
},
1 year ago
{
label: '子物料计量单位',
field: 'componentUom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
sort: 'custom',
isSearch: true,
isTable: true,
table: {
width: 150
},
form:{
componentProps:{
disabled: true,
}
1 year ago
}
},
{
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,
1 year ago
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择工序代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '工序信息', // 查询弹窗标题
searchAllSchemas: Process.allSchemas, // 查询弹窗所需类
searchPage: ProcessApi.getProcessPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
10 months ago
isMainValue: false,
10 months ago
}],
verificationPage: ProcessApi.getProcessByCodes, // 失去焦点校验输入框的数据内容存在
verificationParams: [{
10 months ago
key: 'code',
action: '==',
10 months ago
value: '',
10 months ago
isMainValue: false,
isSearch: 'true',
isFormModel:true
10 months ago
}], // 失去焦点校验参数
1 year ago
}
}
},
{
label: '版本',
field: 'version',
sort: 'custom',
form: {
labelMessage: '子物料要和父物料版本相同',
}
},
{
label: '层级',
field: 'layer',
sort: 'custom',
isTable:false,
1 year ago
// 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',
isSearch:true,
isForm: false,
1 year ago
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
search: {
value: 'TRUE',
1 year ago
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
table: {
width: 110
1 year ago
}
},
{
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: 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: 'updater',
isDetail: true,
isForm: false,
isTable: true,
table: {
width: 150
}
1 year ago
},
{ 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' }
1 year ago
],
componentItemCode: [
{ required: true, message: '请输入子品番', trigger: 'change' }
1 year ago
],
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' }
],
})