From e7a8ebb4999cbeecd520c97235af862c7ec65125 Mon Sep 17 00:00:00 2001 From: szdot Date: Sat, 13 Jul 2024 22:35:44 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=B1=BB=09=E5=9E=8B=E3=80=91?= =?UTF-8?q?=EF=BC=9Afix=20=E3=80=90=E4=B8=BB=09=E9=A2=98=E3=80=91=EF=BC=9A?= =?UTF-8?q?=E9=A3=9E=E6=9C=BA=E6=93=8D=E4=BD=9C=E6=A8=A1=E5=9D=97=20?= =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BB=BB=E5=8A=A1=E5=87=BD=E6=95=B0=20?= =?UTF-8?q?=E3=80=90=E6=8F=8F=09=E8=BF=B0=E3=80=91=EF=BC=9A=20=09[?= =?UTF-8?q?=E5=8E=9F=E5=9B=A0]=EF=BC=9Arequest=E5=87=BD=E6=95=B0=20?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=E8=AE=A2=E5=8D=95=E7=9A=84=20=E9=80=BB?= =?UTF-8?q?=E8=BE=91bug(=E5=88=86=E5=89=B2=E4=B9=8B=E5=90=8E=E5=8F=96?= =?UTF-8?q?=E4=B8=8B=E6=A0=87=E8=AE=A2=E5=8D=95id=20=E5=B0=91+1)=20=09[?= =?UTF-8?q?=E8=BF=87=E7=A8=8B]=EF=BC=9A=E4=BB=8EexecuteOrder=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E5=B1=9E=E6=80=A7=E9=87=8C=E9=9D=A2=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=20=E6=8B=BF=E8=AE=A2=E5=8D=95=E4=BF=A1=E6=81=AF=20=09[?= =?UTF-8?q?=E5=BD=B1=E5=93=8D]=EF=BC=9A=20=E3=80=90=E7=BB=93=09=E6=9D=9F?= =?UTF-8?q?=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动 --- src/components/ControllerTabs.vue | 45 +++++++++++++------------------ 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/src/components/ControllerTabs.vue b/src/components/ControllerTabs.vue index fd1879a..be33dc4 100644 --- a/src/components/ControllerTabs.vue +++ b/src/components/ControllerTabs.vue @@ -678,33 +678,26 @@ export default { type: 'warning' }).then(() => { /* 关联当前订单的站点 搜寻注册的飞机 并预设newRuning 用于注销runing字段航线 */ - let newRuning // 确保newRuning在函数块外定义 - let receiveSiteId - let orderId - const found = this.ShippedList.some((element) => { - const runing = (element.runing ?? '').split(',') - return runing.some((item, index, arr) => { - if (item === this.plane.id.toString()) { - arr[index] = '' // 将匹配的id替换为空字符串 - newRuning = runing.join(',') - orderId = element.id - receiveSiteId = element.receive_site_id - return true // 找到id后退出内层循环 - } - }) - }) - /* 确认 把订单从发货退回到已接单 站点runing字段飞机航线注销 重置飞机状态 */ - if (found) { - this.$store.dispatch('fetchLockSite', { id: receiveSiteId, shop_id: this.plane.shop_id, runing: newRuning }).then(res => { // 订单改为已完成状态 - if (res.data.status === 1) { - this.questAss(orderId, 'shipment_status', '已送达').then(res => { // 注销航线 - if (res.data.status === 1) { - this.publishFun('{"resetState":1}')// 发送设置飞机状态主题 状态设为闲置 - } - }) - } - }) + // 分割字符串成数组 + const runingArray = this.executeOrder.runing.split(',') + // 遍历数组并替换相等的值 + for (let i = 0; i < runingArray.length; i++) { + if (runingArray[i] === this.executeOrder.by_plane_id) { + runingArray[i] = '' + } } + // 将数组重新组合成字符串 + const newRuning = runingArray.join(',') + /* 确认 把订单从发货退回到已接单 站点runing字段飞机航线注销 重置飞机状态 */ + this.$store.dispatch('fetchLockSite', { id: this.executeOrder.receive_site_id, shop_id: this.plane.shop_id, runing: newRuning }).then(res => { // 订单改为已完成状态 + if (res.data.status === 1) { + this.questAss(this.executeOrder.id, 'shipment_status', '已送达').then(res => { // 注销航线 + if (res.data.status === 1) { + this.publishFun('{"resetState":1}')// 发送设置飞机状态主题 状态设为闲置 + } + }) + } + }) }).catch(() => { this.$message.info('取消操作!') })