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.
 
 
 

225 lines
5.7 KiB

import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import {Supplieritem} from "@/views/wms/basicDataManage/supplierManage/supplieritem/supplieritem.data";
import * as SupplieritemApi from "@/api/wms/supplieritem";
import {dateFormatter} from "@/utils/formatTime";
import * as SupplierApi from '@/api/wms/supplier'
import { Supplier } from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data'
// 表单校验
export const ItemSyntheticRelationRules = reactive({
name: [required],
supplierCode: [
{ required: true, message: '请选择供应商代码', trigger: 'change' }
],
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: 'supplierCode',
sort: 'custom',
isSearch: true,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
enterSearch:true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择供应商代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '供应商信息', // 查询弹窗标题
searchAllSchemas: Supplier.allSchemas, // 查询弹窗所需类
searchPage: SupplierApi.getSupplierPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}],
verificationParams: [{
key: 'code',
action: '==',
value: '',
isMainValue: false,
isSearch: true,
isFormModel: true,
}], // 失去焦点校验参数
}
}
},
{
label: '品番',
field: 'itemCode',
sort: 'custom',
isSearch: true,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
multiple: true,
enterSearch: true, //可输入回车
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择品番', // 输入框占位文本
searchField: 'itemCode', // 查询弹窗赋值字段
searchTitle: '供应商物料信息', // 查询弹窗标题
searchAllSchemas: Supplieritem.allSchemas, // 查询弹窗所需类
searchPage: SupplieritemApi.getSupplieritemPage, // 查询弹窗所需分页方法
verificationPage: SupplieritemApi.getSupplierItemListByCodes, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
},
{
key: 'supplierCode',
value: 'supplierCode',
message: '请选择供应商代码',
isMainValue: true
}
],
verificationParams: [{
key: 'itemCode',
action: '==',
value: '',
isMainValue: false,
isSearch: 'true',
isFormModel: true
}], // 失去焦点校验参数
}
}
},
{
label: '品名',
field: 'itemName',
sort: 'custom',
isSearch: false,
isForm:false,
},
{
label: '背番',
field: 'itemDesc1',
sort: 'custom',
isSearch: false,
isForm:false,
hiddenSearchHigh:true,
table: {
width: 150
},
form:{
componentProps:{
disabled: true,
}
}
},
// {
// label: '生效时间',
// field: 'effectiveDate',
// sort: 'custom',
// formatter: dateFormatter,
// isSearch: false,
// isTable: true,
// isForm: true,
// isDetail:true,
// search: {
// component: 'DatePicker',
// componentProps: {
// valueFormat: 'YYYY-MM-DD HH:mm:ss',
// type: 'daterange',
// defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
// }
// },
// form: {
// component: 'DatePicker',
// componentProps: {
// type: 'datetime',
// valueFormat: 'x'
// }
// },
// },
// {
// label: '失效时间',
// field: 'expirationDate',
// sort: 'custom',
// formatter: dateFormatter,
// isSearch: false,
// isTable: true,
// isForm: true,
// isDetail:true,
// search: {
// component: 'DatePicker',
// componentProps: {
// valueFormat: 'YYYY-MM-DD HH:mm:ss',
// type: 'daterange',
// defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
// }
// },
// form: {
// component: 'DatePicker',
// componentProps: {
// type: 'datetime',
// valueFormat: 'x'
// }
// },
// },
{
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: false,
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
isSearch: true,
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
table: {
width: 120
},
isForm:false,
// form: {
// component: 'Switch',
// value: 'TRUE',
// componentProps: {
// inactiveValue: 'FALSE',
// activeValue: 'TRUE'
// }
// }
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))