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.

317 lines
7.2 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'
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: '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',
table: {
width: 120
},
form: {
component: 'Switch',
value: 'FALSE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
1 year ago
{
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: 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' }]
})