无人机管理后台前端(已迁走)
张含笑
2025-09-03 9090ff42fb118b91817e162718c2684cc20e042d
src/views/device/airport.vue
@@ -74,6 +74,11 @@
                  <el-dropdown-item command="d"><el-button type="primary" text icon="el-icon-collection" v-if="permission.fly_device_offline"
                        @click.stop="rollFirmware(scope.row)">固件版本管理</el-button>
                  </el-dropdown-item>
                  <el-dropdown-item command="d">
                    <el-button type="primary" text icon="el-icon-collection" v-if="!scope.row.status" @click.stop="dockNotLine(scope.row)">
                      {{ scope.row.hidden_flag == 1 ? '设备上线' : '设备下线'}}
                    </el-button>
                  </el-dropdown-item>
                  <el-dropdown-item command="e"><el-button type="primary" text icon="el-icon-document-delete" v-if="permission.fly_device_offline"
                    @click.stop="handleDeviceOffline(scope.row)">注销</el-button>
                  </el-dropdown-item>
@@ -190,7 +195,8 @@
  ota,
  getDeviceFirmwareList,
  getDevices,
  deviceOffline
  deviceOffline,
  devicesUpdate
} from '@/api/device/device'
import { deleteByOssId, addOrUpdate as addOrUpdateOssBind } from '@/api/device/ossBind'
import { getListPage as getOssList } from '@/api/resource/oss'
@@ -280,6 +286,7 @@
        searchMenuSpan: 6,
        border: true,
        index: true,
        indexLabel: '序号',
        viewBtn: true,
        delBtn: false,
        selection: true,
@@ -295,14 +302,15 @@
          {
            label: '设备类型',
            prop: 'domain',
            editDisabled: true,
            editDisabled: false,
            editDisplay: false, //编辑显示
            viewDisplay: true, //查看显示
            viewDisplay: false, //查看显示
            search: false,
            slot: true,
            searchSpan: 4,
            labelWidth: 130,
            width: 120,
            // formatter: (row) => row.domain == 3 ? '机巢' : '无人机'
            // rules: [
            //   {
            //     required: true,
@@ -310,6 +318,16 @@
            //     trigger: 'blur',
            //   },
            // ],
          },
          {
            label: '设备类型',
            prop: 'domainTxt',
            editDisabled: true,
            editDisplay: false, //编辑显示
            viewDisplay: true, //查看显示
            labelWidth: 130,
            width: 120,
            hide: true
          },
          {
            label: '设备型号',
@@ -361,7 +379,7 @@
            label: '设备名称',
            prop: 'nickname',
            labelWidth: 130,
            width: 100,
            width: 160,
            searchSpan: 4,
            search: true,
            overHidden: true,
@@ -382,7 +400,7 @@
            editDisplay: false, //编辑显示
            viewDisplay: false, //查看显示
            labelWidth: 130,
            width: 100,
            width: 200,
          },
          {
            label: '设备位置',
@@ -459,12 +477,12 @@
          //     },
          //   ],
          // },
          {
            label: '负载设备',
            prop: 'payload_str',
            labelWidth: 130,
            width: 100,
            width: 160,
            overHidden: true,
            editDisabled: true,
            // rules: [
@@ -608,13 +626,14 @@
          //     },
          //   ],
          // },
          {
            hide: true,
            // hide: true,
            label: '保险有效期',
            prop: 'duration_of_insurance',
            labelWidth: 130,
            width: 160,
            type: 'daterange',
            format: 'YYYY-MM-DD',
            valueFormat: 'YYYY-MM-DD HH:mm:ss',
@@ -926,6 +945,27 @@
        that.$refs.firmwareManage.init(row)
      })
    },
    // 设备下线
    dockNotLine(row) {
      let txt = row.hidden_flag === 1?'上线':'下线'
      ElMessageBox.confirm(`确定${txt}该设备吗?`, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      })
        .then(() => {
          let hidden_flag = row.hidden_flag === 1?0:1
          devicesUpdate({id:row.id, hidden_flag:hidden_flag})
            .then(res => {
              ElMessage.success('下线成功')
              this.init()
            })
            .catch(error => {
              ElMessage.error('下线失败')
            })
        })
        .catch(() => { })
    },
    // 版本回退点击事件
    rollFirmware (row) {
      if (row.status == 0) {
@@ -1204,7 +1244,9 @@
        insure_start_time: row.duration_of_insurance[0],
        insure_expired_time: row.duration_of_insurance[1],
      }
      if (submitData.traffic_expire_time === '') {
        delete submitData.traffic_expire_time
      }
      delete submitData.duration_of_insurance
      update(submitData).then(
@@ -1306,7 +1348,8 @@
            area_code: await this.getFullAreaCode(data.area_code),
            area_name: this.form.area_name,
            cnmode_code: this.getDockModeText(this.form.mode_code),
            domain: data.domain === 0 ? '无人机' : data.domain === 3 ? '机巢' : '未知',
            // domain: data.domain === 0 ? '无人机' : data.domain === 3 ? '机巢' : '未知',
            domainTxt: data.domain === 0 ? '无人机' : data.domain === 3 ? '机巢' : '未知',
            cnstatus: this.form.status === false ? '离线' : '在线',
            duration_of_insurance: [data?.insure_start_time || '', data?.insure_expired_time || ''],
          }
@@ -1349,6 +1392,7 @@
          if (e.firmware_status == 4) {
            this.connectWebSocket(e)
          }
          e.duration_of_insurance = [e.insure_start_time || '', e.insure_expired_time || '']
        })
        this.data = data.records
        this.loading = false