【类 型】: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>
|
||||||
<el-form-item label="飞机操作">
|
<el-form-item label="飞机操作">
|
||||||
<el-button-group>
|
<el-button-group>
|
||||||
<el-button size="mini" class="f-s-14" v-if="planeState.state & 1 && airLock" key="pubBut" type="info"
|
<el-button size="mini" class="f-s-14" v-if="plane.planeState.state & 1 && airLock" key="pubBut"
|
||||||
icon="iconfont el-icon-loading" disabled>
|
type="info" icon="iconfont el-icon-loading" disabled>
|
||||||
<font class="m-l-5">注册航线</font>
|
<font class="m-l-5">注册航线</font>
|
||||||
</el-button>
|
</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">
|
icon="f-s-14 iconfont icon-chakanzhihangrizhi" @click="checkQuest">
|
||||||
<font class="m-l-5">提交任务</font>
|
<font class="m-l-5">提交任务</font>
|
||||||
</el-button>
|
</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>
|
:loading="true" disabled>
|
||||||
<font class="m-l-5">航点写入中···</font>
|
<font class="m-l-5">航点写入中···</font>
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button size="mini" class="f-s-14" v-if="planeState.state & 4 && !(planeState.state & 16)"
|
<el-button size="mini" class="f-s-14"
|
||||||
type="warning" icon="f-s-14 iconfont icon-jiesuo"
|
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('解锁飞机')">
|
@click="publishFun('{setPlaneState:{bit:3,state:1,count:2,param:[1,0]}}'); speakText('解锁飞机')">
|
||||||
<font class="m-l-5">解锁飞机</font>
|
<font class="m-l-5">解锁飞机</font>
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button size="mini" class="f-s-14"
|
<el-button size="mini" class="f-s-14"
|
||||||
v-if="planeState.state & 16 && !(planeState.state & 1) && !(planeState.state & 2)" type="success"
|
v-if="plane.planeState.state & 16 && !(plane.planeState.state & 1) && !(plane.planeState.state & 2)"
|
||||||
icon="f-s-14 iconfont icon-yangshi_icon_tongyong_departure"
|
type="success" icon="f-s-14 iconfont icon-yangshi_icon_tongyong_departure"
|
||||||
@click="publishFun('{setPlaneState:{bit:5,state:1}'); speakText('准备起飞,执行送餐任务')">
|
@click="publishFun('{setPlaneState:{bit:5,state:1}'); speakText('准备起飞,执行送餐任务')">
|
||||||
<font class="m-l-5">执行任务</font>
|
<font class="m-l-5">执行任务</font>
|
||||||
</el-button>
|
</el-button>
|
||||||
@ -274,9 +275,7 @@ export default {
|
|||||||
questForm: { // 送餐任务表单
|
questForm: { // 送餐任务表单
|
||||||
id: ''
|
id: ''
|
||||||
},
|
},
|
||||||
planesId: this.$route.params.id, // 飞机id
|
airLock: false // 当前飞机是否被锁定
|
||||||
airLock: false, // 当前飞机是否被锁定
|
|
||||||
planeState: {}// 飞机状态
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
@ -469,7 +468,7 @@ export default {
|
|||||||
let selIndex // 记录执行飞机注册的索引 此索引对应 要使用的航线的索引
|
let selIndex // 记录执行飞机注册的索引 此索引对应 要使用的航线的索引
|
||||||
runing.some((item, index, arr) => {
|
runing.some((item, index, arr) => {
|
||||||
if (item === '') {
|
if (item === '') {
|
||||||
arr[index] = this.planesId
|
arr[index] = this.plane.id
|
||||||
foundEmpty = true
|
foundEmpty = true
|
||||||
selIndex = index
|
selIndex = index
|
||||||
return true // 找到空位后退出循环
|
return true // 找到空位后退出循环
|
||||||
@ -557,7 +556,7 @@ export default {
|
|||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.overQuestList.forEach((item) => {
|
this.overQuestList.forEach((item) => {
|
||||||
if (item.runing === this.planesId) {
|
if (item.runing === this.plane.id) {
|
||||||
/* 插入日志 */
|
/* 插入日志 */
|
||||||
this.$store.dispatch('fetchLog', { content: `订单ID:${item.id},送餐任务取消。` })
|
this.$store.dispatch('fetchLog', { content: `订单ID:${item.id},送餐任务取消。` })
|
||||||
/* 执行写在这里 */
|
/* 执行写在这里 */
|
||||||
@ -586,7 +585,7 @@ export default {
|
|||||||
}).then(() => {
|
}).then(() => {
|
||||||
// 确认执行
|
// 确认执行
|
||||||
this.questList.map((item) => {
|
this.questList.map((item) => {
|
||||||
if (item.runing === this.planesId) { // 找出当前飞机正在执行的任务
|
if (item.runing === this.plane.id) { // 找出当前飞机正在执行的任务
|
||||||
/* 插入日志 */
|
/* 插入日志 */
|
||||||
this.$store.dispatch('fetchLog', { content: `订单ID:${item.id} 送餐任务已完成。` })
|
this.$store.dispatch('fetchLog', { content: `订单ID:${item.id} 送餐任务已完成。` })
|
||||||
/* 执行写在这里 */
|
/* 执行写在这里 */
|
||||||
@ -609,7 +608,7 @@ export default {
|
|||||||
let found = false
|
let found = false
|
||||||
this.siteList.some(item => {
|
this.siteList.some(item => {
|
||||||
const runing = item.runing.split(',')
|
const runing = item.runing.split(',')
|
||||||
const index = runing.indexOf(this.planesId.toString())
|
const index = runing.indexOf(this.plane.id.toString())
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
found = true
|
found = true
|
||||||
// 获取航点信息
|
// 获取航点信息
|
||||||
@ -647,7 +646,7 @@ export default {
|
|||||||
this.airLock = this.siteList.some(item => {
|
this.airLock = this.siteList.some(item => {
|
||||||
if (item.runing) {
|
if (item.runing) {
|
||||||
const runingArray = item.runing.split(',').map(str => str.trim()) // 将 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
|
return false
|
||||||
})
|
})
|
||||||
@ -669,7 +668,7 @@ export default {
|
|||||||
this.airLock = this.siteList.some(item => {
|
this.airLock = this.siteList.some(item => {
|
||||||
if (item.runing) {
|
if (item.runing) {
|
||||||
const runingArray = item.runing.split(',').map(str => str.trim()) // 将 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
|
return false
|
||||||
})
|
})
|
||||||
@ -680,12 +679,6 @@ export default {
|
|||||||
if (!found) {
|
if (!found) {
|
||||||
this.questForm.id = ''
|
this.questForm.id = ''
|
||||||
}
|
}
|
||||||
},
|
|
||||||
plane: {
|
|
||||||
handler (val) {
|
|
||||||
this.planeState = val.planeState// 实时更新飞机数据
|
|
||||||
},
|
|
||||||
deep: true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ export default {
|
|||||||
// 实例化map
|
// 实例化map
|
||||||
this.map = new mapboxgl.Map({
|
this.map = new mapboxgl.Map({
|
||||||
container: 'map',
|
container: 'map',
|
||||||
style: this.GaodeRasterStyle,
|
style: this.GoogleRasterStyle,
|
||||||
center: this.defaultLnglat,
|
center: this.defaultLnglat,
|
||||||
zoom: this.defaultZoom,
|
zoom: this.defaultZoom,
|
||||||
pitch: 0,
|
pitch: 0,
|
||||||
|
@ -97,12 +97,9 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
/**
|
|
||||||
* @description: 有飞机数据之后 在地图上创建飞机
|
|
||||||
*/
|
|
||||||
plane: {
|
plane: {
|
||||||
handler (val) {
|
handler (val) {
|
||||||
this.makePlane(val)
|
this.makePlane(val)// 有飞机数据之后 在地图上创建飞机
|
||||||
},
|
},
|
||||||
deep: true
|
deep: true
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user