From b1c47a17e4e4c340000078c11d2f433ce777110d Mon Sep 17 00:00:00 2001 From: tk Date: Thu, 11 Jul 2024 13:52:41 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=B1=BB=09=E5=9E=8B=E3=80=91?= =?UTF-8?q?=EF=BC=9Arefactor=20=E3=80=90=E4=B8=BB=09=E9=A2=98=E3=80=91?= =?UTF-8?q?=EF=BC=9A=E9=A3=9E=E6=9C=BA=E6=8E=A7=E5=88=B6=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E3=80=90=E6=8F=8F=09=E8=BF=B0=E3=80=91?= =?UTF-8?q?=EF=BC=9A=20=09[=E5=8E=9F=E5=9B=A0]=EF=BC=9A=E8=8A=82=E6=B5=81?= =?UTF-8?q?=20=09[=E8=BF=87=E7=A8=8B]=EF=BC=9A=E9=A3=9E=E6=9C=BA=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E9=80=9A=E8=BF=87=20=E7=88=B6=E7=BA=A7=E7=9B=91?= =?UTF-8?q?=E5=90=AC=20=E4=BC=A0=E5=8F=82=E8=BF=87=E6=9D=A5=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 | 39 ++++++++----------- src/components/MapBox.vue | 2 +- .../layout/components/main/planes/index.vue | 7 +--- 3 files changed, 19 insertions(+), 29 deletions(-) diff --git a/src/components/ControllerTabs.vue b/src/components/ControllerTabs.vue index 1739987..b37c776 100644 --- a/src/components/ControllerTabs.vue +++ b/src/components/ControllerTabs.vue @@ -68,26 +68,27 @@ - + 注册航线 - 提交任务 - 航点写入中··· - 解锁飞机 执行任务 @@ -274,9 +275,7 @@ export default { questForm: { // 送餐任务表单 id: '' }, - planesId: this.$route.params.id, // 飞机id - airLock: false, // 当前飞机是否被锁定 - planeState: {}// 飞机状态 + airLock: false // 当前飞机是否被锁定 } }, props: { @@ -469,7 +468,7 @@ export default { let selIndex // 记录执行飞机注册的索引 此索引对应 要使用的航线的索引 runing.some((item, index, arr) => { if (item === '') { - arr[index] = this.planesId + arr[index] = this.plane.id foundEmpty = true selIndex = index return true // 找到空位后退出循环 @@ -557,7 +556,7 @@ export default { type: 'warning' }).then(() => { this.overQuestList.forEach((item) => { - if (item.runing === this.planesId) { + if (item.runing === this.plane.id) { /* 插入日志 */ this.$store.dispatch('fetchLog', { content: `订单ID:${item.id},送餐任务取消。` }) /* 执行写在这里 */ @@ -586,7 +585,7 @@ export default { }).then(() => { // 确认执行 this.questList.map((item) => { - if (item.runing === this.planesId) { // 找出当前飞机正在执行的任务 + if (item.runing === this.plane.id) { // 找出当前飞机正在执行的任务 /* 插入日志 */ this.$store.dispatch('fetchLog', { content: `订单ID:${item.id} 送餐任务已完成。` }) /* 执行写在这里 */ @@ -609,7 +608,7 @@ export default { let found = false this.siteList.some(item => { const runing = item.runing.split(',') - const index = runing.indexOf(this.planesId.toString()) + const index = runing.indexOf(this.plane.id.toString()) if (index !== -1) { found = true // 获取航点信息 @@ -647,7 +646,7 @@ export default { this.airLock = this.siteList.some(item => { if (item.runing) { const runingArray = item.runing.split(',').map(str => str.trim()) // 将 item.runing 分割成数组并去除空格 - return runingArray.includes(this.planesId.toString()) // 比较数组中的元素和 this.planesId + return runingArray.includes(this.plane.id.toString()) // 比较数组中的元素和 this.plane.id } return false }) @@ -669,7 +668,7 @@ export default { this.airLock = this.siteList.some(item => { if (item.runing) { const runingArray = item.runing.split(',').map(str => str.trim()) // 将 item.runing 分割成数组并去除空格 - return runingArray.includes(this.planesId.toString()) // 比较数组中的元素和 this.planesId + return runingArray.includes(this.plane.id.toString()) // 比较数组中的元素和 this.plane.id } return false }) @@ -680,12 +679,6 @@ export default { if (!found) { this.questForm.id = '' } - }, - plane: { - handler (val) { - this.planeState = val.planeState// 实时更新飞机数据 - }, - deep: true } } diff --git a/src/components/MapBox.vue b/src/components/MapBox.vue index 9f7e401..a75a678 100644 --- a/src/components/MapBox.vue +++ b/src/components/MapBox.vue @@ -146,7 +146,7 @@ export default { // 实例化map this.map = new mapboxgl.Map({ container: 'map', - style: this.GaodeRasterStyle, + style: this.GoogleRasterStyle, center: this.defaultLnglat, zoom: this.defaultZoom, pitch: 0, diff --git a/src/views/layout/components/main/planes/index.vue b/src/views/layout/components/main/planes/index.vue index d749aa9..0bd73a8 100644 --- a/src/views/layout/components/main/planes/index.vue +++ b/src/views/layout/components/main/planes/index.vue @@ -20,7 +20,7 @@ export default { return { mapBoxKey: '', // 初始化一个变量用于控制map-box组件的重新渲染 planesId: this.$route.params.id, - localCount: 0// 本地存储计数器 + localCount: 0 // 本地存储计数器 } }, components: { @@ -97,12 +97,9 @@ export default { } }, watch: { - /** - * @description: 有飞机数据之后 在地图上创建飞机 - */ plane: { handler (val) { - this.makePlane(val) + this.makePlane(val)// 有飞机数据之后 在地图上创建飞机 }, deep: true },