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.
 
 
 

113 lines
2.7 KiB

import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import {Itembasic} from "@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data";
import * as ItembasicApi from "@/api/wms/itembasic";
// 表单校验
export const ItemSyntheticRelationRules = reactive({
name: [required],
itemCode: [required, { validator: validateItemCodes, message: '应选择多个物料', trigger: 'blur' }],
available: [required],
})
export function validateItemCodes(rule, value, callback) {
if (value) {
const Reg = /,/
if (Reg.test(value)) {
callback()
} else {
callback(new Error('应选择多个物料'))
}
} else {
callback()
}
}
export const ItemSyntheticRelation = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '组合号',
field: 'code',
sort: 'custom',
isSearch: true,
isForm: false,
},
{
label: '组合名称',
field: 'name',
sort: 'custom',
isSearch: true,
},
{
label: '物料代码',
field: 'itemCode',
sort: 'custom',
isSearch: true,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
multiple: true,
enterSearch: true, //可输入回车
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择物料代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '物料基础信息', // 查询弹窗标题
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法
verificationPage: ItembasicApi.getItemListByCodes, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}],
verificationParams: [{
key: 'code',
action: '==',
value: '',
isMainValue: false,
isSearch: 'true',
isFormModel: true
}], // 失去焦点校验参数
}
}
},
{
label: '物料名称',
field: 'itemName',
sort: 'custom',
isSearch: false,
isForm:false,
},
{
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: false,
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
isSearch: true,
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
table: {
width: 120
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))