From 5a144e5fdf24c8e695fcb44d150440d301209c96 Mon Sep 17 00:00:00 2001 From: zhang_li <2235006734@qqq.com> Date: Mon, 15 Jul 2024 10:41:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=B1=E5=8E=BB=E7=84=A6=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/wms/business/business.ts | 293 ++++++++++-------- src/api/wms/location/index.ts | 4 + src/components/TableForm/src/TableForm.vue | 6 + .../itemManage/itemarea/itemarea.data.ts | 54 ++-- 4 files changed, 217 insertions(+), 140 deletions(-) diff --git a/src/api/wms/business/business.ts b/src/api/wms/business/business.ts index 6329afa0b..ea4c7bb68 100644 --- a/src/api/wms/business/business.ts +++ b/src/api/wms/business/business.ts @@ -384,141 +384,190 @@ export const FormBlur = async (formField, val,routeName,formRef,detailData,formS } // 根据下方输入框失去焦点校验信息 -export const getListByBottonInput = async (headerItem, val,row,routeName,formRef,detailData,tableData,callback) => { - 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 - } - 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] - : '' - // 是否含有空参数情况 - 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 : '前置条件未选择!' - ) - return - } - } else if (searchCondition1[i].isTableRowValue) { - if (searchCondition1[i].required) { - if (row[searchCondition1[i].value] == '' || row[searchCondition1[i].value] == undefined) { +export const getListByBottonInput = async (headerItem, val, row, routeName, formRef, detailData, tableData, callback) => { + let tableFormSchemaObj = headerItem?.tableForm + console.log(333,tableFormSchemaObj) + if (tableFormSchemaObj.searchPage && tableFormSchemaObj.verificationParams) { + let params = ref({}) + let list = ref([]) + console.log(3344) + let searchCondition1 = headerItem.tableForm.searchCondition //获取data.ts参数信息 + let verificationParams = headerItem.tableForm.verificationParams //获取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] + : '' + // 是否含有空参数情况 + 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 : '前置条件未选择!' ) return } - } - row[searchCondition1[i].value] - //查询当前table表数据的值 - params.value[searchCondition1[i].key] = row[searchCondition1[i].value] - } 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 : '前置条件未选择!' - ) - return + } else if (searchCondition1[i].isTableRowValue) { + if (searchCondition1[i].required) { + if (row[searchCondition1[i].value] == '' || row[searchCondition1[i].value] == undefined) { + message.warning( + searchCondition1[i].message ? searchCondition1[i].message : '前置条件未选择!' + ) + return + } + } + row[searchCondition1[i].value] + //查询当前table表数据的值 + params.value[searchCondition1[i].key] = row[searchCondition1[i].value] + } 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 : '前置条件未选择!' + ) + return + } } + } else { + params.value[searchCondition1[i].key] = searchCondition1[i].value } - }else { + } else { params.value[searchCondition1[i].key] = searchCondition1[i].value } - } else { - params.value[searchCondition1[i].key] = searchCondition1[i].value } } } - } - await pageApi.value(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) - } - }) + 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() } - if(repeatCode.length>0){ - message.warning(`${t('ts.代码')}${repeatCode.join(',')}${t('ts.已经存在')}`); - return; + } else if ( + routeName == 'ZZBJDeliverPlanMain' || + routeName == 'DeliverPlanMain' || + routeName == 'DeliverRequestMain' || + routeName == 'ZZBJDeliverRequestMain' + ) { + // 自制备件发货计划,发货计划,成品发货申请,自制备件发货申请 + pageApi.value = getCustomerItemListByCodes + params.value = { + customerCode: formRef.formModel.customerCode, + itemCodes: val?.trim() } - callback(list.value) } - }) + // 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) => { + 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) + } + }) + + } + } diff --git a/src/api/wms/location/index.ts b/src/api/wms/location/index.ts index 3870b46d7..36cf3f575 100644 --- a/src/api/wms/location/index.ts +++ b/src/api/wms/location/index.ts @@ -136,3 +136,7 @@ export const selectConfigToLocation = async (params) => { return request.get({ url: `/wms/location/pageConfigToLocation`, params }) } } +// 根据code获取数据列表 +export const getLocationByCodes = async (params) => { + return await request.get({ url: `/wms/location/listByCodes`, params }) +} \ No newline at end of file diff --git a/src/components/TableForm/src/TableForm.vue b/src/components/TableForm/src/TableForm.vue index 502cd36e1..e977306f3 100644 --- a/src/components/TableForm/src/TableForm.vue +++ b/src/components/TableForm/src/TableForm.vue @@ -402,6 +402,8 @@