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.

611 lines
12 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 PackageunitApi from '@/api/wms/packageunit'
import { Packageunit } from '../packageunit/packageunit.data'
4 months ago
import { dateFormatter,dateFormatter2 } from '@/utils/formatTime'
1 year ago
const { t } = useI18n() // 国际化
/**
* @returns {Array}
*/
export const Itempackaging = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '物料代码',
1 year ago
field: 'itemCode',
sort: 'custom',
isSearch: true,
table: {
10 months ago
width: 180,
1 year ago
fixed: 'left'
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
11 months ago
enterSearch: true, //可输入回车
1 year ago
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择物料代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '物料基础信息', // 查询弹窗标题
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}],
verificationParams: [{
key: 'code',
action: '==',
value: '',
isMainValue: false,
isSearch: 'true',
isFormModel: true
}], // 失去焦点校验参数
1 year ago
}
}
},
{
label: '物料名称',
field: 'itemName',
sort: 'custom',
isSearch: false,
table: {
width: 120
},
form: {
componentProps: {
disabled: true
}
},
isTable:true,
isTableForm:true,
isForm:true,
isDetail:true
},
{
label: '背番',
field: 'backNumber',
sort: 'custom',
isSearch: true,
table: {
width: 150
},
},
1 year ago
{
label: '计量单位',
field: 'uom',
sort: 'custom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 120
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
disabled: true
}
1 year ago
}
},
{
label: '包装规格',
field: 'packUnit',
sort: 'custom',
table: {
width: 150
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
11 months ago
enterSearch: true, //可输入回车
1 year ago
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择包装规格', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '包装规格信息', // 查询弹窗标题
searchAllSchemas: Packageunit.allSchemas, // 查询弹窗所需类
searchPage: PackageunitApi.getPackageunitPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
action: '==',
isSearch: true,
isMainValue: false
}],
verificationParams: [{
key: 'code',
action: '==',
value: '',
isMainValue: false,
isSearch: 'true',
isFormModel: true
}], // 失去焦点校验参数
1 year ago
}
}
},
{
label: '包装名称',
field: 'packName',
sort: 'custom',
isSearch: false,
table: {
width: 120
},
isTable:true,
isTableForm:false,
isForm:false,
isDetail:false
},
{
label: '包装类型',
field: 'packType',
dictType: DICT_TYPE.PACK_UNIT_TYPE,
dictClass: 'string',
sort: 'custom',
isSearch: false,
table: {
width: 150
},
},
{
label: '包装数量',
1 year ago
field: 'packQty',
sort: 'custom',
isSearch: false,
1 year ago
table: {
width: 120
},
form: {
component: 'InputNumber',
componentProps: {
min: 0,
1 year ago
precision: 6
}
}
},
{
label: '默认包装规格',
field: 'defaultPackageunit',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: false,
isDetail:false,
isForm:false,
table: {
width: 120
},
form: {
component: 'Switch',
value: 'FALSE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
1 year ago
{
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: '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: 'dataSource',
sort: 'custom',
isForm:false,
dictType: DICT_TYPE.PACK_DATA_SOURCE,
dictClass: 'string',
table: {
width: 180
},
},
{
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: false,
table: {
width: 120
},
isTable:true,
isTableForm:true,
isForm:true,
isDetail:true
},
1 year ago
{
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: true,
table: {
width: 150
}
},
{
label: '最后更新时间',
field: 'updateTime',
sort: 'custom',
isDetail: true,
1 year ago
isForm: false,
isTable: true,
1 year ago
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,
1 year ago
isForm: false,
isTable: true,
1 year ago
table: {
width: 150
}
},
{
label: '操作',
field: 'action',
isDetail: false,
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))
const validateQty = (rule: any, value: any, callback: any,a,b) => {
console.log('validateQty',rule, value,a,b)
if (!value) {
callback(new Error('包装数量必须大于0'));
} else {
callback();
}
}
1 year ago
// 表单校验
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' },
{ validator: validateQty, trigger: 'change' }
],
1 year ago
available: [{ required: true, message: '是否可用不能为空', trigger: 'change' }]
})
4 months ago
/**
* @returns {Array}
*/
export const PurchasePackaging = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '包装号',
field: 'number',
sort: 'custom',
},
{
label: '看板编号',
field: 'lookNumber',
sort: 'custom',
},
{
label: '物料代码',
field: 'itemCode',
sort: 'custom',
},
{
label: '物料名称',
field: 'itemName',
sort: 'custom',
},
{
label: '物料描述1',
field: 'itemDesc1',
sort: 'custom',
},
{
label: '物料描述2',
field: 'itemDesc2',
sort: 'custom',
},
{
label: '批次',
field: 'batch',
sort: 'custom',
},
{
label: '生产日期',
field: 'produceDate',
sort: 'custom',
formatter: dateFormatter2,
detail: {
dateFormat: 'YYYY-MM-DD'
},
},
{
label: '有效期(日)',
field: 'validityDays',
sort: 'custom',
},
{
label: '失效日期',
field: 'expireDate',
sort: 'custom',
formatter: dateFormatter2,
detail: {
dateFormat: 'YYYY-MM-DD'
},
},
{
label: '计量单位',
field: 'uom',
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
disabled: true
}
}
},
{
label: '数量',
field: 'qty',
sort: 'custom',
},
{
label: '采购计量单位',
field: 'purchaseUom',
4 months ago
sort: 'custom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 120
},
},
{
label: '采购数量',
field: 'purchaseQty',
sort: 'custom',
},
{
label: '采购标包数量',
field: 'purchaseStdQty',
sort: 'custom',
},
4 months ago
{
label: '转换率',
field: 'convertRate',
sort: 'custom',
},
{
label: '包装规格',
field: 'packUnit',
sort: 'custom',
table: {
width: 150
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
enterSearch: true, //可输入回车
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择包装规格', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '包装规格信息', // 查询弹窗标题
searchAllSchemas: Packageunit.allSchemas, // 查询弹窗所需类
searchPage: PackageunitApi.getPackageunitPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
action: '==',
isSearch: true,
isMainValue: false
}],
verificationParams: [{
key: 'code',
action: '==',
value: '',
isMainValue: false,
isSearch: 'true',
isFormModel: true
}], // 失去焦点校验参数
}
}
},
{
label: '包装数量',
field: 'packQty',
sort: 'custom',
isSearch: false,
table: {
width: 120
},
form: {
component: 'InputNumber',
componentProps: {
min: 0,
precision: 6
}
}
},
{
label: '供应商代码',
field: 'supplierCode',
sort: 'custom',
isSearch: false,
table: {
width: 120
},
},
{
label: '供应商物料代码',
field: 'supplierItemCode',
sort: 'custom',
isSearch: false,
table: {
width: 120
},
},
{
label: '标签数量',
field: 'count',
sort: 'custom',
isSearch: false,
table: {
width: 120
},
},
{
label: '生产线代码',
field: 'productionLineCode',
sort: 'custom',
isSearch: false,
table: {
width: 120
},
},
{
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: true,
table: {
width: 150
}
},
{
label: '操作',
field: 'aaa',
sort: 'custom',
},
4 months ago
]))