diff --git a/src/api/distribution/TripartiteTransfer.js b/src/api/distribution/TripartiteTransfer.js index 64ca64fe..1e4efdb8 100644 --- a/src/api/distribution/TripartiteTransfer.js +++ b/src/api/distribution/TripartiteTransfer.js @@ -120,3 +120,14 @@ export const postTripartiteTransferUploadSignPhoto = data => { data, }); }; + +/** + * 上传签收图片 + */ +export const postTripartiteTransferStartCarsBefore = data => { + return request({ + url: '/api/logpm-trunkline/tripartiteTransfer/startCarsBefore', + method: 'post', + data, + }); +}; diff --git a/src/components/popupnotification/popupnotification.vue b/src/components/popupnotification/popupnotification.vue index ae85b15f..d7d4c808 100644 --- a/src/components/popupnotification/popupnotification.vue +++ b/src/components/popupnotification/popupnotification.vue @@ -30,8 +30,13 @@ diff --git a/src/main.js b/src/main.js index 8877ec7d..8ef30020 100644 --- a/src/main.js +++ b/src/main.js @@ -32,6 +32,7 @@ import TripartiteTransferPrintTemplate from './components/TripartiteTransferPrin import ImgList from './components/ImgList/ImgList.vue'; import MyPrint from './components/MyPrint/MyPrint.vue'; import MyUpload from './components/MyUpload/MyUpload.vue'; +import DeleteWarningDialog from './components/popupnotification/popupnotification.vue'; import { message } from './utils/resetMessage'; import FileslicingPlugin from './utils/Fileslicing.js'; import App from './App.vue'; @@ -69,6 +70,8 @@ app.component('WaybillPrintTemplate', WaybillPrintTemplate); app.component('ArteryPrintTemplate', ArteryPrintTemplate); /** 三方运输打印模版 */ app.component('TripartiteTransferPrintTemplate', TripartiteTransferPrintTemplate); +/** 警告提示 */ +app.component('DeleteWarningDialog', DeleteWarningDialog); app.component('ImgList', ImgList); app.config.globalProperties.$dayjs = dayjs; app.config.globalProperties.$functions = functions; diff --git a/src/views/distribution/artery/TripartiteTransfer.vue b/src/views/distribution/artery/TripartiteTransfer.vue index bf9c8afb..a3e14de1 100644 --- a/src/views/distribution/artery/TripartiteTransfer.vue +++ b/src/views/distribution/artery/TripartiteTransfer.vue @@ -136,14 +136,14 @@ - 取消发车 - + --> - - - - - -
- - 配置目的地 - - - - - - - -
-
- - - - - - - - - - - - - + + + + + ({ popUpShow: { /** 到达确认 */ confirmArriveVisited: false, - /** 配置目的地 */ - truckLoadingDetailVisited: false, - /** 选择目的地弹窗 */ - chooseDestinationVisited: false, /** 结算弹窗 */ closeAnAccountVisited: false, /** 装载清单 */ @@ -731,20 +633,6 @@ const details = reactive({ /** 装载清单 */ listOfLoadedWagonsPopUp: false, }, - packageColumnList: deepClone(packageColumnList), - /** 配置装车目的地数据 */ - packageData: [], - /** 配置装车目的地数据 -- 渲染数据 */ - packageRenderData: [], - /** 后续装车目的地 */ - nextNodeData: [], - /** 配置目的地 -- 被选中的数据 */ - packageSelectedData: [], - /** 被修改的数据 */ - modifyData: [], - /** 被选中的数据 */ - chooseNodeId: '', - packageQuery: {}, /** 结算金额表单 */ closeAnAccountForm: { number: 0 }, listOfLoadedWagonsData: {}, @@ -964,7 +852,6 @@ const showdrawer = (_flag?: boolean, _type?: string) => { console.log('123 :>> ', 123); details.editColumnList = details.columnList; break; - // details. } details.drawerShow = _flag; }; @@ -982,11 +869,11 @@ const inputsc = (index, row) => { if (index === '') delete details.query[row.prop]; if (row.prop === 'carsNo') { details.query.loadCarsNo = index; - if (!index && index !== 0) delete details.query[row.prop]; + if (!index && index !== 0) delete details.query['loadCarsNo']; } if (row.prop === 'carsLineName') { details.query.warehouseName = index; - if (!index && index !== 0) delete details.query[row.prop]; + if (!index && index !== 0) delete details.query['carsLineName']; } onLoad(); }; @@ -1119,7 +1006,11 @@ const submitConfirmArrive = async () => { type: 'warning', }); } + details.popUpShow.confirmArriveVisited = false; + try { + details.loadingObj.pageLoading = true; + const submitData = { loadId: details.selectionList.map(val => val.id).join(','), ...details.form, @@ -1135,42 +1026,31 @@ const submitConfirmArrive = async () => { type: 'success', message: '到达成功', }); - details.popUpShow.confirmArriveVisited = false; } catch (error) { console.log('error :>> ', error); + } finally { + details.loadingObj.pageLoading = false; } }; -/** 发车 */ -const handleConfirmStartCar = () => { - if (details.selectionList.length === 0) { - return ElMessage({ - message: '请选择发车数据', - type: 'warning', - }); - } else if (details.selectionList.length !== 1) { - return ElMessage({ - message: '仅支持单条数据操作', - type: 'warning', - }); - } - ElMessageBox.confirm('确认发车吗?', '提示', { - confirmButtonText: '确认', - cancelButtonText: '取消', - type: 'warning', - }).then(async () => { - const _arr = []; +/** 发车提交 */ +const startCar = async () => { + try { + details.popUpShow.tipVisted = true; + details.loadingObj.pageLoading = true; - for (let index = 0; index < details.selectionList.length; index++) { - const item = details.selectionList[index]; + // const _arr = []; - if (item.realLoadingNumber === 0) return ElMessage.warning('存在未装车数据'); + // for (let index = 0; index < details.selectionList.length; index++) { + // const item = details.selectionList[index]; - _arr.push(item.id); - } + // if (item.realLoadingNumber === 0) return ElMessage.warning('存在未装车数据'); + + // _arr.push(item.id); + // } const submitData = { - loadId: _arr.join(','), + loadId: details.selectionList[0].id, }; const res = await postStartCars(submitData); @@ -1183,99 +1063,62 @@ const handleConfirmStartCar = () => { message: '发车成功', }); onLoad(); - }); -}; - -/** 开启弹窗 */ -const handleOpenConfiguration = (type: 'one' | 'batch', data = {} as any) => { - if (type === 'batch' && details.packageSelectedData.length === 0) - return ElMessage.warning('最少选择一条数据'); - details.modifyData = type === 'one' ? [data.row] : details.packageSelectedData; - details.popUpShow.chooseDestinationVisited = true; -}; - -/** 配置装车目的地 */ -const handleEditSubmit = () => { - const chooseItem = details.nextNodeData.find(val => val.warehouseId === details.chooseNodeId); - - for (const iterator of details.modifyData) { - iterator.nodeName = chooseItem.warehouseName; - iterator.nodeId = chooseItem.warehouseId; - } - - details.popUpShow.chooseDestinationVisited = false; -}; - -/** 移除 */ -const removePackage = async ({ row }) => { - try { - details.loadingObj.truckLoadingDetailPopUpLoading = true; - - const submitData = { - orderCode: row.orderCode, - carsLoadScanIds: row.id, - }; - - const res = await postRemoveCarsLoadScan(submitData); - if (res.data.code !== 200) return; - ElMessage.success(res.data.msg || '移除成功'); - - await handleConfirmStartCar(); } catch (error) { console.log('error :>> ', error); } finally { - details.loadingObj.truckLoadingDetailPopUpLoading = false; + details.loadingObj.pageLoading = false; } }; -/** 确认配置 */ -const handleSubmit = async () => { - details.loadingObj.truckLoadingDetailPopUpLoading = true; +/** 发车 */ +const handleConfirmStartCar = async () => { try { - const submitData = { - loadId: details.selectionList[0].id, - loadScanFinalNodeIdList: [], - }; - - details.packageData.forEach(val => { - if (val.nodeId) - submitData.loadScanFinalNodeIdList.push({ loadScanId: val.id, finalNodeId: val.nodeId }); - }); - - const res = await postUpdateLoadScanFinalNodeIdById(submitData); + details.loadingObj.pageLoading = true; - if (res.data.code !== 200) return; - details.popUpShow.truckLoadingDetailVisited = false; - } catch (error) { - console.log('error :>> ', error); - } finally { - details.loadingObj.truckLoadingDetailPopUpLoading = false; - } -}; + if (details.selectionList.length === 0) { + return ElMessage({ + message: '请选择发车数据', + type: 'warning', + }); + } else if (details.selectionList.length !== 1) { + return ElMessage({ + message: '仅支持单条数据操作', + type: 'warning', + }); + } -/** 输入筛选 */ -const packageInputsc = (value, row) => { - // 动态设置正则 - const reg = new RegExp('^' + value); + const res = await postTripartiteTransferStartCarsBefore({ + loadId: details.selectionList[0].id, + }); - details.packageQuery[row.prop] = reg; + const { code, data } = res.data; - if (value === '') delete details.packageQuery[row.prop]; + if (code !== 200 || getObjType(data) !== 'object') return; - if (Object.keys(details.packageQuery).length === 0) - return (details.packageRenderData = details.packageData); + if (!data.loadingNum) return ElMessage.warning('未存在装车数据,无法发车'); + if (!data.unloadNum) return ElMessage.warning('未存在卸车数据,无法发车'); - const _data = details.packageData.filter(item => { - let _flag = true; - for (let key in details.packageQuery) { - if (!details.packageQuery[key].test(item[key])) _flag = false; - if (!_flag) break; + // 装车和卸车数据一致, 正常发车 + if (data.loadingNum === data.unloadNum) { + ElMessageBox.confirm('确认发车吗?', '提示', { + confirmButtonText: '确认', + cancelButtonText: '取消', + type: 'warning', + }).then(async () => { + startCar(); + }); + return; } - return _flag; - }); + // 异常提示 + details.popUpShow.tipVisted = true; - details.packageRenderData = _data; + // ElMessage.warning('存在未卸完数据') + } catch (error) { + console.log('error :>> ', error); + } finally { + details.loadingObj.pageLoading = false; + } }; /** 取消发车 */ @@ -1296,20 +1139,28 @@ const handleCancelStartCar = () => { cancelButtonText: '取消', type: 'warning', }).then(async () => { - const submitData = { - loadId: details.selectionList.map(val => val.id).join(','), - }; + try { + details.loadingObj.pageLoading = true; - const res = await postCancelStartCars(submitData); - const { code } = res.data; - if (code !== 200) { - return; + const submitData = { + loadId: details.selectionList.map(val => val.id).join(','), + }; + + const res = await postCancelStartCars(submitData); + const { code } = res.data; + if (code !== 200) { + return; + } + ElMessage({ + type: 'success', + message: '取消发车成功', + }); + onLoad(); + } catch (error) { + console.log('error :>> ', error); + } finally { + details.loadingObj.pageLoading = false; } - ElMessage({ - type: 'success', - message: '取消发车成功', - }); - onLoad(); }); }; @@ -1331,20 +1182,28 @@ const handleTheClerkSignsForIt = ({ row }) => { cancelButtonText: '取消', type: 'success', }).then(async () => { - const submitData = { - loadId: row.id, - }; + try { + details.loadingObj.pageLoading = true; - const res = await postSignCars(submitData); - const { code } = res.data; - if (code !== 200) { - return; + const submitData = { + loadId: row.id, + }; + + const res = await postSignCars(submitData); + const { code } = res.data; + if (code !== 200) { + return; + } + ElMessage({ + type: 'success', + message: '签收成功', + }); + onLoad(); + } catch (error) { + console.log('error :>> ', error); + } finally { + details.loadingObj.pageLoading = false; } - ElMessage({ - type: 'success', - message: '签收成功', - }); - onLoad(); }); }; @@ -1358,18 +1217,26 @@ const handleShowCloseAnAccount = ({ row }) => { /** 结算提交 */ const handleSubmitCloseAnAccount = async () => { try { - const submitData = { - loadId: details.closeAnAccountForm.id, - settlementValue: details.closeAnAccountForm.number, - }; - const res = await postSettlementCars(submitData); - - const { code, data } = res.data; - if (code !== 200) return; - - ElMessage.success('结算成功'); - details.popUpShow.closeAnAccountVisited = false; - initPage(); + try { + details.loadingObj.pageLoading = true; + + const submitData = { + loadId: details.closeAnAccountForm.id, + settlementValue: details.closeAnAccountForm.number, + }; + const res = await postSettlementCars(submitData); + + const { code, data } = res.data; + if (code !== 200) return; + + ElMessage.success('结算成功'); + details.popUpShow.closeAnAccountVisited = false; + initPage(); + } catch (error) { + console.log('error :>> ', error); + } finally { + details.loadingObj.pageLoading = false; + } } catch (error) { console.log('error :>> ', error); } finally { diff --git a/src/views/distribution/deliverylist/distributionDeliveryListedt.vue b/src/views/distribution/deliverylist/distributionDeliveryListedt.vue index e4d37f2b..d0e86ae0 100644 --- a/src/views/distribution/deliverylist/distributionDeliveryListedt.vue +++ b/src/views/distribution/deliverylist/distributionDeliveryListedt.vue @@ -966,27 +966,22 @@ - - - - - - - + + + @@ -1014,10 +1009,10 @@ import { $_loadingAbnormalPackageListTurnDown, $_retentionScan, } from '@/api/distribution/distributionDeliveryList'; -import{compressImageBlob } from '@/components/IMGcompressor/imgcompressor.js' +import { compressImageBlob } from '@/components/IMGcompressor/imgcompressor.js'; import { showOrderPackgeCode } from '@/api/distribution/distributionStockArticle'; import { exportBlob } from '@/api/common'; -import DeleteWarningDialog from '@/components/popupnotification/popupnotification.vue' +import DeleteWarningDialog from '@/components/popupnotification/popupnotification.vue'; import { downloadXls } from '@/utils/util'; import { dateNow } from '@/utils/date'; import NProgress from 'nprogress'; @@ -1047,16 +1042,16 @@ import { setNodeHeight } from '@/utils/util.js'; import { AbnormalReview } from '@/option/distribution/DeliveryExceptionReview.js'; import print from '@/utils/print'; import { useStore } from 'vuex'; -import { Delete, Edit, Search, Share, Upload } from '@element-plus/icons-vue' +import { Delete, Edit, Search, Share, Upload } from '@element-plus/icons-vue'; export default { components: { - DeleteWarningDialog + DeleteWarningDialog, }, data() { return { - DataRwo:{}, - popupnotification:false,// - Deleteloading:false, + DataRwo: {}, + popupnotification: false, // + Deleteloading: false, ViRejectselect: [ { value: true, @@ -4605,56 +4600,53 @@ export default { }, // 取消备货接口 - Cancelstocking(data){ + Cancelstocking(data) { this.loading = true; cancelReservationPackage(data) - .then(res => { - if (res.data.code === 200) { - this.$message.success(res.data.msg); - this.getReservationInventoryPackageListInfo(this.page); - } - }) - .catch(error => { - console.log(error); - - }).finally(()=>{ - this.loading = false; - }); - }, - // 确认删除备货 - confirmdelete(){ - + .then(res => { + if (res.data.code === 200) { + this.$message.success(res.data.msg); + this.getReservationInventoryPackageListInfo(this.page); + } + }) + .catch(error => { + console.log(error); + }) + .finally(() => { + this.loading = false; + }); }, + // 确认删除备货 + confirmdelete() {}, // 关闭 - handleDialogClose(){ - this.popupnotification=false + handleDialogClose() { + this.popupnotification = false; }, // 确定事件 - handleDialogConfirm(){ + handleDialogConfirm() { this.loading = true; //开启加载 - let data = { - deliveryId: this.deliveryId, - reservationId: this.wid, - type: 2, - packageIds:'', - }; - if(this.selectionList.length){ - data.packageIds= this.selectionList.map(item => item.id).join(',');//批量取消 - }else{ - data.packageIds= this.DataRwo.id;//单个取消 - } - this.Cancelstocking(data) - this.popupnotification=false; - + let data = { + deliveryId: this.deliveryId, + reservationId: this.wid, + type: 2, + packageIds: '', + }; + if (this.selectionList.length) { + data.packageIds = this.selectionList.map(item => item.id).join(','); //批量取消 + } else { + data.packageIds = this.DataRwo.id; //单个取消 + } + this.Cancelstocking(data); + this.popupnotification = false; }, // 计划取消 cancelReservationInventoryPackage(row) { - this.DataRwo=row - console.log(row) - if(row.stockStatus ==20 || row.stockStatusName =="已备货"){ - this.popupnotification=true - return - } + this.DataRwo = row; + console.log(row); + if (row.stockStatus == 20 || row.stockStatusName == '已备货') { + this.popupnotification = true; + return; + } this.$confirm('是否计划取消?') .then(() => { this.loading = true; //开启加载 @@ -4664,7 +4656,7 @@ export default { type: 2, packageIds: row.id, }; - this.Cancelstocking(data) + this.Cancelstocking(data); }) .catch(() => {}); }, @@ -5085,11 +5077,13 @@ export default { return; } // 查询是否有已经备货的 - let StockupState= this.selectionList.find(item=>item.stockStatus == 20 || item.stockStatusName =="已备货") - if(StockupState){ - this.popupnotification=true - return - } + let StockupState = this.selectionList.find( + item => item.stockStatus == 20 || item.stockStatusName == '已备货' + ); + if (StockupState) { + this.popupnotification = true; + return; + } this.$confirm('是否进行批量计划取消?') .then(() => { @@ -5693,7 +5687,6 @@ export default { }); }, - //一键签收 handleSignone(row) { if (row.isHaveAbnormalPackage == 2) {