Newer
Older
shipFront / src / views / overview / right.vue
[wangxitong] on 30 May 2022 3 KB v1.1.2
<template>
  <div>
    <div class="right">
      <div style="height: 40px">
        <div class="title">{{data.name}}
          <el-image :src="img" style="width: 30px;height: 30px;margin: 0px 5px"/>
          {{data.value}}
          <div class="btn" @click="setting">设 置</div>
          <div class="alarm" @click="alarm"/>
        </div>
      </div>
      <overview style="flex: 1;width: 100%;"/>
    </div>
    <setting v-show="editShow" ref="setting" @watchChild="" />
    <alarm v-show="alarmShow" ref="alarm" @watchChild="" />
  </div>
</template>

<script>
  import Overview from "./overview";
  import Setting from "../setting/setting";
  import Alarm from "../alarm/alarm";
  import { getSatelliteSignal } from "@/api/typhoon"
export default {
  name: 'Right',
  components: {Alarm, Overview,Setting},
  data() {
    return {
      img:require('@/assets/images/green.png'),
      editShow: false, // 编辑组件是否显示
      alarmShow: false, // 编辑组件是否显示
      data:{
        name: '天通卫星通信',
        value: 'kb/s'
      },
      timer:'',
      type: this.baseConfig.webType
    }
  },
  mounted() {
    this.search()
    this.timer = setInterval(this.search, 10000);
  },
  beforeDestroy() {
    clearTimeout(this.timer);
  },
  methods: {
    search(){
      getSatelliteSignal().then(res => {
        if (res.code === 200) {
          this.data.value = res.data.signalValue + 'kb/s'
          if(this.type === 'client'){
            if(Number(res.data.signalValue)<3){
              this.img = require('@/assets/images/red.png')
            }else{
              this.img = require('@/assets/images/green.png')
            }
          }else if(this.type === 'service'){
            if(Number(res.data.signalValue)<10){
              this.img = require('@/assets/images/red.png')
            }else{
              this.img = require('@/assets/images/green.png')
            }
          }
        }
      })
    },
    setting(){
      this.editShow = true
      this.$refs.setting.initDialog('create')
    },
    alarm(){
      this.alarmShow = true
      this.$refs.alarm.initDialog('create')
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  .right{
    display: flex;
    flex-direction: column;
    height: 100%;
    width:100%;
    .title{
      margin: 0px 0px 0px 50px;
      color: white;
      font-size: 18px;
      display: flex;
      height: 30px;
      line-height: 30px;
      text-align: center;
      position: absolute;
      right: 50px;
      .btn{
        color: white;
        font-size: 16px;
        cursor: pointer;
        width: 200px;
        margin-left: 20px;
        height: 30px;
        line-height: 30px;
        background: url("../../assets/images/button.png") no-repeat;
        -webkit-background-size: 100% 100%;
        background-size: 100% 100%;
        &:hover{
          background: url("../../assets/images/button1.png") no-repeat;
          -webkit-background-size: 100% 100%;
          background-size: 100% 100%;
          color: #00f5ff;
        }
      }
      .alarm{
        cursor: pointer;
        width: 25px;
        margin-left: 15px;
        height: 25px;
        line-height: 25px;
        background: url("../../assets/images/alarm.png") no-repeat;
        -webkit-background-size: 100% 100%;
        background-size: 100% 100%;
      }
    }
  }
</style>