无人机管理后台前端(已迁走)
zhongrj
2025-01-18 902018925188ae12fe11cea86435be7dddcadbe8
src/views/device/airport.vue
@@ -110,10 +110,10 @@
        <el-button
          type="primary"
          text
          icon="el-icon-collection-tag"
          v-if="permission.deviceFirmware_manage"
          @click.stop="handleOpenFirmwarm(scope.row, scope.index)"
          >固件管理
          icon="el-icon-paperclip"
          v-if="permission.oss_set"
          @click.stop="handleOpenOssSet(scope.row, scope.index)"
          >存储配置
        </el-button>
        <el-button
          type="primary"
@@ -142,6 +142,41 @@
        <span class="dialog-footer">
          <el-button @click="firmwareBox = false">取 消</el-button>
          <el-button type="primary" @click="updateFirmwareConfirm">确 定</el-button>
        </span>
      </template>
    </el-dialog>
    <el-dialog
      title="存储配置"
      append-to-body
      v-model="ossSetBox"
      @close="handleOssSetClose"
      width="600px"
    >
      <div style="display: flex; flex-direction: row; align-items: center">
        存储对象配置:
        <el-select v-model="ossEnd" clearable placeholder="请选择存储对象" style="width: 450px">
          <el-option
            v-for="item in ossList"
            :key="item.id"
            :label="item.name + ': ' + item.endpoint"
            :value="item.id"
          >
            <span style="float: left">{{ item.name + ': ' + item.endpoint }}</span>
            <span v-if="item.status == 1" style="float: right; color: #8492a6; font-size: 13px">{{
              item.categoryName
            }}</span>
            <span v-if="item.status == 2" style="float: right; color: #40cb8b; font-size: 13px">{{
              item.categoryName
            }}</span>
          </el-option>
        </el-select>
      </div>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="cancelOssSet">取 消</el-button>
          <el-button type="danger" @click="cancelOssSetConfirm">取消配置</el-button>
          <el-button type="primary" @click="ossSetConfirm">配置</el-button>
        </span>
      </template>
    </el-dialog>
@@ -204,7 +239,8 @@
  getDeviceFirmwareList,
  getDevices,
} from '@/api/device/device';
import { deleteByOssId, addOrUpdate as addOrUpdateOssBind } from '@/api/device/ossBind';
import { getListPage as getOssList } from '@/api/resource/oss';
import { getLazyTree } from '@/api/base/region';
import { EDockModeText, EDockModeCode } from '@/types/device';
import { mapGetters } from 'vuex';
@@ -219,10 +255,14 @@
    DevicePerShare,
    DockControlPanel,
  },
  data() {
    return {
      operateTitle:"",
      bindOssId: null,
      deviceSn: '',
      ossSetBox: false,
      ossList: [],
      ossEnd: '',
      operateTitle: '',
      rollFirmVersion: '',
      firmList: [],
      rollFirmwareBox: false,
@@ -607,12 +647,12 @@
      });
    },
    init() {
      this.page= {
      (this.page = {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      this.onLoad(this.page);
      }),
        this.onLoad(this.page);
    },
    // 打开权限分享页面
    handleOpenDevicePerShare(row) {
@@ -626,9 +666,24 @@
    handleOpenRemoteDebugging(row) {
      this.curDeviceInfo = row;
      this.remoteDebuggingShow = true;
      this.operateTitle = row.nickname + " - " + row.device_sn
      this.operateTitle = row.nickname + ' - ' + row.device_sn;
    },
    // 打开存储对象配置页面
    handleOpenOssSet(row) {
      var that = this;
      this.deviceSn = row.device_sn;
      this.ossSetBox = true;
      this.bindOssId = row.oss_id;
      this.ossEnd = row.oss_id;
      // 查询下拉列表
      const param = {
        categoryKeys: "1,3,6"
      }
      getOssList(1, 50,param).then(res => {
        const data = res.data.data;
        that.ossList = data.records;
      });
    },
    // 打开固件管理页面
    handleOpenFirmwarm(row) {
      var that = this;
@@ -824,6 +879,65 @@
        done();
      });
    },
    handleOssSetClose() {
      this.ossEnd = '';
      this.deviceSn = '';
      this.bindOssId = null;
    },
    // 存储对象配置确定
    ossSetConfirm() {
      var that = this;
      // 判断是否已选择
      if (!this.ossEnd) {
        this.$message({
          type: 'warning',
          message: '请选择对于的存储对象!',
        });
        return;
      }
      // 新增或者修改操作
      const data = {
        oss_id: this.ossEnd,
        sn: this.deviceSn,
      };
      // 新增
      addOrUpdateOssBind(data).then(res => {
        this.$message({
          type: 'success',
          message: '操作成功!',
        });
        that.ossSetBox = false;
        this.onLoad(this.page);
        done();
      });
    },
    // 取消配置
    cancelOssSetConfirm() {
      var that = this;
      // 判断是否已有配置
      if (!this.bindOssId) {
        this.$message({
          type: 'warning',
          message: '当前机场尚未配置存储对象信息!',
        });
        return;
      }
      deleteByOssId(this.bindOssId).then(() => {
        that.ossSetBox = false;
        this.onLoad(this.page);
        this.$message({
          type: 'success',
          message: '操作成功!',
        });
      });
    },
    // 取消按钮 oss
    cancelOssSet() {
      this.ossEnd = '';
      this.deviceSn = '';
      this.bindOssId = null;
      this.ossSetBox = false;
    },
    rowSave(row, done, loading) {
      add(row).then(
        () => {