From dafe5ec117d522d898a0c59de93259fb2280bb5a Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Thu, 04 Dec 2025 23:07:50 +0800
Subject: [PATCH] feat:更新设备升级状态
---
src/views/device/airport.vue | 106 ++++++++++++++++++++++++++++++++--------------------
1 files changed, 65 insertions(+), 41 deletions(-)
diff --git a/src/views/device/airport.vue b/src/views/device/airport.vue
index e336b6c..5afaf84 100644
--- a/src/views/device/airport.vue
+++ b/src/views/device/airport.vue
@@ -299,6 +299,7 @@
rollFirmVersion: '',
firmList: [],
rollFirmwareBox: false,
+ isUpdateDrone: false,
// 用于记录已经创建的websocket,防止重复创建
webSocketIdSet: new Set(),
// 用于保存多组websocket
@@ -410,6 +411,46 @@
],
},
{
+ label: '设备状态',
+ prop: 'mode_code',
+ addDisplay: false,
+ editDisplay: false,
+ viewDisplay: false,
+ labelWidth: 145,
+ searchSpan: 4,
+ search: true,
+ type: 'select',
+ dicData: [
+ { label: '在线', value: 0 },
+ { label: '离线', value: -1 },
+ { label: '远程调试', value: 2 },
+ { label: '现场调试', value: 1 },
+ { label: '固件升级中', value: 3 }
+ ],
+ slot: true,
+ width: 110,
+
+ rules: [
+ {
+ required: true,
+ message: '请输入机场状态',
+ trigger: 'blur',
+ },
+ ],
+ },
+ {
+ label: '固件升级',
+ prop: 'firmware_status',
+ labelWidth: 145,
+ width: 100,
+ // hide: true,
+ viewDisabled: true,
+ addDisabled: true,
+ editDisplay: false, //编辑显示
+ addDisplay: false,
+ viewDisplay: false,
+ },
+ {
label: '4G增强',
prop: 'link_workmode',
labelWidth: 145,
@@ -503,46 +544,7 @@
labelWidth: 145,
width: 110,
},
- {
- label: '设备状态',
- prop: 'mode_code',
- addDisplay: false,
- editDisplay: false,
- viewDisplay: false,
- labelWidth: 145,
- searchSpan: 4,
- search: true,
- type: 'select',
- dicData: [
- { label: '在线', value: 0 },
- { label: '离线', value: -1 },
- { label: '远程调试', value: 2 },
- { label: '现场调试', value: 1 },
- { label: '固件升级中', value: 3 }
- ],
- slot: true,
- width: 110,
-
- rules: [
- {
- required: true,
- message: '请输入机场状态',
- trigger: 'blur',
- },
- ],
- },
- {
- label: '固件升级',
- prop: 'firmware_status',
- labelWidth: 145,
- width: 100,
- // hide: true,
- viewDisabled: true,
- addDisabled: true,
- editDisplay: false, //编辑显示
- addDisplay: false,
- viewDisplay: false,
- },
+
{
label: '设备SN',
prop: 'device_sn',
@@ -876,6 +878,9 @@
return
}
console.log(loadData.data.output.progress.percent, '6666')
+ if(loadData.data.output.progress.percent < 10) {
+ this.onLoad(this.page)
+ }
this.data.forEach((e, index) => {
if ((e.device_sn == loadData.data.sn || e.child_sn == loadData.data.sn) && loadData.data.output.status == 'in_progress') {
e.firmware_progress = loadData.data.output.progress.percent
@@ -1008,6 +1013,7 @@
},
// 版本回退点击事件
rollFirmware(row) {
+ console.log(this.data,row, '打印看看值')
if (row.status == 0) {
this.$message({
type: 'warning',
@@ -1027,6 +1033,7 @@
}
var that = this
this.rollFirmwareBox = true
+ // this.isUpdateDrone = row.domain === 0 ? true :false
const param = {
device_name: row.device_name,
}
@@ -1132,6 +1139,7 @@
// 需要改变的版本号和无人机版本号如果是一致,进行单独的机场升级/回滚操作
}
}
+
ota(that.firmwareInfo.workspaceId, arr).then(res => {
that.firmwareVersion = ''
that.firmwareInfo = {}
@@ -1140,7 +1148,22 @@
type: 'success',
message: '操作成功!',
})
- this.onLoad(this.page)
+ // 此处需分是无人机升级还是机巢升级版本
+ console.log('看看是无人机更新还是机场更新',that.firmwareInfo.domain)
+ if(that.firmwareInfo.domain == 3) {
+ this.onLoad(this.page)
+ } else {
+ console.log(111)
+ this.data.map(item => {
+ if(item.workspace_id === that.firmwareInfo.workspaceId) {
+ item.firmware_status = 4
+ item.children[0].mode_code = 3
+ this.connectWebSocket(item)
+ console.log('无人机更新中',item)
+ }
+ })
+ }
+ // 获取保存的 resolve 函数===== 此处需要更新子集塞入父级
// done()
})
},
@@ -1461,6 +1484,7 @@
...item,
firmware_progress: 0
}));
+ console.log('2222',this.data)
this.loading = false
this.selectionClear()
})
--
Gitblit v1.9.3