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.
278 lines
6.8 KiB
278 lines
6.8 KiB
7 months ago
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
|
||
|
import {Supplier} from "@/views/wms/basicDataManage/supplierManage/supplier/supplier.data";
|
||
|
import * as SupplierApi from "@/api/wms/supplier";
|
||
|
import * as ItembasicApi from "@/api/wms/itembasic";
|
||
|
import {
|
||
|
Supplieritem
|
||
|
} from "@/views/wms/basicDataManage/supplierManage/supplieritem/supplieritem.data";
|
||
|
import * as SupplieritemApi from "@/api/wms/supplieritem";
|
||
|
|
||
|
/**
|
||
|
* @returns {Array} 采购换货申请主表
|
||
|
*/
|
||
|
export const PurchaseBarterRequestMain = useCrudSchemas(reactive<CrudSchema[]>([
|
||
|
{
|
||
|
label: '申请单号',
|
||
|
field: 'number',
|
||
|
sort: 'custom',
|
||
|
isSearch: true,
|
||
|
isForm: false,
|
||
|
table: {
|
||
|
width: 180,
|
||
|
fixed: 'left'
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
label: '状态',
|
||
|
field: 'status',
|
||
|
sort: 'custom',
|
||
|
isSearch: true,
|
||
|
isForm: false,
|
||
|
dictType: DICT_TYPE.REQUEST_STATUS,
|
||
|
dictClass: 'string',
|
||
|
},
|
||
|
{
|
||
|
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: 'supplierName',
|
||
|
sort: 'custom',
|
||
|
isSearch: false,
|
||
|
form: {
|
||
|
componentProps: {
|
||
|
disabled: true
|
||
|
}
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
label: '操作',
|
||
|
field: 'action',
|
||
|
isForm: false,
|
||
|
isDetail: false,
|
||
|
table: {
|
||
|
width: 250,
|
||
|
fixed: 'right'
|
||
|
}
|
||
|
}
|
||
|
]))
|
||
|
|
||
|
//表单校验
|
||
|
export const PurchaseBarterRequestMainRules = reactive({
|
||
|
supplierCode: [
|
||
|
{ required: true, message: '请输入供应商代码', trigger: 'blur' }
|
||
|
],
|
||
|
})
|
||
|
|
||
|
/**
|
||
|
* @returns {Array} 采购换货申请子表
|
||
|
*/
|
||
|
export const PurchaseBarterRequestDetail = useCrudSchemas(reactive<CrudSchema[]>([
|
||
|
{
|
||
|
label: '物料代码',
|
||
|
field: 'itemCode',
|
||
|
sort: 'custom',
|
||
|
isSearch: true,
|
||
|
table: {
|
||
|
width: 150
|
||
|
},
|
||
|
tableForm:{
|
||
|
multiple:true,//多选
|
||
|
isInpuFocusShow: true, // 开启查询弹窗
|
||
|
searchListPlaceholder: '请选择物料代码',// 输入框占位文本
|
||
|
searchField: 'itemCode', // 查询弹窗赋值字段
|
||
|
searchTitle: '供应商物料信息', // 查询弹窗标题
|
||
|
searchAllSchemas: Supplieritem.allSchemas, // 查询弹窗所需类
|
||
|
searchPage: SupplieritemApi.getSupplieritemPage, // 查询弹窗所需分页方法
|
||
|
searchCondition: [{
|
||
|
key: 'available',
|
||
|
value: 'TRUE',
|
||
|
action: '==',
|
||
|
isSearch: true,
|
||
|
isMainValue: false
|
||
|
},{
|
||
|
key: 'supplierCode',
|
||
|
value: 'supplierCode',
|
||
|
action: '==',
|
||
|
message: '供应商代码不能为空!',
|
||
|
isFormModel:true, // filters中添加筛选的数据--取于formModel
|
||
|
required:true, // 前置添加必有,和isFormModel结合使用
|
||
|
isSearch: true,
|
||
|
isMainValue: false
|
||
|
}],
|
||
|
verificationPage: ItembasicApi.getItemListByCodes, // tableForm下方输入框校验失去焦点之后是否正确的方法
|
||
|
isShowTableFormSearch: false, //tableForm下方是否出现输入框
|
||
|
verificationParams: [{
|
||
|
key: 'itemCode',
|
||
|
action: '==',
|
||
|
value: '',
|
||
|
isMainValue: false,
|
||
|
isSearch: true,
|
||
|
isFormModel: true,
|
||
|
}], // 失去焦点校验参数
|
||
|
},
|
||
|
form: {
|
||
|
// labelMessage: '信息提示说明!!!',
|
||
|
componentProps: {
|
||
|
disabled:true,
|
||
|
enterSearch: true,
|
||
|
isSearchList: true, // 开启查询弹窗
|
||
|
searchListPlaceholder: '请选择物料代码', // 输入框占位文本
|
||
|
searchField: 'itemCode', // 查询弹窗赋值字段
|
||
|
searchTitle: '供应商物料信息', // 查询弹窗标题
|
||
|
searchAllSchemas: Supplieritem.allSchemas, // 查询弹窗所需类
|
||
|
searchPage: SupplieritemApi.getSupplieritemPage, // 查询弹窗所需分页方法
|
||
|
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,
|
||
|
tableForm: {
|
||
|
disabled: true
|
||
|
},
|
||
|
form:{
|
||
|
componentProps:{
|
||
|
disabled:true
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
label: '计量单位',
|
||
|
field: 'uom',
|
||
|
sort: 'custom',
|
||
|
isSearch: false,
|
||
|
tableForm: {
|
||
|
disabled: true
|
||
|
},
|
||
|
form:{
|
||
|
componentProps:{
|
||
|
disabled:true
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
label: '批次',
|
||
|
field: 'batch',
|
||
|
sort: 'custom',
|
||
|
isSearch: true,
|
||
|
tableForm: {
|
||
|
disabled: true
|
||
|
},
|
||
|
form:{
|
||
|
componentProps:{
|
||
|
disabled:true
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
label: '包装规格',
|
||
|
field: 'packUnit',
|
||
|
sort: 'custom',
|
||
|
isSearch: false,
|
||
|
tableForm: {
|
||
|
disabled: true
|
||
|
},
|
||
|
form:{
|
||
|
componentProps:{
|
||
|
disabled:true
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
label: '换货数量',
|
||
|
field: 'qty',
|
||
|
sort: 'custom',
|
||
|
isSearch: false,
|
||
|
form: {
|
||
|
component: 'InputNumber',
|
||
|
value: 0
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
label: '换货原因 ',
|
||
|
field: 'reason',
|
||
|
sort: 'custom',
|
||
|
isSearch: false,
|
||
|
},
|
||
|
{
|
||
|
label: '操作',
|
||
|
field: 'action',
|
||
|
isDetail: false,
|
||
|
hiddenInMain:true,
|
||
|
isForm: false ,
|
||
|
table: {
|
||
|
width: 150,
|
||
|
fixed: 'right'
|
||
|
},
|
||
|
isTableForm:false,
|
||
|
}
|
||
|
]))
|
||
|
|
||
|
function validateQty(rule, value, callback) {
|
||
|
const numericValue = Number(value);
|
||
|
if (Number.isInteger(numericValue) && numericValue > 0) {
|
||
|
callback();
|
||
|
} else {
|
||
|
callback(new Error('数量必须是一个正整数'));
|
||
|
}
|
||
|
}
|
||
|
//表单校验
|
||
|
export const PurchaseBarterRequestDetailRules = reactive({
|
||
|
qty:[
|
||
|
{ validator:validateQty, message: '数量必须是一个正整数', trigger: 'change'}
|
||
|
],
|
||
|
})
|