DeviceDeteils.vue 9.2 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 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
<template>
  <!-- 网元详细信息展示对话框 -->
  <el-dialog
    @close="close"
    v-dialogDrag
    style="text-align: center" width='900px' top="16vh"
    :title="$t('DeviceDetails.deviceDetailInfo')"
    v-if="deviceDetailsVisible"
    :visible.sync="deviceDetailsVisible">
    <div style="text-align: center;padding: 0px;">
      <table style="margin:auto" class="device-detail-tb">
        <tr style="line-height: 50px;">
          <td style="width: 90px;"><label>{{ $t('DeviceDetails.displayName') }}</label></td>
          <td style="width: 180px; text-align: left;"><label v-text="showDevice.displayName"></label></td>
          <td style="width: 90px;"><label>{{ $t('DeviceDetails.deviceTypeKey') }}</label></td>
          <td style="width: 180px; text-align: left;"><label v-text="showDevice.deviceTypeKey"></label></td>
          <td style="width: 90px;"><label>{{ $t('DeviceDetails.deviceModel') }}</label></td>
          <td style="width: 180px; text-align: left;"><label v-text="showDevice.deviceModel"></label></td>
        </tr>
        <tr style="line-height: 50px;">
          <td><label>{{ $t('DeviceDetails.deviceVersion') }}</label></td>
          <td style="text-align: left;"><label v-text="showDevice.deviceVersion"></label></td>
          <td><label>{{ $t('DeviceDetails.belongedSubnet') }}</label></td>
          <td style="text-align: left;"><label v-text="showDevice.subnetKey"></label></td>
          <td><label>{{ $t('DeviceDetails.station') }}</label></td>
          <td style="text-align: left;"><label v-text="showDevice.station"></label></td>
        </tr>
        <tr style="line-height: 50px;">
          <td><label>{{ $t('DeviceDetails.IPAddress') }}</label></td>
          <td style="text-align: left;"><label v-text="showDevice.ipAddress"></label></td>
          <td><label>{{ $t('DeviceDetails.manageType') }}</label></td>
          <td style="text-align: left;"><label v-text="showDevice.manageType"></label></td>
          <td><label>{{ $t('DeviceDetails.deviceStatus') }}</label></td>
          <td style="text-align: left;"><label v-text="showDevice.deviceStatus"></label></td>
        </tr>
        <tr style="line-height: 50px;">
          <td><label>{{ $t('DeviceDetails.bussIPAddress') }}</label></td>
          <td style="text-align: left;"><label v-text="showDevice.bussIpAddress"></label></td>
          <td><label>{{ $t('DeviceDetails.bussManageType') }}</label></td>
          <td style="text-align: left;"><label v-text="showDevice.bussManageType"></label></td>
          <td><label>{{ $t('DeviceDetails.numberSerial') }}</label></td>
          <td style="text-align: left;"><label v-text="showDevice.numberSerial"></label></td>
<!--          <td><label>{{ $t('DeviceDetails.MACAddress') }}</label></td>-->
<!--          <td style="text-align: left;"><label v-text="showDevice.mac"></label></td>-->
        </tr>
        <tr style="line-height: 50px;">
          <td><label>{{ $t('DeviceDetails.deviceDetailInfo') }}</label></td>
          <td style="text-align: left;"><label v-text="showDevice.description"></label></td>
          <td><label>{{ $t('DeviceDetails.startTime') }}</label></td>
          <td style="text-align: left;"><label v-text="showDevice.startTime"></label></td>
        </tr>
        <tr style="line-height: 50px">
          <td>
            <el-button @click="show" size="mini">
              {{info}}
            </el-button>
          </td>
        </tr>
        <tr style="line-height: 50px" v-show="showBook">
          <td><label>{{ $t('DeviceDetails.manager') }}</label></td>
          <td style="text-align: left;"><label v-text="showDevice.manager"></label></td>
          <td><label>{{ $t('DeviceDetails.managerPhone') }}</label></td>
          <td style="text-align: left;"><label v-text="showDevice.managerPhone"></label></td>
          <td><label>{{ $t('DeviceDetails.brand') }}</label></td>
          <td style="text-align: left;"><label v-text="showDevice.brand"></label></td>
        </tr>
        <tr style="line-height: 50px" v-show="showBook">
          <td><label>{{ $t('DeviceDetails.manufacturerLiaison') }}</label></td>
          <td style="text-align: left;"><label v-text="showDevice.manufacturerLiaison"></label></td>
          <td><label>{{ $t('DeviceDetails.manufacturerPhone') }}</label></td>
          <td style="text-align: left;"><label v-text="showDevice.manufacturerPhone"></label></td>
          <td><label>{{ $t('DeviceDetails.belongedLocation') }}</label></td>
          <td style="text-align: left;"><label v-text="showDevice.locationName"></label></td>
        </tr>
      </table>
    </div>
    <div slot="footer" style="margin-left: -100px">
      <el-button type="primary" size="mini" @click="close">{{ $t('common.ok') }}</el-button>
    </div>
  </el-dialog>
