【类 型】:refactor
【主 题】:飞机控制组件修改 【描 述】: [原因]:节流 [过程]:飞机信息通过 父级监听 传参过来 [影响]: 【结 束】 # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动
This commit is contained in:
parent
1fa449130e
commit
b1c47a17e4
@ -68,26 +68,27 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="飞机操作">
|
||||
<el-button-group>
|
||||
<el-button size="mini" class="f-s-14" v-if="planeState.state & 1 && airLock" key="pubBut" type="info"
|
||||
icon="iconfont el-icon-loading" disabled>
|
||||
<el-button size="mini" class="f-s-14" v-if="plane.planeState.state & 1 && airLock" key="pubBut"
|
||||
type="info" icon="iconfont el-icon-loading" disabled>
|
||||
<font class="m-l-5">注册航线</font>
|
||||
</el-button>
|
||||
<el-button size="mini" class="f-s-14" v-if="planeState.state & 1 && !airLock" type="primary"
|
||||
<el-button size="mini" class="f-s-14" v-if="plane.planeState.state & 1 && !airLock" type="primary"
|
||||
icon="f-s-14 iconfont icon-chakanzhihangrizhi" @click="checkQuest">
|
||||
<font class="m-l-5">提交任务</font>
|
||||
</el-button>
|
||||
<el-button size="mini" class="f-s-14" v-if="planeState.state & 2" key="wirteBut" type="info"
|
||||
<el-button size="mini" class="f-s-14" v-if="plane.planeState.state & 2" key="wirteBut" type="info"
|
||||
:loading="true" disabled>
|
||||
<font class="m-l-5">航点写入中···</font>
|
||||
</el-button>
|
||||
<el-button size="mini" class="f-s-14" v-if="planeState.state & 4 && !(planeState.state & 16)"
|
||||
type="warning" icon="f-s-14 iconfont icon-jiesuo"
|
||||
<el-button size="mini" class="f-s-14"
|
||||
v-if="plane.planeState.state & 4 && !(plane.planeState.state & 16)" type="warning"
|
||||
icon="f-s-14 iconfont icon-jiesuo"
|
||||
@click="publishFun('{setPlaneState:{bit:3,state:1,count:2,param:[1,0]}}'); speakText('解锁飞机')">
|
||||
<font class="m-l-5">解锁飞机</font>
|
||||
</el-button>
|
||||
<el-button size="mini" class="f-s-14"
|
||||
v-if="planeState.state & 16 && !(planeState.state & 1) && !(planeState.state & 2)" type="success"
|
||||
icon="f-s-14 iconfont icon-yangshi_icon_tongyong_departure"
|
||||
v-if="plane.planeState.state & 16 && !(plane.planeState.state & 1) && !(plane.planeState.state & 2)"
|
||||
type="success" icon="f-s-14 iconfont icon-yangshi_icon_tongyong_departure"
|
||||
@click="publishFun('{setPlaneState:{bit:5,state:1}'); speakText('准备起飞,执行送餐任务')">
|
||||
<font class="m-l-5">执行任务</font>
|
||||
</el-button>
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user