Newer
Older
smartwell_front / src / views / smartAnalysis / smartOverview.vue
StephanieGitHub on 6 Dec 2019 12 KB ADD:智能分析模块
<template>
  <div>
    <el-row>
      <el-col :span="17">
        <div v-loading="loading" class="overview-map-container">
          <!--地图-->
          <cmap ref="map" :center="center" :zoom="zoom" :well-obj="wellObj" class="map-demo" @ready="readyMap"/>
        </div>
      </el-col>
      <el-col :span="7">
        <div class="smart-div">
          <div class="smart-tab">
            <el-tabs v-model="activeName" @tab-click="handleClick">
              <el-tab-pane label="内涝分析" name="first">
                <el-table
                  :data="waterList"
                  class="alarm-list-table"
                  border
                  @row-click="waterRowClick()">
                  <el-table-column v-for="column in columns" :key="column.value" :label="column.text" :width="column.width" :align="column.align" show-overflow-tooltip>
                    <template slot-scope="scope">
                      {{ scope.row[column.value] }}
                    </template>
                  </el-table-column>
                </el-table>
              </el-tab-pane>
              <el-tab-pane label="燃气管线泄漏点" name="second">
                <el-table
                  :data="gasList"
                  class="alarm-list-table"
                  border
                  @row-click="gasRowClick()">
                  <el-table-column v-for="column in columns" :key="column.value" :label="column.text" :width="column.width" :align="column.align" show-overflow-tooltip>
                    <template slot-scope="scope">
                      {{ scope.row[column.value] }}
                    </template>
                  </el-table-column>
                </el-table>
              </el-tab-pane>
              <el-tab-pane label="热力管线泄漏点" name="third">
                <el-table
                  :data="hotList"
                  class="alarm-list-table"
                  border
                  @row-click="hotRowClick()">
                  <el-table-column v-for="column in columns" :key="column.value" :label="column.text" :width="column.width" :align="column.align" show-overflow-tooltip>
                    <template slot-scope="scope">
                      {{ scope.row[column.value] }}
                    </template>
                  </el-table-column>
                </el-table>
              </el-tab-pane>
            </el-tabs>
          </div>
          <div v-if="wellObj!=null" class="smart-detail">
            <div class="detail-header">详情</div>
            <el-form ref="form" :model="wellObj" label-width="90px">
              <el-form-item label="井编号">
                <span class="detail-item">{{ wellObj.wellCode }}</span>
              </el-form-item>
              <el-form-item label="位置">
                <span class="detail-item">{{ wellObj.position }}</span>
              </el-form-item>
              <el-form-item v-if="wellObj.liquidData" label="液位值">
                <span class="detail-item">{{ wellObj.liquidData }}</span>
              </el-form-item>
              <el-form-item v-if="wellObj.strength" label="燃气浓度">
                <span class="detail-item">{{ wellObj.strength }} %LEL </span>
              </el-form-item>
              <el-form-item label="影响面积">
                <span class="detail-item">{{ wellObj.affectArea }} 平方公里</span>
              </el-form-item>
              <el-form-item label="创建时间">
                <span class="detail-item">{{ wellObj.createTime }}</span>
              </el-form-item>
            </el-form>
            <div v-show="activeName!=='first'" class="btn-group">
              <el-button>查看阀门</el-button>
              <el-button>查看关阀影响区域</el-button>
            </div>
          </div>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import Cmap from '../../components/CMap/components/cmapSmart'
