Newer
Older
shipFront / src / views / overview / left.vue
[wangxitong] on 29 Dec 2021 2 KB 气象站
<template>
  <div class="container">
    <div class="title">
      AIS数据接收
      <div ref="circle" class="circle" :style="{'background-color': color}"/>
      (调用{{times}}次)
    </div>
    <position class="position"/>
    <weather class="weather"/>
    <water class="water"/>
  </div>
</template>

<script>

  import Position from '@/views/overview/position'
  import Weather from '@/views/overview/weather'
  import Water from '@/views/overview/water'
  import { getShipShipsInCircle, getShipLog } from '@/api/ship'
  import { getShelterPosition } from '@/api/typhoon'
export default {
  name: 'Left',
  components: { Weather, Water, Position},
  data() {
    return {
      color: '#00ff01',
      times:0
    }
  },
  created() {
    getShipLog().then(res =>{
      if (res.code === 200) {
        this.times = res.data
      }
    })
    getShelterPosition().then(res => { // 方舱位置
      if (res.code === 200) {
        this.position.lat = res.data.lat.toFixed(6)
        this.position.lng = res.data.lng.toFixed(6)
        let rgn = res.data.lat.toFixed(6) * 600000 + ',' + res.data.lng.toFixed(6) * 600000 + ',80'
        getShipShipsInCircle(rgn).then(res => {
          if (res.code === 200) {
            if(res.data.length === 0 ) this.color = '#dddddd'
            else {
              if(res.data[0].aisStatus	==='0') this.color = '#dddddd'
              else  this.color = '#00ff01'
            }
          }
        })
      }
    })
  },
  methods: {
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  .container{
    display: flex;
    flex-direction: column;
    .title{
      margin: 10px 0px 0px 50px;
      color: white;
      font-size: 18px;
      display: flex;
      .circle{
        width: 18px;
        height: 18px;
        border-radius: 50%;
        display: inline-block;
        margin-right: 5px;
        margin-left: 10px;
      }
    }
    .position{
      margin: 5px 0px;
      width: 100%;
      height: 38%;
    }
    .weather{
      margin: 5px 0px;
      width: 100%;
      height: 42%;
    }
    .water{
      margin: 5px 0px;
      width: 100%;
      height: 20%;
    }
  }
</style>