From c1f18a40402f75760c8a1ebeb4b09544be0b4888 Mon Sep 17 00:00:00 2001 From: tk Date: Fri, 12 Jul 2024 19:37:29 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=B1=BB=09=E5=9E=8B=E3=80=91?= =?UTF-8?q?=EF=BC=9Afactor=20=E3=80=90=E4=B8=BB=09=E9=A2=98=E3=80=91?= =?UTF-8?q?=EF=BC=9A=E5=88=A4=E6=96=AD=E9=A3=9E=E6=9C=BA=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E5=B7=B2=E7=BB=8F=E6=8C=82=E8=BD=BD=E4=BB=BB=E5=8A=A1=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=9A=E4=B9=8B=E5=89=8D=E7=94=A8?= =?UTF-8?q?=E7=AB=99=E7=82=B9=E8=A1=A8=E7=9A=84runing=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=88=A4=E6=96=AD=20=E6=AF=94=E8=BE=83=E9=BA=BB=E7=83=A6?= =?UTF-8?q?=E6=95=88=E7=8E=87=E4=BD=8E=20=09[=E8=BF=87=E7=A8=8B]=EF=BC=9A?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E7=94=A8=E8=AE=A2=E5=8D=95=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E7=9A=84by=5Fplane=5Fid=E5=AD=97=E6=AE=B5=E5=88=A4=E6=96=AD=20?= =?UTF-8?q?=09[=E5=BD=B1=E5=93=8D]=EF=BC=9A=20=E3=80=90=E7=BB=93=09?= =?UTF-8?q?=E6=9D=9F=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 | 85 +++++++++++++++---------------- 1 file changed, 40 insertions(+), 45 deletions(-) diff --git a/src/components/ControllerTabs.vue b/src/components/ControllerTabs.vue index b7a7240..0fc79c9 100644 --- a/src/components/ControllerTabs.vue +++ b/src/components/ControllerTabs.vue @@ -56,7 +56,7 @@ - + @@ -66,15 +66,22 @@ + - - 注册航线 - - - 提交任务 + 上传航点 @@ -306,7 +313,7 @@ export default { return plane ? this.$store.state.paidOrderList.filter((item) => item.shop_id === plane.shop_id && item.shipment_status === '已发货') : [] }, /** - * @description: 当前选中的订单 + * @description: 当前选框 中的订单 */ currentOrder () { if (this.questForm && this.questForm.id !== undefined) { @@ -314,6 +321,13 @@ export default { } return null }, + /** + * @description: 当前执行的订单 + */ + executeOrder () { + const plane = this.plane + return plane ? this.ShippedList.find((item) => item.by_plane_id === plane.id) : null + }, /** * @description: 航线列表 */ @@ -401,11 +415,7 @@ export default { * @description: 执行任务前 先检测订单是否 合法 例如:订单重量会不会超出飞机载重上限 */ checkQuest () { - if (this.questForm.id === '') { - this.$message.error('未选择订单任务!') - return - } - if (!this.currentOrder) { + if (!this.currentOrder && !this.executeOrder) { this.$message.error('此订单已被申请退款或者订单已经被取消!') return } @@ -503,7 +513,7 @@ export default { } let res = await this.$store.dispatch('fetchLockSite', { id: this.currentOrder.receive_site_id, shop_id: this.plane.shop_id, runing: newRuning })// 航线注册飞机 锁定送餐点 if (res.data.status === 1) { - res = await this.questAss(this.currentOrder.id, 'shipment_status', '已发货')// 订单改为发货状态 并更新订单列表 + res = await this.questAss(this.currentOrder.id, ['shipment_status', 'by_plane_id'], ['已发货', this.plane.id])// 订单改为发货状态和执行订 并更新订单列表 if (res.data.status === 1) { this.publishFun(routeData)// 发送航点信息主题 this.speakText('提交任务,注册航线。') @@ -578,7 +588,7 @@ export default { 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 => { // 注销航线 + this.questAss(orderId, ['shipment_status', 'by_plane_id'], ['已接单', '']).then(res => { // 注销航线 if (res.data.status === 1) { this.publishFun('{"resetState":1}')// 发送设置飞机状态主题 状态设为闲置 } @@ -591,8 +601,8 @@ export default { }) }, /** - * @description: 已送达任务 - */ + * @description: 已送达任务 + */ overQuest () { if (!this.airLock) { // 只有飞机锁定状态 才向量下执行 "已送达"操作 this.$message.warning('当前没有执行任务') @@ -676,20 +686,11 @@ export default { } }, created () { - // 初始化 - // 当站点列表 航线列表都载入之后 判断飞机的锁定状态airLock - if (this.siteList && this.routeList) { - this.airLock = this.siteList.some(item => { - if (item.runing) { - const runingArray = item.runing.split(',').map(str => str.trim()) // 将 item.runing 分割成数组并去除空格 - return runingArray.includes(this.plane.id.toString()) // 比较数组中的元素和 this.plane.id - } - return false - }) - } - // 主动获取飞机状态 - if (this.plane) { - this.publishFun('{getPlaneState:1}') + // 判断当前飞机有没有挂载的任务 判断是否是锁定状态 + if (this.executeOrder === null) { + this.airLock = false + } else { + this.airLock = true } }, watch: { @@ -704,15 +705,6 @@ export default { this.$store.dispatch('fetchPaidOrderList')// 刷新订单列表 this.$store.dispatch('fetchSiteList')// 刷新站点列表 }, - siteList (val) { - this.airLock = this.siteList.some(item => { - if (item.runing) { - const runingArray = (item.runing ?? '').split(',').map(str => str.trim()) // 将 item.runing 分割成数组并去除空格 - return runingArray.includes(this.plane.id.toString()) // 比较数组中的元素和 this.plane.id - } - return false - }) - }, questList (val) { /* 任务列表更新时 判断还有没有当前选择的id 没有就清空 */ const found = val.some(item => item.id === this.questForm.id) @@ -720,12 +712,15 @@ export default { this.questForm.id = '' } }, - plane (val) { - this.publishFun('{getPlaneState:1}') - }, - ShippedList (val) { - // console.log(val) + executeOrder (val) { + // 判断当前飞机有没有挂载的任务 判断是否是锁定状态 + if (val === null) { + this.airLock = false + } else { + this.airLock = true + } } + } }