【类 型】:refactor

【主	题】:飞机控制组件修改
【描	述】:
	[原因]:节流
	[过程]:飞机信息通过 父级监听 传参过来
	[影响]:
【结	束】

# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
This commit is contained in:
tk 2024-07-11 13:52:41 +08:00
parent 1fa449130e
commit b1c47a17e4
3 changed files with 19 additions and 29 deletions

View File

@ -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
}
}

View File

@ -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,

View File

@ -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
},