|
@ -384,52 +384,15 @@ export const FormBlur = async (formField, val,routeName,formRef,detailData,formS |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 根据下方输入框失去焦点校验信息
|
|
|
// 根据下方输入框失去焦点校验信息
|
|
|
export const getListByBottonInput = async (headerItem, val,row,routeName,formRef,detailData,tableData,callback) => { |
|
|
export const getListByBottonInput = async (headerItem, val, row, routeName, formRef, detailData, tableData, callback) => { |
|
|
let pageApi = ref() |
|
|
let tableFormSchemaObj = headerItem?.tableForm |
|
|
|
|
|
console.log(333,tableFormSchemaObj) |
|
|
|
|
|
if (tableFormSchemaObj.searchPage && tableFormSchemaObj.verificationParams) { |
|
|
let params = ref({}) |
|
|
let params = ref({}) |
|
|
let list = ref([]) |
|
|
let list = ref([]) |
|
|
let field = 'itemCode' |
|
|
console.log(3344) |
|
|
// scp采购订单
|
|
|
|
|
|
if(!val)return; |
|
|
|
|
|
if (routeName == 'PurchaseMain') { |
|
|
|
|
|
pageApi.value = getSupplierItemListByCodes |
|
|
|
|
|
params.value = { |
|
|
|
|
|
supplierCode: formRef.formModel.supplierCode, |
|
|
|
|
|
itemCodes: val?.trim(), |
|
|
|
|
|
available: true |
|
|
|
|
|
} |
|
|
|
|
|
} else if (routeName == 'ProductionMain') { |
|
|
|
|
|
pageApi.value = getProductionLineCodelistByCodes |
|
|
|
|
|
params.value = { |
|
|
|
|
|
productionLineCode: formRef.formModel.productionLine, |
|
|
|
|
|
itemCodes: val?.trim() |
|
|
|
|
|
} |
|
|
|
|
|
} else if ( |
|
|
|
|
|
routeName == 'ZZBJDeliverPlanMain' || |
|
|
|
|
|
routeName == 'DeliverPlanMain' || |
|
|
|
|
|
routeName == 'DeliverRequestMain' || |
|
|
|
|
|
routeName == 'ZZBJDeliverRequestMain' |
|
|
|
|
|
) { |
|
|
|
|
|
// 自制备件发货计划,发货计划,成品发货申请,自制备件发货申请
|
|
|
|
|
|
pageApi.value = getCustomerItemListByCodes |
|
|
|
|
|
params.value = { |
|
|
|
|
|
customerCode: formRef.formModel.customerCode, |
|
|
|
|
|
itemCodes: val?.trim() |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
// else if (routeName == 'UnplannedissueRequestMain') {
|
|
|
|
|
|
// // 计划外出库
|
|
|
|
|
|
// pageApi.value = getBalanceItemListByCodes
|
|
|
|
|
|
// params.value = {
|
|
|
|
|
|
// packingNumber: val?.trim()
|
|
|
|
|
|
// }
|
|
|
|
|
|
// field = 'packingNumber'
|
|
|
|
|
|
// }
|
|
|
|
|
|
else { |
|
|
|
|
|
params.value.codes = val?.trim() |
|
|
|
|
|
pageApi.value = getItemListByCodes |
|
|
|
|
|
} |
|
|
|
|
|
let searchCondition1 = headerItem.tableForm.searchCondition //获取data.ts参数信息
|
|
|
let searchCondition1 = headerItem.tableForm.searchCondition //获取data.ts参数信息
|
|
|
|
|
|
let verificationParams = headerItem.tableForm.verificationParams //获取data.ts参数信息
|
|
|
// 循环参数设置参数为key:value格式
|
|
|
// 循环参数设置参数为key:value格式
|
|
|
if (searchCondition1 && searchCondition1.length > 0) { |
|
|
if (searchCondition1 && searchCondition1.length > 0) { |
|
|
for (let i = 0; i < searchCondition1.length; i++) { |
|
|
for (let i = 0; i < searchCondition1.length; i++) { |
|
@ -483,7 +446,7 @@ export const getListByBottonInput = async (headerItem, val,row,routeName,formRef |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}else { |
|
|
} else { |
|
|
params.value[searchCondition1[i].key] = searchCondition1[i].value |
|
|
params.value[searchCondition1[i].key] = searchCondition1[i].value |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
@ -492,9 +455,92 @@ export const getListByBottonInput = async (headerItem, val,row,routeName,formRef |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
console.log(999, verificationParams) |
|
|
|
|
|
if (verificationParams && verificationParams.length > 0) { |
|
|
|
|
|
for (let i = 0; i < verificationParams.length; i++) { |
|
|
|
|
|
params.value[verificationParams[i].key] = val |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
await tableFormSchemaObj.verificationPage(params.value).then(async (res) => { |
|
|
|
|
|
list.value = res ? res : [] |
|
|
|
|
|
let arr1 = val.split(',').map(item => item.trim()) |
|
|
|
|
|
if (arr1.length != res.length) { |
|
|
|
|
|
let arr2 = res.map((item) => item[field]) |
|
|
|
|
|
let str = [ |
|
|
|
|
|
...arr1.filter((item) => !arr2.includes(item)), |
|
|
|
|
|
...arr2.filter((item) => !arr1.includes(item)) |
|
|
|
|
|
].join(',') |
|
|
|
|
|
message.alert('代码' + str + '没有找到对应数据') |
|
|
|
|
|
return |
|
|
|
|
|
} else { |
|
|
|
|
|
let repeatCode = [] |
|
|
|
|
|
if (tableData.length > 0) { |
|
|
|
|
|
tableData.forEach((item) => { |
|
|
|
|
|
const findIndex = arr1.findIndex(valItem => valItem == item[field]) |
|
|
|
|
|
if (findIndex > -1) { |
|
|
|
|
|
arr1.splice(findIndex, 1) |
|
|
|
|
|
repeatCode.push(item.itemCode) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
if (repeatCode.length > 0) { |
|
|
|
|
|
message.warning(`${t('ts.代码')}${repeatCode.join(',')}${t('ts.已经存在')}`); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
callback(list.value) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
return |
|
|
|
|
|
} else { |
|
|
|
|
|
let pageApi = ref() |
|
|
|
|
|
let params = ref({}) |
|
|
|
|
|
let list = ref([]) |
|
|
|
|
|
let field = 'itemCode' |
|
|
|
|
|
// scp采购订单
|
|
|
|
|
|
if (!val) return; |
|
|
|
|
|
|
|
|
|
|
|
if (routeName == 'PurchaseMain') { |
|
|
|
|
|
pageApi.value = getSupplierItemListByCodes |
|
|
|
|
|
params.value = { |
|
|
|
|
|
supplierCode: formRef.formModel.supplierCode, |
|
|
|
|
|
itemCodes: val?.trim(), |
|
|
|
|
|
available: true |
|
|
|
|
|
} |
|
|
|
|
|
} else if (routeName == 'ProductionMain') { |
|
|
|
|
|
pageApi.value = getProductionLineCodelistByCodes |
|
|
|
|
|
params.value = { |
|
|
|
|
|
productionLineCode: formRef.formModel.productionLine, |
|
|
|
|
|
itemCodes: val?.trim() |
|
|
|
|
|
} |
|
|
|
|
|
} else if ( |
|
|
|
|
|
routeName == 'ZZBJDeliverPlanMain' || |
|
|
|
|
|
routeName == 'DeliverPlanMain' || |
|
|
|
|
|
routeName == 'DeliverRequestMain' || |
|
|
|
|
|
routeName == 'ZZBJDeliverRequestMain' |
|
|
|
|
|
) { |
|
|
|
|
|
// 自制备件发货计划,发货计划,成品发货申请,自制备件发货申请
|
|
|
|
|
|
pageApi.value = getCustomerItemListByCodes |
|
|
|
|
|
params.value = { |
|
|
|
|
|
customerCode: formRef.formModel.customerCode, |
|
|
|
|
|
itemCodes: val?.trim() |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
// else if (routeName == 'UnplannedissueRequestMain') {
|
|
|
|
|
|
// // 计划外出库
|
|
|
|
|
|
// pageApi.value = getBalanceItemListByCodes
|
|
|
|
|
|
// params.value = {
|
|
|
|
|
|
// packingNumber: val?.trim()
|
|
|
|
|
|
// }
|
|
|
|
|
|
// field = 'packingNumber'
|
|
|
|
|
|
// }
|
|
|
|
|
|
else { |
|
|
|
|
|
params.value.codes = val?.trim() |
|
|
|
|
|
pageApi.value = getItemListByCodes |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
await pageApi.value(params.value).then(async (res) => { |
|
|
await pageApi.value(params.value).then(async (res) => { |
|
|
list.value = res ? res : [] |
|
|
list.value = res ? res : [] |
|
|
let arr1 = val.split(',').map(item=>item.trim()) |
|
|
let arr1 = val.split(',').map(item => item.trim()) |
|
|
if (arr1.length != res.length) { |
|
|
if (arr1.length != res.length) { |
|
|
let arr2 = res.map((item) => item[field]) |
|
|
let arr2 = res.map((item) => item[field]) |
|
|
let str = [ |
|
|
let str = [ |
|
@ -505,20 +551,23 @@ export const getListByBottonInput = async (headerItem, val,row,routeName,formRef |
|
|
return |
|
|
return |
|
|
} else { |
|
|
} else { |
|
|
let repeatCode = [] |
|
|
let repeatCode = [] |
|
|
if(tableData.length > 0){ |
|
|
if (tableData.length > 0) { |
|
|
tableData.forEach((item) => { |
|
|
tableData.forEach((item) => { |
|
|
const findIndex = arr1.findIndex(valItem=>valItem==item[field]) |
|
|
const findIndex = arr1.findIndex(valItem => valItem == item[field]) |
|
|
if(findIndex > -1){ |
|
|
if (findIndex > -1) { |
|
|
arr1.splice(findIndex,1) |
|
|
arr1.splice(findIndex, 1) |
|
|
repeatCode.push(item.itemCode) |
|
|
repeatCode.push(item.itemCode) |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
if(repeatCode.length>0){ |
|
|
if (repeatCode.length > 0) { |
|
|
message.warning(`${t('ts.代码')}${repeatCode.join(',')}${t('ts.已经存在')}`); |
|
|
message.warning(`${t('ts.代码')}${repeatCode.join(',')}${t('ts.已经存在')}`); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
callback(list.value) |
|
|
callback(list.value) |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|