</template>

<script>
import SubnetService from '../../../domain/services/SubnetService'
import HelperUtil from "../../../utils/HelperUtil";

export default {
  props: ['command'],
  data: function () {
    return {
      deviceDetailsVisible: true,
      device: this.command.target,
      showBook: false,
      showDevice: {
        displayName: '',
        deviceTypeKey: '',
        deviceModel: '',
        locationKey: '',
        cabinetKey: '',
        subnetKey: '',
        ipAddress: '',
        bussIpAddress: '',
        deviceStatus: '',
        brand: '',
        manufacturerLiaison: '',
        manufacturerPhone: '',
        manager: '',
        managerPhone: '',
        station: '',
        macAddress: '',
        manageType: '',
        bussManageType: '',
        numberSerial: '',
        locationName: ''
      },
      subnetCollection: {}
    }
  },
  methods: {
    /**
     * @Description  : 显示控制
     * @author       : ls
     * @date         : 2020/5/1 16:15
     * @param        :
     * @return       :
     */
    show: function () {
      this.showBook = !this.showBook
    },
    close () {
      this.command.done()
    },

    /***
       * @Description  : 初始化显示
       * @author       : zf
       * @date         : 2019/05/14 19:47
       */
    InitShow: function () {
      this.showDevice['displayName'] = this.device.displayName
      this.showDevice['deviceTypeKey'] = this.device.deviceTypeName
      this.showDevice['deviceModel'] = this.device.deviceModel
      this.showDevice['subnetKey'] = this.device.subnetKey
      this.showDevice['station'] = this.device.station
      this.showDevice['locationName'] = this.device.locationName
      this.showDevice['ipAddress'] = this.device.ipAddress
      this.showDevice['bussIpAddress'] = this.device.bussIpAddress
      this.showDevice['deviceStatus'] = this.device.deviceStatus
      this.showDevice['deviceVersion'] = this.device.deviceVersion
      this.showDevice['brand'] = this.device.brand
      this.showDevice['manufacturerLiaison'] = this.device.manufacturerLiaison
      this.showDevice['manufacturerPhone'] = this.device.manufacturerPhone
      this.showDevice['manager'] = this.device.manager
      this.showDevice['managerPhone'] = this.device.managerPhone
      this.showDevice['numberSerial'] = this.device.uuid
      this.showDevice['deviceDetailInfo'] = this.device.description
      this.showDevice['startTime'] = HelperUtil.timeTran(this.device.startTime)
      switch (this.device.manageType) {
        case 0:
          this.showDevice['manageType'] = 'SNMP'
          break
        case 1:
          this.showDevice['manageType'] = 'ICMP'
          break
        case 2:
          this.showDevice['manageType'] = 'IPMI'
          break
      }
      if (this.device.bussIpAddress !== '') {
        switch (this.device.bussManageType) {
          case 0:
            this.showDevice['bussManageType'] = 'SNMP'
            break
          case 1:
            this.showDevice['bussManageType'] = 'ICMP'
            break
          default:
            this.showDevice['bussManageType'] = ''
            break
        }
      } else {
        this.showDevice['bussManageType'] = ''
      }
      switch (this.showDevice.deviceStatus) {
        case 0:
          this.showDevice.deviceStatus = this.$t('DeviceDetails.inWork')
          break
        case 1:
          this.showDevice.deviceStatus = this.$t('DeviceDetails.noWork')
          break
        default:
          break
      }
    },

    /**
       * @Description  :获取全部子网信息
       * @author       : bjh
       * @param        :
       * @return       :
       * @exception    :
       * @date         : 2018/12/7 14:06
       */
    getAllSubnet: function () {
      let _this = this
      SubnetService.getAllSubnetCollection().then(result => {
        // 成功
        _this.subnetCollection = result
        if (_this.subnetCollection[_this.device.subnetKey] !== undefined) {
          _this.showDevice.subnetKey = _this.subnetCollection[_this.device.subnetKey].subnetName
        }
      }).catch(err => {
        // 失败
        _this.InfoTip.errorTip(_this, err)
      })
    }
  },
  created () {
    this.getAllSubnet()
    this.InitShow()
  },

  computed: {
    info: function () {
      if (this.showBook === true) {
        return this.$t('BooKManagement.clickHide')
      } else {
        return this.$t('BooKManagement.clickShow')
      }
    }
  },
}
</script>
<style scoped>
  .device-detail-tb /deep/ td{
    text-align: right;
  }
</style>