feat:修改启动任务后自动切换到进行中的面板

This commit is contained in:
wangxueshen 2026-01-28 16:06:42 +08:00
parent 1d043819b4
commit 3d1b473bf7
4 changed files with 59 additions and 41 deletions

View File

@ -2,7 +2,7 @@ window.config = {
env: 'offline', //online env: 'offline', //online
//api: 'http://127.0.0.1:9116/', // 外网服务器, //api: 'http://127.0.0.1:9116/', // 外网服务器,
api: 'http://192.168.43.127:9116', api: 'http://192.168.43.127:9116',
// socket: 'http://127.0.0.1:9116', 外网服务器, socket: 'http://192.168.43.127:9116', //外网服务器,
imagePath: 'http://192.168.112.181:9000/files', imagePath: 'http://192.168.112.181:9000/files',
arithmeticPath: 'http://127.0.0.1:18090/ktkx/UavPlanning/SAR', arithmeticPath: 'http://127.0.0.1:18090/ktkx/UavPlanning/SAR',
tokenKey: 'accessToken', tokenKey: 'accessToken',

View File

@ -5,7 +5,7 @@ import { lodLayer, viewer } from '@/components/dt-scene/index.vue'
import SceneInfo from '@/mixin/scene-info' import SceneInfo from '@/mixin/scene-info'
import LeftSlide from '@/components/LeftSlide.vue' import LeftSlide from '@/components/LeftSlide.vue'
import { mapGetters } from 'vuex' import { mapGetters, mapMutations } from 'vuex'
import * as DT from 'dt-sdk' import * as DT from 'dt-sdk'
import { ICON_MODE } from '@/enum' import { ICON_MODE } from '@/enum'
@ -652,6 +652,7 @@ export default {
taskUavCollection = {} taskUavCollection = {}
}, },
methods: { methods: {
...mapMutations('app', ['SET_MENUS_CHOSE']),
// #region 任务启动部分代码迁移 // #region 任务启动部分代码迁移
reRunTask(info) { reRunTask(info) {
if (info.status !== 2) return if (info.status !== 2) return
@ -664,27 +665,29 @@ export default {
if (res.data.code === 200) { if (res.data.code === 200) {
console.log('重新运行结果', res) console.log('重新运行结果', res)
this.$message.success('任务重新执行成功') this.$message.success('任务重新执行成功')
let data = res.data.data this.getList()
data.check = data.status === 1 this.SET_MENUS_CHOSE('1')
data.statusName = this.jobStatus[data.status + ''] // let data = res.data.data
data.uavList.forEach(child => { // data.check = data.status === 1
if (!child.trailList) { // data.statusName = this.jobStatus[data.status + '']
child.trailList = [] // data.uavList.forEach(child => {
} // if (!child.trailList) {
child.jobName = data.name // child.trailList = []
}) // }
this.taskList.data.unshift({ // child.jobName = data.name
id: data.id, // })
beginTime: data.beginTime, // this.taskList.data.unshift({
check: data.check, // id: data.id,
endTime: data.endTime, // beginTime: data.beginTime,
mode: data.mode, // check: data.check,
name: data.name, // endTime: data.endTime,
status: data.status, // mode: data.mode,
statusName: data.statusName, // name: data.name,
}) // status: data.status,
taskListResource.unshift(data) // statusName: data.statusName,
this.addUavToScene(data) // })
// taskListResource.unshift(data)
// this.addUavToScene(data)
// this.addTaskPlanArea(data.pointList, data.id, data.name) // this.addTaskPlanArea(data.pointList, data.id, data.name)
} else { } else {
this.$message.error(res.data.message) this.$message.error(res.data.message)
@ -700,8 +703,9 @@ export default {
}).then(res => { }).then(res => {
stopTaskFly({ id: info.id }).then(res => { stopTaskFly({ id: info.id }).then(res => {
if (res.data.code === 200) { if (res.data.code === 200) {
info.status = 2 // info.status = 2
info.statusName = this.jobStatus[info.status + ''] this.getList()
// info.statusName = this.jobStatus[info.status + '']
this.$message.success('任务已结束!') this.$message.success('任务已结束!')
} else { } else {
this.$message.error(res.data.message) this.$message.error(res.data.message)
@ -718,16 +722,17 @@ export default {
}).then(res => { }).then(res => {
flyTaskUavCommand({ id: info.id }).then(res => { flyTaskUavCommand({ id: info.id }).then(res => {
if (res.data.code === 200) { if (res.data.code === 200) {
info.status = 1 // info.status = 1
info.check = false // info.check = false
info.statusName = this.jobStatus[info.status + ''] // info.statusName = this.jobStatus[info.status + '']
this.toggleTaskSceneShow(info, index) // this.toggleTaskSceneShow(info, index)
this.taskList.data.forEach((child, childIndex) => { // this.taskList.data.forEach((child, childIndex) => {
if (child.check && child.status === 2) { // if (child.check && child.status === 2) {
this.toggleTaskSceneShow(child, childIndex) // this.toggleTaskSceneShow(child, childIndex)
} // }
}) // })
this.$message.success('起飞成功') this.$message.success('起飞成功')
this.SET_MENUS_CHOSE('1')
} else { } else {
this.$message.error(res.data.message) this.$message.error(res.data.message)
} }
@ -735,6 +740,8 @@ export default {
}) })
}, },
toggleTaskSceneShow(info, index) { toggleTaskSceneShow(info, index) {
console.log(5555555555);
if (info.check) { if (info.check) {
info.check = false; info.check = false;
taskListResource[index].check = false taskListResource[index].check = false
@ -953,6 +960,7 @@ export default {
status: item.status, status: item.status,
statusName: item.statusName, statusName: item.statusName,
}) })
this.removeTaskTarget(item.id)
}) })
taskListResource = data taskListResource = data
this.taskList.data = list this.taskList.data = list

View File

@ -425,6 +425,7 @@ export default {
'taskFlightMode', 'taskFlightMode',
'detectType', 'detectType',
'jobStatus', 'jobStatus',
'menusChose'
]), ]),
isIconModeLarge() { isIconModeLarge() {
return this.iconMode === ICON_MODE.LARGE return this.iconMode === ICON_MODE.LARGE
@ -442,6 +443,8 @@ export default {
visibleLocale(nv) { visibleLocale(nv) {
if (!nv) { if (!nv) {
this.$emit('update:visible', false) this.$emit('update:visible', false)
alert(7777777)
} }
}, },
sceneComplete: { sceneComplete: {
@ -528,11 +531,7 @@ export default {
if (handler) { if (handler) {
handler.removeInputAction(DT.Cesium.ScreenSpaceEventType.LEFT_CLICK) handler.removeInputAction(DT.Cesium.ScreenSpaceEventType.LEFT_CLICK)
} }
if (stompClientInstance) {
disconnectWebSocket(stompClientInstance)
socketInstance = null
stompClientInstance = null
}
viewer.entities.removeAll() viewer.entities.removeAll()
// if (broadcastChannel) { // if (broadcastChannel) {
// this.closeBroadcastChannel() // this.closeBroadcastChannel()
@ -546,6 +545,11 @@ export default {
radarSceneEntity = {} radarSceneEntity = {}
sceneEntity = {} sceneEntity = {}
taskListResource = [] taskListResource = []
if (stompClientInstance) {
disconnectWebSocket(stompClientInstance)
socketInstance = null
stompClientInstance = null
}
}, },
methods: { methods: {
...mapMutations('scene-control', [ ...mapMutations('scene-control', [
@ -1055,7 +1059,7 @@ export default {
}) })
// this.startWebSocket() // this.startWebSocket()
// this.createWebsocket() this.createWebsocket()
}, },
toggleRightShow() { toggleRightShow() {
@ -1110,6 +1114,11 @@ export default {
}) })
taskListResource = data taskListResource = data
this.taskList.data = list this.taskList.data = list
this.taskList.data[0].check = true
if (this.menusChose === '1') {
this.addUavToScene(data[0])
this.addTaskPlanArea(data[0].pointList, data[0].id, data[0].name)
}
} else { } else {
this.$message.error(res.data.message) this.$message.error(res.data.message)
} }
@ -1547,7 +1556,7 @@ export default {
stopTaskFly({ id: info.id }).then(res => { stopTaskFly({ id: info.id }).then(res => {
if (res.data.code === 200) { if (res.data.code === 200) {
info.status = 2 info.status = 2
info.statusName = this.jobStatus[info.status + ''] this.getTaskList()
this.$message.success('任务已结束!') this.$message.success('任务已结束!')
} else { } else {
this.$message.error(res.data.message) this.$message.error(res.data.message)

View File

@ -604,6 +604,7 @@ export default {
linePicture = {} linePicture = {}
currentPicture = null currentPicture = null
aisCollection = [] aisCollection = []
}, },
methods: { methods: {
...mapMutations('scene-control', [ ...mapMutations('scene-control', [