import { getAlarmsNow } from '@/api/overview'
export default {
  name: 'SmartOverview',
  components: { Cmap },
  data() {
    return {
      listQuery: {
        keywords: '', // 关键字
        wellType: '', // 井类型
        deptid: '', // 组织机构
        isAlarm: '1' // 是否报警
      }, // 筛选条件
      columns: [
        {
          text: '井编号',
          value: 'wellCode',
          align: 'center'
        },
        {
          text: '位置',
          value: 'position',
          align: 'center'
        }
      ], // 告警列表显示列
      tableShow: true, // 是否显示告警列表
      tableIcon: 'el-icon-arrow-up',
      count: 30,
      commonIcon: 'well-common-green', // 通用图标 绿
      commonIconAlarm: 'well-common-red', // 通用图标 红
      center: { lng: this.$store.getters.lng, lat: this.$store.getters.lat }, // 地图中心
      zoom: 12, // 地图缩放比例
      offset: [-10, -10], // 偏移量
      alarmOffset: [-15, -30], // 偏移量
      waterList: [], // 内涝预警列表
      gasList: [], // 燃气管线泄漏点列表
      hotList: [], // 热力管线泄漏点列表
      activeName: 'first', // 当前智能分析内容:内涝first,燃气管线泄漏second,热力管线泄漏third
      wellObj: null,
      loading: false // 加载图标是否显示
    }
  },
  activated() {
    this.refreshData()
  },
  methods: {
    // 地图准备好后的操作
    readyMap() {
      console.log('readyMap')
      const that = this
      that.refreshData() // 刷新报警内容
    },
    // 刷新报警列表
    refreshData() {
      this.getWaterData()
    },
    handleClick(tab, event) {
      debugger
      if (tab.name === 'first') {
        this.getWaterData()
      } else if (tab.name === 'second') {
        this.getGasData()
      } else if (tab.name === 'third') {
        this.getHotData()
      }
    },
    getWaterData() {
      getAlarmsNow().then(response => {
        if (response.code === 200) {
          // 获取当前报警列表
          // this.waterList = response.data
          // 模拟数据
          this.waterList = [
            { wellCode: '11234', position: '永定路52号院门口', lng: '126.4', lat: '39.9', liquidData: '1', radius: 10 },
            { wellCode: '11234', position: '永定路52号院门口', lng: '126.4', lat: '39.9', liquidData: '1', radius: 10 },
            { wellCode: '11234', position: '永定路52号院门口', lng: '126.4', lat: '39.9', liquidData: '1', radius: 10 },
            { wellCode: '11234', position: '永定路52号院门口', lng: '126.4', lat: '39.9', liquidData: '1', radius: 10 },
            { wellCode: '11234', position: '永定路52号院门口', lng: '126.4', lat: '39.9', liquidData: '1', radius: 10 }
          ]
        }
      })
    },
    getGasData() {
      getAlarmsNow().then(response => {
        if (response.code === 200) {
          // 获取当前报警列表
          // this.waterList = response.data
          // 模拟数据
          this.gasList = [
            { wellCode: '11234', position: '永定路52号院门口', lng: '126.4', lat: '39.9', liquidData: '1', radius: 10 },
            { wellCode: '11234', position: '永定路52号院门口', lng: '126.4', lat: '39.9', liquidData: '1', radius: 10 },
            { wellCode: '11234', position: '永定路52号院门口', lng: '126.4', lat: '39.9', liquidData: '1', radius: 10 }
          ]
        }
      })
    },
    getHotData() {
      getAlarmsNow().then(response => {
        if (response.code === 200) {
          // 获取当前报警列表
          // this.waterList = response.data
          // 模拟数据
          this.hotList = [
            { wellCode: '11234', position: '永定路52号院门口', lng: '126.4', lat: '39.9', liquidData: '1', radius: 10 },
            { wellCode: '11234', position: '永定路52号院门口', lng: '126.4', lat: '39.9', liquidData: '1', radius: 10 },
            { wellCode: '11234', position: '永定路52号院门口', lng: '126.4', lat: '39.9', liquidData: '1', radius: 10 }
          ]
        }
      })
    },
    // 点击内涝列表项
    waterRowClick(row, column, event) {
      console.log('alarmRowClick')
      this.wellObj = {
        wellCode: '11201231',
        position: '永定路52号院',
        lng: 116.4,
        lat: 39.9,
        radius: 100,
        liquidData: '13',
        affectArea: '23',
        createTime: '2019-11-27 00:00:00'
      }
      this.$refs.map.renderAffectAP(this.wellObj)
    },
    // 点击燃气泄漏点列表项
    gasRowClick(row, column, event) {
      this.wellObj = {
        wellCode: '11201231',
        position: '永定路52号院',
        lng: '126.4',
        lat: '39.9',
        radius: '24',
        strength: '3',
        affectArea: '23',
        createTime: '2019-11-27 00:00:00'
      }
      this.$refs.map.renderAffectAP(this.wellObj)
    },
    // 点击热力泄漏点列表项
    hotRowClick(row, column, event) {
      this.wellObj = {
        wellCode: '11201231',
        position: '永定路52号院',
        lng: '116.4',
        lat: '39.9',
        radius: '24',
        liquidData: '13',
        affectArea: '23',
        createTime: '2019-11-27 00:00:00'
      }
      this.$refs.map.renderAffectAP(this.wellObj)
    },
    // 查看阀门
    showValves(){

    },
    // 关阀影响区域
    showCloseArea(){

    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss">
// 查询框
.map-search-div{
  position: absolute;
  z-index: 500;
  padding: 5px 20px;
  background-color: rgba(244, 244, 244, 0.9);
  /*left: 90px;*/
  .el-form-item{
    margin-bottom: 0px;
  }
}
.smart-div{
  .smart-tab{
    .el-tabs__content{
      max-height: calc(100vh - 295px - 144px - 60px);
      overflow-y: scroll;
    }
  }
  .smart-detail{
    /*margin-top: 20px;*/
    font-size:14px;
    min-height:295px;
    .detail-header{
      height: 40px;
      padding-left: 5px;
      font-size:14px;
      line-height: 40px;
      background-color: #f0f0f0;
    }
    .el-form{
      .el-form-item{
        margin-bottom: 0px;
        border-bottom: 1px solid #f0f0f0;
        .el-form-item__label{
          background-color: #ededed;
        }
        .el-form-item__content{
          /*background-color: #edf9f0;*/
          padding-left:10px;
        }
      }
    }
    .btn-group{
      margin: 10px;
      text-align: center;
    }
  }
}
// 报警列表
.map-alarm-div{
  position: absolute;
  z-index: 500;
  background-color: rgba(255, 234, 241,0.8);
  top: 60px;
  left: 10px;
  .map-alarm-div-header{
    line-height: 40px;
    width: 504px;
    padding-left: 10px;
    .icon-right{
      position: absolute;
      right: 15px;
    }
    .icon-right:hover{
      color: #409EFF;
      cursor: pointer;
    }
  }

  .el-scrollbar {
    /*height: 200px;*/
    width: 100%;
  }
  .moredatascollor{
    height: 200px;
  }
  .el-scrollbar__wrap {
    overflow-y: auto;
    overflow-x: hidden;
    margin-bottom: 0px !important;
}

.el-table th{
/*background-color: rgba(255, 229, 230, 0.8);*/
    padding: 7px 0px;
  }
  .el-table td{
    /*background-color: rgba(255, 234, 241, 0.8);*/
    padding: 5px 0px;
    /*line-height: 1;*/
  }
  .el-table td:hover{
    /*background-color: rgba(255, 234, 241, 0.8);*/
  }
  .transition-box {
    margin-bottom: 10px;
    width: 200px;
    height: 100px;
    border-radius: 4px;
    background-color: #409EFF;
    text-align: center;
    color: #fff;
    padding: 40px 20px;
    box-sizing: border-box;
    margin-right: 20px;
  }
}
// 刷新框
.function-div{
  position: absolute;
  right: 10px;
  top: 7px;
  z-index: 1100;
  padding: 10px;
  color: #ce8b74;
  font-size: 14px;
  /*background-color: rgba(244, 233, 230, 1.0);*/
  .font-red{
    color: red;
    font-weight: bold;
  }
  .el-icon-refresh:hover{
    color: red;
    font-weight: bold;
    cursor: pointer;
  }
}
// 地图
.overview-map-container{
  width: 100%;
  padding: 5px;
  .map-demo{
    width: 100%;
    height: calc(100vh - 144px);
    .svg-icon{
      width: 20px;
      height: 20px;
    }
    .alarm-icon{
      width: 29px;
      height: 30px;
    }
    .nomal-info-window{
      background-color: pink;
    }
    .info-window{
      max-width: 250px;
      /*background-color: lightcyan;*/
      .info-header{
        padding: 10px 10px 5px 10px;
        line-height: 30px;
        font-weight: bold;
        font-size: 16px;
        /*background-color: #eaf4ff;*/
      }
      .info-body{
        padding: 0px;
        line-height: 23px;
        font-size: 14px;
      }
    }
    .alarm-window{
      max-width: 250px;
      /*background-color: #ffeaf1;*/
      .alarm-header {
        padding: 0px;
        line-height: 30px;
        color: red;
        font-weight: bold;
        font-size: 16px;
        /*background-color: #ffecec;*/
      }
      .alarm-body{
        padding: 0px;
        line-height: 23px;
        font-size: 14px;
        .alarm-red{
          color: #ff0000;
        }
        .divider{
          width:100%;
          height:5px;
          margin-bottom: 5px;
          border-bottom:solid rgb(184, 184, 184) 1px
        }
      }
    }
  }
}
  .el-divider--horizontal{
    margin: 5px 0;
  }
</style>