diff --git a/src/views/distribution/artery/AddVehicleStowage.vue b/src/views/distribution/artery/AddVehicleStowage.vue index 04dbfea9..9c0e569a 100644 --- a/src/views/distribution/artery/AddVehicleStowage.vue +++ b/src/views/distribution/artery/AddVehicleStowage.vue @@ -1969,8 +1969,10 @@ const addSubmit = async () => { } }; -/** 修改提交 */ -const editSubmit = async () => { +/** 修改提交 + * @param isEnd {Boolean} 是否将当前节点编辑为最终节点 + */ +const editSubmit = async (isEnd = false) => { try { btnLoadingObj.submitBtn = true; const _warehouseIds = []; @@ -2019,13 +2021,23 @@ const editSubmit = async () => { // 拷贝数据 -- 编辑时获取的原始数据 const _cloneNodeList = deepClone(details.nodeCloneInfoData); + if (isEnd) { + const _lastNode = submitData.addCarsLoadLineList[submitData.addCarsLoadLineList.length - 1]; + + // 将所有前节点的装车数据挂载在本仓库 + for (let i = 0; i < details.problemDataByReal.length; i++) { + const value = details.problemDataByReal[i]; + + if (value.nodeId === details.warehouseId) continue; + _lastNode.lineCarsOrderList.push(value); + } + } + // 循环节点数据 for (let i = 0; i < submitData.addCarsLoadLineList.length; i++) { const val = submitData.addCarsLoadLineList[i]; val.addList || (val.addList = []); - console.log('val :>> ', val); - val.nodeType = '1'; val.sort = i + 1; @@ -2048,19 +2060,6 @@ const editSubmit = async () => { // 新增的订单 const _addArr = []; - // for (let index = 0; index < val.lineCarsOrderList.length; index++) { - // const element = val.lineCarsOrderList[index]; - - // _addArr.push({ - // ...element, - // nodeId: submitData.startWarehouseId, - // nodeName: submitData.startWarehouseName, - // finalNodeId: val.nodeId, - // }); - // } - - // val.MappingData = []; - // } else { // 浅拷贝数据 let _MappingData = _item.MappingData || []; @@ -2117,8 +2116,6 @@ const editSubmit = async () => { for (let index = 0; index < nodeInfokeys.length; index++) { const value = nodeInfokeys[index]; - console.log('_item[value] === val[value] :>> ', _item[value] === val[value]); - if (_item[value] === val[value]) continue; isUpDateNodeCost = true; break; @@ -2250,24 +2247,54 @@ const nodeCostSubmit = async () => { /** 提交 */ const handleSubmit = (formEl: FormInstance | undefined) => { + if (btnLoadingObj.submitBtn) return; + if (!formEl) return; + if (details.nodeInfoData.length <= 1) return ElMessage.warning('最少存在一个目的仓'); - if (details.problemDataByReal.length > 0) { - details.problemInfo.activeName = 'real'; - handleShowProblemData(); + const _driverType = Number(details.form.driverType); + + if ((_driverType === 3 || _driverType === 4) && !details.form.outDriverPerson) + return ElMessage.warning('请输入外请人'); + + if (Number(details.pageType) === 2) { + if (details.active === details.nodeInfoData.length - 1) { + // 当配载节点编辑将当前节点编辑为最终节点时 + ElMessageBox.confirm('', '提示', { + message: h('p', null, [ + h( + 'span', + { style: 'color: red' }, + '确认将当前节点编辑为最终节点,当前仓操作的装车数据和计划数据将被移除,后续节点的装车数据的目的仓将更改为本仓,是否确认提交?' + ), + ]), + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + center: true, + }).then(async () => { + try { + details.loadingObj.pageLoading = true; + await editSubmit(true); + } catch (error) { + console.log('error :>> ', error); + } finally { + details.loadingObj.pageLoading = false; + } + }); + + return; + } else if (details.problemDataByReal.length > 0) { + // 正常编辑, 但存在装车数据未挂载目的仓时 + details.problemInfo.activeName = 'real'; + handleShowProblemData(); - return ElMessage.warning('存在装车数据未挂载目的仓,请处理后提交'); + return ElMessage.warning('存在装车数据未挂载目的仓,请处理后提交'); + } } - if (btnLoadingObj.submitBtn) return; - if (!formEl) return; formEl.validate((valid, fields) => { if (valid) { - const _driverType = Number(details.form.driverType); - - if ((_driverType === 3 || _driverType === 4) && !details.form.outDriverPerson) - return ElMessage.warning('请输入外请人'); - ElMessageBox.confirm('是否确认提交?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', diff --git a/src/views/distribution/artery/VehicleArrivalManagement.vue b/src/views/distribution/artery/VehicleArrivalManagement.vue index 410262dc..00d3a8c7 100644 --- a/src/views/distribution/artery/VehicleArrivalManagement.vue +++ b/src/views/distribution/artery/VehicleArrivalManagement.vue @@ -298,7 +298,7 @@