|
@ -22,95 +22,143 @@ const { t } = useI18n() // 国际化 |
|
|
* tableFormBlur 表格表单失去焦点时候获取焦点 |
|
|
* tableFormBlur 表格表单失去焦点时候获取焦点 |
|
|
* FormBlur 表格失去焦点时候获取焦点 |
|
|
* FormBlur 表格失去焦点时候获取焦点 |
|
|
*/ |
|
|
*/ |
|
|
export const tableFormBlurVer = async (headerItem, val, row, index,routeName,formRef,detailData,tableData,callback) => { |
|
|
export const tableFormBlurVer = async (headerItem, val, row, index, routeName, formRef, detailData, tableData, callback) => { |
|
|
if ( |
|
|
if (headerItem.tableForm.searchPage && headerItem.tableForm.verificationParams) { |
|
|
headerItem.field == 'fromPackingNumber' || |
|
|
|
|
|
headerItem.field == 'packingNumber' || |
|
|
|
|
|
headerItem.field == 'itemCode' || |
|
|
|
|
|
headerItem.field == 'packUnit' || |
|
|
|
|
|
headerItem.field == 'secondPackUnit' || |
|
|
|
|
|
headerItem.field == 'fromPackUnit' || |
|
|
|
|
|
headerItem.field == 'toPackUnit'|| |
|
|
|
|
|
headerItem.field == 'toPackUnit'|| |
|
|
|
|
|
headerItem.field == 'supplierItemCode' |
|
|
|
|
|
|
|
|
|
|
|
) { |
|
|
|
|
|
let searchField = headerItem.field |
|
|
|
|
|
let pageApi = ref() |
|
|
|
|
|
let params = ref() |
|
|
|
|
|
|
|
|
|
|
|
if (val && isString(val)) { |
|
|
if (val && isString(val)) { |
|
|
// const obj = props.tableAllSchemas.tableFormColumns.find((item) => item.field == headerItem.field)
|
|
|
|
|
|
if (val.indexOf(',') > -1) { |
|
|
if (val.indexOf(',') > -1) { |
|
|
message.alert('该输入框只能输入一条数据') |
|
|
message.alert('该输入框只能输入一条数据') |
|
|
row[headerItem.field] = '' |
|
|
row[headerItem.field] = '' |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
// 校验
|
|
|
// 校验
|
|
|
let params = ref({}) |
|
|
const params = ref({}) |
|
|
let searchCondition1 = headerItem.tableForm.searchCondition //获取data.ts参数信息
|
|
|
const filters: any[] = [] |
|
|
|
|
|
const searchCondition = headerItem.tableForm.searchCondition //获取data.ts参数信息
|
|
|
|
|
|
const verificationParams = headerItem.tableForm.verificationParams //获取data.ts参数信息
|
|
|
// 循环参数设置参数为key:value格式
|
|
|
// 循环参数设置参数为key:value格式
|
|
|
if (searchCondition1 && searchCondition1.length > 0) { |
|
|
if (searchCondition && searchCondition.length > 0) { |
|
|
for (let i = 0; i < searchCondition1.length; i++) { |
|
|
for (let i = 0; i < searchCondition.length; i++) { |
|
|
if (searchCondition1[i].isMainValue) { |
|
|
if (searchCondition[i].isMainValue) { |
|
|
params.value[searchCondition1[i].key] = formRef.formModel[ |
|
|
params.value[searchCondition[i].key] = formRef.formModel[ |
|
|
searchCondition1[i].value |
|
|
searchCondition[i].value |
|
|
] |
|
|
] |
|
|
? formRef.formModel[searchCondition1[i].value] |
|
|
? formRef.formModel[searchCondition[i].value] |
|
|
: detailData |
|
|
: detailData |
|
|
? detailData[searchCondition1[i].value] |
|
|
? detailData[searchCondition[i].value] |
|
|
: row |
|
|
: row |
|
|
? row[searchCondition1[i].value] |
|
|
? row[searchCondition[i].value] |
|
|
: '' |
|
|
: '' |
|
|
// 是否含有空参数情况
|
|
|
// 是否含有空参数情况
|
|
|
let isNull = false |
|
|
let isNull = false |
|
|
if ( |
|
|
if ( |
|
|
params.value[searchCondition1[i].key] == '' || |
|
|
params.value[searchCondition[i].key] == '' || |
|
|
params.value[searchCondition1[i].key] == undefined |
|
|
params.value[searchCondition[i].key] == undefined |
|
|
) { |
|
|
) { |
|
|
isNull = true |
|
|
isNull = true |
|
|
} |
|
|
} |
|
|
if (isNull) { |
|
|
if (isNull) { |
|
|
message.warning( |
|
|
message.warning( |
|
|
searchCondition1[i].message ? searchCondition1[i].message : '前置条件未选择!' |
|
|
searchCondition[i].message ? searchCondition[i].message : '前置条件未选择!' |
|
|
) |
|
|
) |
|
|
row[headerItem.field] = '' |
|
|
row[headerItem.field] = '' |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
filters.push({ |
|
|
|
|
|
action: searchCondition[i].action || '==', |
|
|
|
|
|
column: searchCondition[i].key, |
|
|
|
|
|
value: formRef.formModel[searchCondition[i].value] |
|
|
|
|
|
}) |
|
|
|
|
|
} else if (searchCondition[i].isTableRowValue) { |
|
|
|
|
|
if (searchCondition[i].required) { |
|
|
|
|
|
if (row[searchCondition[i].value] == '' || row[searchCondition[i].value] == undefined) { |
|
|
|
|
|
message.warning( |
|
|
|
|
|
searchCondition[i].message ? searchCondition[i].message : '前置条件未选择!' |
|
|
|
|
|
) |
|
|
|
|
|
row[headerItem.field] = '' |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
//查询当前table表数据的值
|
|
|
|
|
|
filters.push({ |
|
|
|
|
|
action: searchCondition[i].action || '==', |
|
|
|
|
|
column: searchCondition[i].key, |
|
|
|
|
|
value: row[searchCondition[i].value] |
|
|
|
|
|
}) |
|
|
} else { |
|
|
} else { |
|
|
// 扩展 转换为筛选条件进行查询
|
|
|
// 扩展 转换为筛选条件进行查询
|
|
|
if (searchCondition1[i].isSearch) { |
|
|
if (searchCondition[i].isSearch) { |
|
|
if (searchCondition1[i].isFormModel) { |
|
|
if (searchCondition[i].isFormModel) { |
|
|
//用formModel中的值
|
|
|
//用formModel中的值
|
|
|
if (searchCondition1[i].required) { |
|
|
if (searchCondition[i].required) { |
|
|
if ( |
|
|
if ( |
|
|
formRef.formModel[searchCondition1[i].value] == '' || |
|
|
formRef.formModel[searchCondition[i].value] == '' || |
|
|
formRef.formModel[searchCondition1[i].value] == undefined |
|
|
formRef.formModel[searchCondition[i].value] == undefined |
|
|
) { |
|
|
) { |
|
|
message.warning( |
|
|
message.warning( |
|
|
searchCondition1[i].message ? searchCondition1[i].message : '前置条件未选择!' |
|
|
searchCondition[i].message ? searchCondition[i].message : '前置条件未选择!' |
|
|
) |
|
|
) |
|
|
row[headerItem.field] = '' |
|
|
row[headerItem.field] = '' |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
filters.push({ |
|
|
|
|
|
action: searchCondition[i].action || '==', |
|
|
|
|
|
column: searchCondition[i].key, |
|
|
|
|
|
value: formRef.formModel[searchCondition[i].value] |
|
|
|
|
|
}) |
|
|
|
|
|
} else { |
|
|
|
|
|
filters.push({ |
|
|
|
|
|
action: searchCondition[i].action || '==', |
|
|
|
|
|
column: searchCondition[i].key, |
|
|
|
|
|
value: searchCondition[i].value |
|
|
|
|
|
}) |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
params.value[searchCondition1[i].key] = searchCondition1[i].value |
|
|
filters.push({ |
|
|
|
|
|
action: searchCondition[i].action || '==', |
|
|
|
|
|
column: searchCondition[i].key, |
|
|
|
|
|
value: searchCondition[i].value |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (verificationParams && verificationParams.length > 0) { |
|
|
|
|
|
// 转换筛选条件所需
|
|
|
|
|
|
for (let i = 0; i < verificationParams.length; i++) { |
|
|
|
|
|
// 扩展 转换为筛选条件进行查询
|
|
|
|
|
|
if (verificationParams[i].isSearch) { |
|
|
|
|
|
if (verificationParams[i].isFormModel) { |
|
|
|
|
|
filters.push({ |
|
|
|
|
|
action: verificationParams[i].action, |
|
|
|
|
|
column: verificationParams[i].key, |
|
|
|
|
|
value: formRef.formModel[verificationParams[i].value] |
|
|
|
|
|
? formRef.formModel[verificationParams[i].value] |
|
|
|
|
|
: val.trim() |
|
|
|
|
|
}) |
|
|
|
|
|
} else { |
|
|
|
|
|
filters.push({ |
|
|
|
|
|
action: searchCondition[i].action || '==', |
|
|
|
|
|
column: searchCondition[i].key, |
|
|
|
|
|
value: searchCondition[i].value |
|
|
|
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
params[verificationParams[i].key] = verificationParams[i].value |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
params.value[headerItem.field] = val?.trim() |
|
|
|
|
|
// 判断改包装号是否已经添加
|
|
|
// 判断改包装号是否已经添加
|
|
|
const seen = new Set() |
|
|
const seen = new Set() |
|
|
const repeatCode = new Set() |
|
|
const repeatCode = new Set() |
|
|
let arr = tableData.map((item) => item[headerItem.field]?.trim()) |
|
|
const arr = tableData.map((item) => item[headerItem.field]?.trim()) |
|
|
arr.forEach((item) => { |
|
|
arr.forEach((item) => { |
|
|
if (seen.has(item)) { |
|
|
if (item) { |
|
|
repeatCode.add(item) |
|
|
if (seen.has(item)) { |
|
|
} else { |
|
|
repeatCode.add(item) |
|
|
seen.add(item) |
|
|
} else { |
|
|
|
|
|
seen.add(item) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
const arr1 = Array.from(repeatCode) |
|
|
const arr1 = Array.from(repeatCode) |
|
@ -119,132 +167,258 @@ export const tableFormBlurVer = async (headerItem, val, row, index,routeName,for |
|
|
row[headerItem.field] = '' |
|
|
row[headerItem.field] = '' |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
if ( |
|
|
if (filters.length > 0) { |
|
|
headerItem.field == 'fromPackingNumber' || |
|
|
params.value.isSearch = true |
|
|
headerItem.field == 'packingNumber' || |
|
|
params.value.filters = filters |
|
|
headerItem.field == 'itemCode' |
|
|
} |
|
|
) { |
|
|
const obj = { |
|
|
// 业务
|
|
|
by: 'ASC', |
|
|
// 采购退货申请,制品拆解,调拨出库,报废出库申请,合格转隔离,隔离转合格,隔离转报废,合格转报废,报废转隔离,库存移动申请,库存修改申请
|
|
|
pageNo: 1, |
|
|
if ( |
|
|
pageSize: 20 |
|
|
routeName == 'PurchasereturnRequestMain' || |
|
|
} |
|
|
routeName == 'ProductdismantleRequestMain' || |
|
|
params.value = { |
|
|
routeName == 'TransferissueRequestMain' || |
|
|
isSearch: params.value.isSearch, |
|
|
routeName == 'ScrapRequestMain' || |
|
|
filters: params.value.filters, |
|
|
routeName == 'OktoholdRequestMain' || |
|
|
...obj |
|
|
routeName == 'HoldtookRequestMain' || |
|
|
|
|
|
routeName == 'HoldtoscrapRequestMain' || |
|
|
|
|
|
routeName == 'OktoscrapRequestMain' || |
|
|
|
|
|
routeName == 'ScraptoholdRequestMain' || |
|
|
|
|
|
routeName == 'InventorymoveRequestMain' || |
|
|
|
|
|
routeName == 'InventorychangeRequestMain' |
|
|
|
|
|
) { |
|
|
|
|
|
// //合格转隔离,隔离转合格,隔离转报废,合格转报废,报废转隔离,库存移动申请参数稍有不同
|
|
|
|
|
|
// if (
|
|
|
|
|
|
// routeName == 'OktoholdRequestMain' ||
|
|
|
|
|
|
// routeName == 'HoldtookRequestMain' ||
|
|
|
|
|
|
// routeName == 'HoldtoscrapRequestMain' ||
|
|
|
|
|
|
// routeName == 'OktoscrapRequestMain' ||
|
|
|
|
|
|
// routeName == 'ScraptoholdRequestMain' ||
|
|
|
|
|
|
// routeName == 'InventorymoveRequestMain' ||
|
|
|
|
|
|
// routeName == 'InventorychangeRequestMain'
|
|
|
|
|
|
// ) {
|
|
|
|
|
|
// searchField = 'packingNumber'
|
|
|
|
|
|
// params.value.packingNumber = val?.trim()
|
|
|
|
|
|
// }
|
|
|
|
|
|
// pageApi.value = getBalanceItemListByCodes
|
|
|
|
|
|
} else if ( |
|
|
|
|
|
routeName == 'RepleinshRequestMain' || |
|
|
|
|
|
routeName == 'IssueRequestMain' || |
|
|
|
|
|
routeName == 'InventoryinitRequestMain' |
|
|
|
|
|
) { |
|
|
|
|
|
// 补料申请业务
|
|
|
|
|
|
pageApi.value = getItemListByCodes |
|
|
|
|
|
searchField = 'code' |
|
|
|
|
|
params.value.codes = val?.trim() |
|
|
|
|
|
} else if ( |
|
|
|
|
|
routeName == 'ProductionMainAssemble' || |
|
|
|
|
|
routeName == 'ProductionMainASparePart' || |
|
|
|
|
|
routeName == 'ProductionMainPredictSparePart' || |
|
|
|
|
|
routeName == 'ProductreceiptRequestMain' || |
|
|
|
|
|
routeName == 'ProductreceiptRequestMainA' || |
|
|
|
|
|
routeName == 'ProductreceiptscrapRequestMain' || |
|
|
|
|
|
routeName == 'ProductscrapRequestMain' |
|
|
|
|
|
) { |
|
|
|
|
|
// 装配计划,裝配备件计划,预备产件计划,预生产收货申请,装配收货申请,报修收货申请,制品报废申请
|
|
|
|
|
|
pageApi.value = getProductionLineCodelistByCodes |
|
|
|
|
|
params.value.productionLineCode= |
|
|
|
|
|
formRef.formModel.productionLine || formRef.formModel.productionLineCode || row.productionLine || row.productionLineCode, |
|
|
|
|
|
params.value.itemCodes=val?.trim() |
|
|
|
|
|
} |
|
|
|
|
|
} else if ( |
|
|
|
|
|
headerItem.field == 'packUnit' || |
|
|
|
|
|
headerItem.field == 'secondPackUnit' || |
|
|
|
|
|
headerItem.field == 'fromPackUnit' || |
|
|
|
|
|
headerItem.field == 'toPackUnit' |
|
|
|
|
|
) { |
|
|
|
|
|
searchField = 'packUnit' |
|
|
|
|
|
//包装规格
|
|
|
|
|
|
// 预生产收货申请,装配收货申请,报修收货申请,客户退货申请,计划外入库,计划外出库,翻包申请
|
|
|
|
|
|
if ( |
|
|
|
|
|
routeName == 'ProductreceiptRequestMain' || |
|
|
|
|
|
routeName == 'ProductreceiptRequestMainA' || |
|
|
|
|
|
routeName == 'ProductreceiptscrapRequestMain' || |
|
|
|
|
|
routeName == 'CustomerreturnRequestMain' || |
|
|
|
|
|
routeName == 'UnplannedreceiptRequestMain' || |
|
|
|
|
|
routeName == 'UnplannedissueJobMain' || |
|
|
|
|
|
routeName == 'PackageoverRequestMain' |
|
|
|
|
|
) { |
|
|
|
|
|
params.value.itemCode= row.itemCode |
|
|
|
|
|
params.value.packUnit= val?.trim() |
|
|
|
|
|
pageApi.value = getItemPackageunitListByCodes |
|
|
|
|
|
} |
|
|
|
|
|
} else if ( |
|
|
|
|
|
headerItem.field == 'supplierItemCode' |
|
|
|
|
|
) { |
|
|
|
|
|
// 生产退料申请,隔离退料申请
|
|
|
|
|
|
if ( |
|
|
|
|
|
routeName == 'ProductionreturnRequestMain' || |
|
|
|
|
|
routeName == 'ProductionreturnRequestMainNo' |
|
|
|
|
|
) { |
|
|
|
|
|
searchField = 'supplierCode' |
|
|
|
|
|
params.value.itemCodes= row.itemCode |
|
|
|
|
|
params.value.supplierCode= val?.trim() |
|
|
|
|
|
pageApi.value = getSupplierItemListByCodes |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
const list = ref() |
|
|
const list = ref() |
|
|
// 调取包装接口
|
|
|
// 调取包装接口
|
|
|
await pageApi.value(params.value).then(async (res) => { |
|
|
await headerItem.tableForm.searchPage(params.value).then(async (res) => { |
|
|
list.value = res ? res : [] |
|
|
|
|
|
|
|
|
list.value = res?.list?.length > 0 ? res.list.slice(0, 1) : [] |
|
|
// 只查一条数据,多条数据查询默认显示不存在
|
|
|
// 只查一条数据,多条数据查询默认显示不存在
|
|
|
if (res.length == 1) { |
|
|
if (list.value?.length == 0) { |
|
|
callback(searchField,list.value) |
|
|
|
|
|
} else { |
|
|
|
|
|
message.alert('代码' + row[headerItem.field] + '没有找到对应数据') |
|
|
message.alert('代码' + row[headerItem.field] + '没有找到对应数据') |
|
|
row[headerItem.field] = '' |
|
|
row[headerItem.field] = '' |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
callback(list.value) |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
if ( |
|
|
|
|
|
headerItem.field == 'fromPackingNumber' || |
|
|
|
|
|
headerItem.field == 'packingNumber' || |
|
|
|
|
|
headerItem.field == 'itemCode' || |
|
|
|
|
|
headerItem.field == 'packUnit' || |
|
|
|
|
|
headerItem.field == 'secondPackUnit' || |
|
|
|
|
|
headerItem.field == 'fromPackUnit' || |
|
|
|
|
|
headerItem.field == 'toPackUnit'|| |
|
|
|
|
|
headerItem.field == 'toPackUnit'|| |
|
|
|
|
|
headerItem.field == 'supplierItemCode' |
|
|
|
|
|
|
|
|
|
|
|
) { |
|
|
|
|
|
let searchField = headerItem.field |
|
|
|
|
|
let pageApi = ref() |
|
|
|
|
|
let params = ref() |
|
|
|
|
|
|
|
|
|
|
|
if (val && isString(val)) { |
|
|
|
|
|
// const obj = props.tableAllSchemas.tableFormColumns.find((item) => item.field == headerItem.field)
|
|
|
|
|
|
if (val.indexOf(',') > -1) { |
|
|
|
|
|
message.alert('该输入框只能输入一条数据') |
|
|
|
|
|
row[headerItem.field] = '' |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
// 校验
|
|
|
|
|
|
let params = ref({}) |
|
|
|
|
|
let searchCondition1 = headerItem.tableForm.searchCondition //获取data.ts参数信息
|
|
|
|
|
|
// 循环参数设置参数为key:value格式
|
|
|
|
|
|
if (searchCondition1 && searchCondition1.length > 0) { |
|
|
|
|
|
for (let i = 0; i < searchCondition1.length; i++) { |
|
|
|
|
|
if (searchCondition1[i].isMainValue) { |
|
|
|
|
|
params.value[searchCondition1[i].key] = formRef.formModel[ |
|
|
|
|
|
searchCondition1[i].value |
|
|
|
|
|
] |
|
|
|
|
|
? formRef.formModel[searchCondition1[i].value] |
|
|
|
|
|
: detailData |
|
|
|
|
|
? detailData[searchCondition1[i].value] |
|
|
|
|
|
: row |
|
|
|
|
|
? row[searchCondition1[i].value] |
|
|
|
|
|
: '' |
|
|
|
|
|
// 是否含有空参数情况
|
|
|
|
|
|
let isNull = false |
|
|
|
|
|
if ( |
|
|
|
|
|
params.value[searchCondition1[i].key] == '' || |
|
|
|
|
|
params.value[searchCondition1[i].key] == undefined |
|
|
|
|
|
) { |
|
|
|
|
|
isNull = true |
|
|
|
|
|
} |
|
|
|
|
|
if (isNull) { |
|
|
|
|
|
message.warning( |
|
|
|
|
|
searchCondition1[i].message ? searchCondition1[i].message : '前置条件未选择!' |
|
|
|
|
|
) |
|
|
|
|
|
row[headerItem.field] = '' |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
// 扩展 转换为筛选条件进行查询
|
|
|
|
|
|
if (searchCondition1[i].isSearch) { |
|
|
|
|
|
if (searchCondition1[i].isFormModel) { |
|
|
|
|
|
//用formModel中的值
|
|
|
|
|
|
if (searchCondition1[i].required) { |
|
|
|
|
|
if ( |
|
|
|
|
|
formRef.formModel[searchCondition1[i].value] == '' || |
|
|
|
|
|
formRef.formModel[searchCondition1[i].value] == undefined |
|
|
|
|
|
) { |
|
|
|
|
|
message.warning( |
|
|
|
|
|
searchCondition1[i].message ? searchCondition1[i].message : '前置条件未选择!' |
|
|
|
|
|
) |
|
|
|
|
|
row[headerItem.field] = '' |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
params.value[searchCondition1[i].key] = searchCondition1[i].value |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
params.value[headerItem.field] = val?.trim() |
|
|
|
|
|
// 判断改包装号是否已经添加
|
|
|
|
|
|
const seen = new Set() |
|
|
|
|
|
const repeatCode = new Set() |
|
|
|
|
|
let arr = tableData.map((item) => item[headerItem.field]?.trim()) |
|
|
|
|
|
arr.forEach((item) => { |
|
|
|
|
|
if (seen.has(item)) { |
|
|
|
|
|
repeatCode.add(item) |
|
|
|
|
|
} else { |
|
|
|
|
|
seen.add(item) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
const arr1 = Array.from(repeatCode) |
|
|
|
|
|
if (arr1.length > 0) { |
|
|
|
|
|
message.warning(`${arr1.join(',')}${t('ts.已经存在')}`) |
|
|
|
|
|
row[headerItem.field] = '' |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
if ( |
|
|
|
|
|
headerItem.field == 'fromPackingNumber' || |
|
|
|
|
|
headerItem.field == 'packingNumber' || |
|
|
|
|
|
headerItem.field == 'itemCode' |
|
|
|
|
|
) { |
|
|
|
|
|
// 业务
|
|
|
|
|
|
// 采购退货申请,制品拆解,调拨出库,报废出库申请,合格转隔离,隔离转合格,隔离转报废,合格转报废,报废转隔离,库存移动申请,库存修改申请
|
|
|
|
|
|
if ( |
|
|
|
|
|
routeName == 'PurchasereturnRequestMain' || |
|
|
|
|
|
routeName == 'ProductdismantleRequestMain' || |
|
|
|
|
|
routeName == 'TransferissueRequestMain' || |
|
|
|
|
|
routeName == 'ScrapRequestMain' || |
|
|
|
|
|
routeName == 'OktoholdRequestMain' || |
|
|
|
|
|
routeName == 'HoldtookRequestMain' || |
|
|
|
|
|
routeName == 'HoldtoscrapRequestMain' || |
|
|
|
|
|
routeName == 'OktoscrapRequestMain' || |
|
|
|
|
|
routeName == 'ScraptoholdRequestMain' || |
|
|
|
|
|
routeName == 'InventorymoveRequestMain' || |
|
|
|
|
|
routeName == 'InventorychangeRequestMain' |
|
|
|
|
|
) { |
|
|
|
|
|
// //合格转隔离,隔离转合格,隔离转报废,合格转报废,报废转隔离,库存移动申请参数稍有不同
|
|
|
|
|
|
// if (
|
|
|
|
|
|
// routeName == 'OktoholdRequestMain' ||
|
|
|
|
|
|
// routeName == 'HoldtookRequestMain' ||
|
|
|
|
|
|
// routeName == 'HoldtoscrapRequestMain' ||
|
|
|
|
|
|
// routeName == 'OktoscrapRequestMain' ||
|
|
|
|
|
|
// routeName == 'ScraptoholdRequestMain' ||
|
|
|
|
|
|
// routeName == 'InventorymoveRequestMain' ||
|
|
|
|
|
|
// routeName == 'InventorychangeRequestMain'
|
|
|
|
|
|
// ) {
|
|
|
|
|
|
// searchField = 'packingNumber'
|
|
|
|
|
|
// params.value.packingNumber = val?.trim()
|
|
|
|
|
|
// }
|
|
|
|
|
|
// pageApi.value = getBalanceItemListByCodes
|
|
|
|
|
|
} else if ( |
|
|
|
|
|
routeName == 'RepleinshRequestMain' || |
|
|
|
|
|
routeName == 'IssueRequestMain' || |
|
|
|
|
|
routeName == 'InventoryinitRequestMain' |
|
|
|
|
|
) { |
|
|
|
|
|
// 补料申请业务
|
|
|
|
|
|
pageApi.value = getItemListByCodes |
|
|
|
|
|
searchField = 'code' |
|
|
|
|
|
params.value.codes = val?.trim() |
|
|
|
|
|
} else if ( |
|
|
|
|
|
routeName == 'ProductionMainAssemble' || |
|
|
|
|
|
routeName == 'ProductionMainASparePart' || |
|
|
|
|
|
routeName == 'ProductionMainPredictSparePart' || |
|
|
|
|
|
routeName == 'ProductreceiptRequestMain' || |
|
|
|
|
|
routeName == 'ProductreceiptRequestMainA' || |
|
|
|
|
|
routeName == 'ProductreceiptscrapRequestMain' || |
|
|
|
|
|
routeName == 'ProductscrapRequestMain' |
|
|
|
|
|
) { |
|
|
|
|
|
// 装配计划,裝配备件计划,预备产件计划,预生产收货申请,装配收货申请,报修收货申请,制品报废申请
|
|
|
|
|
|
pageApi.value = getProductionLineCodelistByCodes |
|
|
|
|
|
params.value.productionLineCode= |
|
|
|
|
|
formRef.formModel.productionLine || formRef.formModel.productionLineCode || row.productionLine || row.productionLineCode, |
|
|
|
|
|
params.value.itemCodes=val?.trim() |
|
|
|
|
|
} |
|
|
|
|
|
} else if ( |
|
|
|
|
|
headerItem.field == 'packUnit' || |
|
|
|
|
|
headerItem.field == 'secondPackUnit' || |
|
|
|
|
|
headerItem.field == 'fromPackUnit' || |
|
|
|
|
|
headerItem.field == 'toPackUnit' |
|
|
|
|
|
) { |
|
|
|
|
|
searchField = 'packUnit' |
|
|
|
|
|
//包装规格
|
|
|
|
|
|
// 预生产收货申请,装配收货申请,报修收货申请,客户退货申请,计划外入库,计划外出库,翻包申请
|
|
|
|
|
|
if ( |
|
|
|
|
|
routeName == 'ProductreceiptRequestMain' || |
|
|
|
|
|
routeName == 'ProductreceiptRequestMainA' || |
|
|
|
|
|
routeName == 'ProductreceiptscrapRequestMain' || |
|
|
|
|
|
routeName == 'CustomerreturnRequestMain' || |
|
|
|
|
|
routeName == 'UnplannedreceiptRequestMain' || |
|
|
|
|
|
routeName == 'UnplannedissueJobMain' || |
|
|
|
|
|
routeName == 'PackageoverRequestMain' |
|
|
|
|
|
) { |
|
|
|
|
|
params.value.itemCode= row.itemCode |
|
|
|
|
|
params.value.packUnit= val?.trim() |
|
|
|
|
|
pageApi.value = getItemPackageunitListByCodes |
|
|
|
|
|
} |
|
|
|
|
|
} else if ( |
|
|
|
|
|
headerItem.field == 'supplierItemCode' |
|
|
|
|
|
) { |
|
|
|
|
|
// 生产退料申请,隔离退料申请
|
|
|
|
|
|
if ( |
|
|
|
|
|
routeName == 'ProductionreturnRequestMain' || |
|
|
|
|
|
routeName == 'ProductionreturnRequestMainNo' |
|
|
|
|
|
) { |
|
|
|
|
|
searchField = 'supplierCode' |
|
|
|
|
|
params.value.itemCodes= row.itemCode |
|
|
|
|
|
params.value.supplierCode= val?.trim() |
|
|
|
|
|
pageApi.value = getSupplierItemListByCodes |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
const list = ref() |
|
|
|
|
|
// 调取包装接口
|
|
|
|
|
|
await pageApi.value(params.value).then(async (res) => { |
|
|
|
|
|
list.value = res ? res : [] |
|
|
|
|
|
// 只查一条数据,多条数据查询默认显示不存在
|
|
|
|
|
|
if (res.length == 1) { |
|
|
|
|
|
callback(list.value) |
|
|
|
|
|
} else { |
|
|
|
|
|
message.alert('代码' + row[headerItem.field] + '没有找到对应数据') |
|
|
|
|
|
row[headerItem.field] = '' |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
export const FormBlur = async (field, val, routeName, formRef, detailData, formSchema, callback) => { |
|
|
export const FormBlur = async (field, val, routeName, formRef, detailData, formSchema, callback) => { |
|
|
if (formSchema.searchPage && formSchema.verificationParams) { |
|
|
if (formSchema.searchPage && formSchema.verificationParams) { |
|
|
//获取data.ts参数信息
|
|
|
//获取data.ts参数信息
|
|
|
let searchCondition = formSchema?.searchCondition || [] |
|
|
const searchCondition = formSchema?.searchCondition || [] |
|
|
//获取失去焦点参数信息
|
|
|
//获取失去焦点参数信息
|
|
|
let verificationParams = formSchema?.verificationParams || |
|
|
const verificationParams = formSchema?.verificationParams || |
|
|
[] |
|
|
[] |
|
|
console.log('走新方法啦') |
|
|
console.log('走新方法啦') |
|
|
// searchCondition = [...searchCondition, ...verificationParams]
|
|
|
// searchCondition = [...searchCondition, ...verificationParams]
|
|
|
|
|
|
|
|
|
if (val && isString(val)) { |
|
|
if (val && isString(val)) { |
|
|
let setV = {} |
|
|
const setV = {} |
|
|
setV[field] = '' |
|
|
setV[field] = '' |
|
|
let params = {} |
|
|
let params = {} |
|
|
const _searchCondition = {} |
|
|
const _searchCondition = {} |
|
|
let filters: any[] = [] |
|
|
const filters: any[] = [] |
|
|
if (searchCondition && searchCondition.length > 0) { |
|
|
if (searchCondition && searchCondition.length > 0) { |
|
|
// 转换筛选条件所需
|
|
|
// 转换筛选条件所需
|
|
|
for (let i = 0; i < searchCondition.length; i++) { |
|
|
for (let i = 0; i < searchCondition.length; i++) { |
|
@ -359,12 +533,13 @@ export const FormBlur = async (field, val, routeName, formRef, detailData, formS |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
console.log(filters) |
|
|
if (filters.length > 0) { |
|
|
if (filters.length > 0) { |
|
|
_searchCondition.isSearch = true |
|
|
_searchCondition.isSearch = true |
|
|
_searchCondition.filters = filters |
|
|
_searchCondition.filters = filters |
|
|
} |
|
|
} |
|
|
console.log(4545, _searchCondition) |
|
|
console.log(4545, _searchCondition) |
|
|
let obj = { |
|
|
const obj = { |
|
|
by: 'ASC', |
|
|
by: 'ASC', |
|
|
pageNo: 1, |
|
|
pageNo: 1, |
|
|
pageSize: 20 |
|
|
pageSize: 20 |
|
@ -382,8 +557,8 @@ export const FormBlur = async (field, val, routeName, formRef, detailData, formS |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
await formSchema.searchPage(params).then((res) => { |
|
|
await formSchema.searchPage(params).then((res) => { |
|
|
let arr1 = val.split(',') |
|
|
const arr1 = val.split(',') |
|
|
let list = ref([]) |
|
|
const list = ref([]) |
|
|
list.value = res?.list?.length > 0 ? res.list.slice(0, 1) : [] |
|
|
list.value = res?.list?.length > 0 ? res.list.slice(0, 1) : [] |
|
|
if (list.value?.length == 0) { |
|
|
if (list.value?.length == 0) { |
|
|
message.alert('暂无数据') |
|
|
message.alert('暂无数据') |
|
@ -391,8 +566,8 @@ export const FormBlur = async (field, val, routeName, formRef, detailData, formS |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
if (arr1.length != list.value.length) { |
|
|
if (arr1.length != list.value.length) { |
|
|
let arr2 = list.value.map((item) => item.code) |
|
|
const arr2 = list.value.map((item) => item.code) |
|
|
let str = [ |
|
|
const str = [ |
|
|
...arr1.filter((item) => !arr2.includes(item)), |
|
|
...arr1.filter((item) => !arr2.includes(item)), |
|
|
...arr2.filter((item) => !arr1.includes(item)) |
|
|
...arr2.filter((item) => !arr1.includes(item)) |
|
|
].join(',') |
|
|
].join(',') |
|
|