|
|
|
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";
|
|
|
|
import { Balance } from '@/views/wms/inventoryManage/balance/balance.data'
|
|
|
|
import * as PurchaseBarterRequestMainApi from "@/api/wms/purchaseBarterRequestMain";
|
|
|
|
/**
|
|
|
|
* @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: Balance.allSchemas,
|
|
|
|
searchPage: PurchaseBarterRequestMainApi.getSupplieritemPage, // 查询弹窗所需分页方法
|
|
|
|
searchCondition: [{
|
|
|
|
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: Balance.allSchemas,
|
|
|
|
searchPage: PurchaseBarterRequestMainApi.getSupplieritemPage, // 查询弹窗所需分页方法
|
|
|
|
searchCondition: [{
|
|
|
|
key: 'supplierCode',
|
|
|
|
value: 'supplierCode',
|
|
|
|
action: '==',
|
|
|
|
message: '供应商代码不能为空!',
|
|
|
|
isFormModel:true, // filters中添加筛选的数据--取于formModel
|
|
|
|
required:true, // 前置添加必有,和isFormModel结合使用
|
|
|
|
isSearch: true,
|
|
|
|
isMainValue: false
|
|
|
|
}],
|
|
|
|
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,
|
|
|
|
dictType: DICT_TYPE.UOM,
|
|
|
|
dictClass: 'string',
|
|
|
|
tableForm: {
|
|
|
|
disabled: true
|
|
|
|
},
|
|
|
|
form:{
|
|
|
|
componentProps:{
|
|
|
|
disabled:true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '批次',
|
|
|
|
field: 'batch',
|
|
|
|
sort: 'custom',
|
|
|
|
isSearch: true,
|
|
|
|
tableForm: {
|
|
|
|
disabled: true
|
|
|
|
},
|
|
|
|
form:{
|
|
|
|
componentProps:{
|
|
|
|
disabled:true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '换货库位',
|
|
|
|
field: 'locationCode',
|
|
|
|
sort: 'custom',
|
|
|
|
isSearch: false,
|
|
|
|
tableForm: {
|
|
|
|
disabled: true
|
|
|
|
},
|
|
|
|
form:{
|
|
|
|
componentProps:{
|
|
|
|
disabled:true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '库存数量 ',
|
|
|
|
field: 'inventoryQty',
|
|
|
|
sort: 'custom',
|
|
|
|
isSearch: false,
|
|
|
|
isTable: false,
|
|
|
|
tableForm: {
|
|
|
|
disabled: true
|
|
|
|
},
|
|
|
|
form:{
|
|
|
|
componentProps:{
|
|
|
|
disabled:true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '换货数量',
|
|
|
|
field: 'qty',
|
|
|
|
sort: 'custom',
|
|
|
|
isSearch: false,
|
|
|
|
// form: {
|
|
|
|
// component: 'InputNumber',
|
|
|
|
// value: 0
|
|
|
|
// },
|
|
|
|
form: {
|
|
|
|
component: 'InputNumber',
|
|
|
|
componentProps: {
|
|
|
|
min: 0,
|
|
|
|
precision: 6,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
tableForm: {
|
|
|
|
type: 'InputNumber',
|
|
|
|
min: 0,
|
|
|
|
precision: 6,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
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 (numericValue > 0) {
|
|
|
|
// if(numericValue < )
|
|
|
|
callback();
|
|
|
|
} else {
|
|
|
|
callback(new Error('换货数量必须是一个正数'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//表单校验
|
|
|
|
export const PurchaseBarterRequestDetailRules = reactive({
|
|
|
|
qty:[
|
|
|
|
{ validator:validateQty, message: '换货数量必须是一个正数', trigger: 'change'}
|
|
|
|
],
|
|
|
|
itemCode: [
|
|
|
|
{ required: true, message: '请输入物料代码', trigger: 'blur' }
|
|
|
|
],
|
|
|
|
})
|