无人机管理后台前端(已迁走)
罗广辉
2025-09-13 634ee52cd4997cd50688ef5eda6c2cc86ea03cb4
src/views/device/airport.vue
@@ -57,7 +57,7 @@
      </template>
      <template #menu="scope">
        <el-dropdown>
              <el-button type="primary" text icon="el-icon-folder-opened" v-if="permission.oss_set">更 多</el-button>
          <el-button type="primary" text v-if="permission.oss_set"><el-icon><MoreFilled /></el-icon>更多</el-button>
              <template #dropdown v-if="scope.row.domain == 3">
                <el-dropdown-menu teleported>
                  <el-dropdown-item command="a">
@@ -126,11 +126,12 @@
      <el-input v-model="operate_password" disabled></el-input>
    </el-dialog>
    <el-dialog title="注销" append-to-body v-model="cancenOperate" width="460px">
      <div style="display: flex;justify-content: end;">注销 <span style="color:cornflowerblue;">{{ cancelSNName }}</span> 设备可能会影响相关数据,确认注销吗?</div>
      <div style="display: flex;justify-content: end;">
        <div><el-checkbox v-model="deleteFlag"></el-checkbox>删除相关图片、视频、事件</div>
      </div>
    <el-dialog title="注销" class="zx-cancel" append-to-body v-model="cancenOperate" width="460px">
      <div style="display: flex;justify-content: center;margin-bottom: 10px;">注销
        <span style="color:cornflowerblue;font-weight: bolder;margin: 0px 4px;">
          {{ cancelSNName }}
        </span> 设备可能会影响相关数据,确认注销吗?</div>
        <div style="display: flex;justify-content: center;color:red;font-size: 12px;">*删除相关图片、视频、事件</div>
      <template #footer>
        <span class="dialog-footer" style="display: flex;justify-content: center;">
          <el-button @click="cancenOperate = false">取 消</el-button>
@@ -211,7 +212,8 @@
  getDeviceFirmwareList,
  getDevices,
  deviceOffline,
  devicesUpdate
  devicesUpdate,
  devicesUpAndDown
} from '@/api/device/device'
import { deleteByOssId, addOrUpdate as addOrUpdateOssBind } from '@/api/device/ossBind'
import { getListPage as getOssList } from '@/api/resource/oss'
@@ -247,6 +249,7 @@
      }
    }
    return {
      treeResolveMap: new Map(),
      rules: {
        password: [{ required: true, validator: validatePass, trigger: 'blur' }],
        password2: [{ required: true, validator: validatePass2, trigger: 'blur' }],
@@ -532,7 +535,7 @@
            endPlaceholder: '保险结束日期',
            rules: [
              {
                required: true,
                required: false,
                message: '请选择保险有效期',
                trigger: 'blur',
              },
@@ -850,6 +853,7 @@
    },
  },
  destroyed () {
    this.treeResolveMap.clear()
    this.websocketMap.forEach((k, v) => {
      if (null != v) {
        v.close()
@@ -963,10 +967,9 @@
    },
    cancenOperateDo () {
      console.log('333')
      this.cancenOperate = false
      this.deleteFlag = false
      deviceOffline(this.cancenOperateRow.device_sn, this.deleteFlag).then(res => {
      deviceOffline(this.cancenOperateRow.device_sn, true).then(res => {
        ElMessage.success('注销成功')
        
        this.init()
@@ -1009,7 +1012,7 @@
      })
        .then(() => {
          let hidden_flag = row.hidden_flag === 1?0:1
          devicesUpdate({id:row.id, hiddenFlag:hidden_flag})
          devicesUpAndDown({id:row.id, hiddenFlag:hidden_flag})
            .then(res => {
              ElMessage.success(`${txt}成功`)
              this.init()
@@ -1295,8 +1298,8 @@
      const submitData = {
        ...row,
        area_code: row.area_code.split(',').pop(),
        insure_start_time: row.duration_of_insurance[0],
        insure_expired_time: row.duration_of_insurance[1],
        insure_start_time: row.duration_of_insurance[0] || null,
        insure_expired_time: row.duration_of_insurance[1] || null,
        deptId: row.dept_id,
        areaCode: row.area_code.split(',').pop(),
      }
@@ -1307,7 +1310,25 @@
      update(submitData).then(
        () => {
          this.onLoad(this.page)
          if (row.domain === 0) {
            // 获取保存的 resolve 函数
            const resolve = this.treeResolveMap.get(row.device_sn)
            if (resolve) {
              // 重新加载子节点数据
              var params = {
                childSn: row.device_sn,
              }
              getList(1, 10, params).then(res => {
                const data = res.data.data.records
                data.forEach(e => {
                  e.duration_of_insurance = [e.insure_start_time || '', e.insure_expired_time || '']
                })
                resolve(data)
              })
            }
          } else {
            this.onLoad(this.page)
          }
          this.$message({
            type: 'success',
            message: '操作成功!',
@@ -1459,6 +1480,8 @@
      })
    },
    treeLoad (tree, treeNode, resolve) {
      // 保存resolve
      this.treeResolveMap.set(tree.child_sn, resolve)
      var params = {
        childSn: tree.child_sn,
      }
@@ -1605,5 +1628,11 @@
  right: 0;
}
:deep(.avue-crud__pagination) {
  position: fixed;
  bottom: 10px;
  right: 30px;
}
</style>