RecoverFirmWareDialog.vue 4.98 KB
Newer Older
YazhouChen's avatar
YazhouChen committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
<template>
  <!-- 设备上传配置文件对话框 -->
  <el-dialog v-dialogDrag
             @close="close"
             style="font-size: 10px; " width='600px' :title="$t('FirmWareConfiguration.firmWareRecover')"
             v-if="DeviceUploadConfig"
             :visible.sync="DeviceUploadConfig">
    <el-table
      ref="singleTable"
      :data="deviceList"
      header-row-class-name="table-header"
      cell-class-name="table-cell"
      highlight-current-row
      stripe
      height="350"
      tooltip-effect="dark"
      @current-change="handleCurrentChange"
      @selection-change="handleSelectionChangeUpload">
      <el-table-column
        type="selection"
        width="28">
      </el-table-column>
      <el-table-column
        prop="deviceName"
        :label="$t('ProfileManagement.deviceName')"
        :show-overflow-tooltip="true">
      </el-table-column>
      <el-table-column
        prop="ipAddress"
        :show-overflow-tooltip="true"
        :label="$t('DeviceConfigurationManagement.ipAddress')">
      </el-table-column>
      <el-table-column
        prop="firmwareName"
        :label="$t('ProfileManagement.currentFirmWarefile')"

        :show-overflow-tooltip="true">

      </el-table-column>

    </el-table>

    <el-row style="margin-bottom: 0px;" slot="footer" class="dialog-footer">
      <el-button style="margin-bottom: -10px;" size='mini' type="primary" @click="firmwareRecover"
                 v-loading.fullscreen.lock="fullscreenLoading">{{$t("common.ok")}}
      </el-button>
      <el-button style="margin-bottom: -10px;" size='mini' @click="close">
        {{$t("common.cancel")}}
      </el-button>
    </el-row>
  </el-dialog>

</template>

<script>
  let curThis = '';

  import DeviceService from '@/domain/services/DeviceService.js'
  import FirmWareService from '@/domain/services/FirmWareService.js'
  import HelperUtil from '../../../utils/HelperUtil'
  export default {


    props: ['command'],

    data() {
      return {
        deviceList: [],

        flag: false,

        multipleSelectionUpload: [],
        tableHeight:'250px',

        DeviceUploadConfig: true,
        currentConfigKey: this.command.target,
        // 数据加载过程中,覆盖界面
        fullscreenLoading: false,
      };
    },
    methods: {
      close() {
        this.command.done()
      },
      getAllDevice: function () {
        console.log('获取全部网元信息:')
        let _this = this;
        DeviceService.getAllDeviceCollection().then(result => {
          //成功
          _this.deviceList = Object.values(result)
        }).catch(err => {
          //失败
          _this.InfoTip.errorTip(_this,err);
        })
      },

      /**
       * @Description  :设备上传表格多选框改变时,将所选行进行保存
       * @author       :
       * @param        :
       * @return       :
       * @exception    :
       * @date         :
       */
      handleSelectionChangeUpload(val) {
        this.multipleSelectionUpload = val
      },
      /**
       * @Description  从设备上传:设备上传配置文件判断选择数据条数是否合法
       * @author       ::
       * @date         :
       */
      firmwareRecover: function () {
        if (this.multipleSelectionUpload.length == 0) {
          this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.PLEASE_SELECT_AT_LEASE_ONE_DEVICE))
          return
        }
        else {
          // this.$confirm(this.$t('FirmWareConfiguration.title'),
          //   this.$t('ProfileManagement.Attention'), {
          //     confirmButtonText: this.$t('common.ok'),
          //     cancelButtonText: this.$t('common.cancel'),
          //     type: 'warning',
          //     center: true
          //   }).then(() => {
        // 上传
        this.recoverByFirmware()
          // }).catch(() => {
          // })
        }
      },

      /**
       * @Description  从设备上传:设备上传配置文件
       * @author       ::
       * @date         :
       */
      recoverByFirmware: function () {
        // 开始上传到后台
        let _this = this;
        var selectList = new Array()
        for (var i = 0; i < this.multipleSelectionUpload.length; i++) {
          selectList[i] = this.multipleSelectionUpload[i]['deviceKey']
          console.log(this.multipleSelectionUpload[i]['deviceKey'])

        }
        let loadingInstance = _this.Loading.openLoading();
        FirmWareService.recoverFirmWareFile(selectList).then(result => {
          _this.Loading.closeLoading(loadingInstance)
          _this.InfoTip.successTip(_this, HelperUtil.getStatusCodeObjectByCode(_this.successCode.OTHERS_CODE));
          _this.close()
        }).catch(err => {
          //失败
          _this.Loading.closeLoading(loadingInstance)
          _this.InfoTip.errorTip(_this,err);
        })
      },
    },

    watch: {},
    created() {
      curThis = this
      console.log('获取全部配置信息:')
      this.getAllDevice()
    }
  }
  ;
</script>

<style scoped>


</style>