南昌市物联网技防平台-前端
shuishen
2021-04-22 a61c685ad918547fe00a243f530cd71998bb2b8a
src/views/dataL/dataL.vue
@@ -1,6 +1,6 @@
<template>
  <div id="Lour">
    <div class="left">
  <div id="Lour" style="height: 100%">
    <div class="left" style="height: 101%">
      <div class="top">
        <div class="top-l">
          <div class="left-top">
@@ -10,9 +10,10 @@
            <div class="l-t-state">
              <span
                :class="{
                  'l-t-s-grey': state == '掉线',
                  'l-t-s-green': state == '测试',
                  'l-t-s-red': state == '报警',
                  'l-t-s-grey': state == dataState[0],
                  'l-t-s-green': state == dataState[1],
                  'l-t-s-yewllo': state == dataState[3],
                  'l-t-s-red': state == dataState[3],
                  'l-t-s-yuan': true,
                }"
              ></span>
@@ -37,7 +38,11 @@
            <el-tab-pane label="预警历史" name="first">
              <!-- <el-tab-pane label="预警历史" name="second"> -->
              <div class="frist-left">
                <div id="echart01" style="width: 100%; height: 260px"></div>
                <div
                  id="echart01"
                  style="width: 100%; height: 260px"
                  ref="echart01"
                ></div>
                <div class="l-main-2">
                  <div class="l-m-2-heard">
@@ -122,9 +127,14 @@
                      v-show="eventDetails.length != 0"
                      class="l-m-2-m-table"
                    >
                      <p class="l-m-2-m-tableheard">{{ value.year }}年</p>
                      <p
                        class="l-m-2-m-tableheard"
                        style="fontsize: 20px; font-weight: 100"
                      >
                        {{ value.year }}年
                      </p>
                      <div class="l-m-2-m-tablemain">
                        <el-table :data="value.data" style="width: 100%">
                        <el-table :data="value.data" style="width: 100%" highlight-current-row @current-change="handleCurrentChange"><!--highlight-current-row: 单选,current-change单选事件-->
                          <el-table-column type="index"> </el-table-column>
                          <el-table-column label="日期" prop="day">
                          </el-table-column>
@@ -149,8 +159,9 @@
                              <el-tag>{{ props.row.state }}</el-tag>
                            </template>
                          </el-table-column>
                          <el-table-column label="跳转实时" prop="">
                          </el-table-column>
                          <!-- <el-table-column label="跳转实时" prop="">
                          </el-table-column> -->
                        </el-table>
                      </div>
                    </div>
@@ -427,8 +438,6 @@
                              ></el-input>
                            </el-form-item>
                          </el-col>
                        </el-row>
                        <el-row>
                          <el-col span="12">
                            <el-form-item label="心跳时间">
                              <el-input
@@ -479,30 +488,37 @@
                                </span>
                            </div> -->
            <!-- 图暂时没有 -->
            <!-- <div class="r-b-t-main">
                                <span class="r-b-t-left" style="position:relative;top: -27px;">部署图片</span>
                                <span class="r-b-t-right">
                                    <div
                                    class="r-b-t-r-imgsl"
                                    v-for="(value,index) in imgsl"
                                    :key="index"
                                    >
                                        <el-image
                                            style="width: 68px; height: 68px"
                                            :src="value"
                                            :preview-src-list="imgsl"
                                            v-show="value != 'no'"
                                        >
                                        </el-image>
                                        <div
                                        v-show="value == 'no'"
                                        style="width: 68px; height: 68px;text-algin: center;color: rgba(0,0,0,.5)"
                                        >
                                            无图片
                                        </div>
                                    </div>
                                </span>
                            </div> -->
            <div class="r-b-t-main">
              <span class="r-b-t-left" style="position: relative; top: -27px"
                >部署图片</span
              >
              <span class="r-b-t-right">
                <div
                  class="r-b-t-r-imgsl"
                  v-for="(value, index) in imgsl"
                  :key="index"
                >
                  <el-image
                    style="width: 68px; height: 68px"
                    :src="value"
                    :preview-src-list="imgsl"
                    v-show="value != 'no'"
                  >
                  </el-image>
                  <div
                    v-show="value == 'no'"
                    style="
                      width: 68px;
                      height: 68px;
                      text-algin: center;
                      color: rgba(0, 0, 0, 0.5);
                    "
                  >
                    无图片
                  </div>
                </div>
              </span>
            </div>
            <div class="r-b-t-main">
              <span class="r-b-t-left">部署时间</span>
              <span class="r-b-t-right">{{ deploymentTime }}</span>
@@ -510,13 +526,23 @@
          </div>
          <div class="r-b-map">
            <el-row>
              <iframe
              <!-- <iframe
                id="supervisoryMap"
                ref="supervisoryMap"
                :src="baseUrl"
                frameborder="0"
                width="100%"
                height="100%"
              ></iframe> -->
              <!-- <button @click="re">刷新</button> -->
              <iframe
                id="detailMap"
                ref="detailMap"
                :src="baseUrl"
                frameborder="0"
                width="100%"
                height="100%"
                name="detailMap"
              ></iframe>
            </el-row>
          </div>
@@ -535,6 +561,8 @@
export default {
  data() {
    return {
      // timeL: "",
      a: "",
      myDeviceNumber: "",
      //折线图
@@ -552,9 +580,9 @@
      calls: "",
      labels: ["店面", "楼房"],
      imgsl: [
        "https://resource-city.sensoro.com/B8D675A3C4F71C5C8DE2FD764881BE57",
        "https://resource-city.sensoro.com/1723C1A66DB44F792564F3648E5AA1EE",
        "https://resource-city.sensoro.com/6E0FB78DC42C35F3B8FF0F6A03472433",
        // "https://resource-city.sensoro.com/B8D675A3C4F71C5C8DE2FD764881BE57",
        // "https://resource-city.sensoro.com/1723C1A66DB44F792564F3648E5AA1EE",
        // "https://resource-city.sensoro.com/6E0FB78DC42C35F3B8FF0F6A03472433",
      ],
      deploymentTime: "2019-08-28 11:16:14",
@@ -563,6 +591,13 @@
      isRecord: true,
      screens: false,
      //复选框
      dataState: ["掉线", "在线", '故障', "预警"],
      // [grey,green,red][
      //   onlineStatus = 0,
      //   onlineStatus = 1,
      //   state!= "",
      //   jtype != 2
      //   ]
      checkAll: false,
      checkedCities: [], //选择的
      cities: cityOptions,
@@ -580,6 +615,7 @@
        menuAlign: "center",
        column: {},
      },
      eventDetails: [], //真实数据
      eventDetaill: [
        //原始数据
@@ -671,6 +707,7 @@
      //     heartbeat: '2021-04-07', //     心跳时间
      // },
      baseUrl: "", //mapurl\
      mapStart: false,
      //省份
      form: {},
@@ -740,6 +777,11 @@
      let option = {
        title: {
          text: "警情月分布",
          textStyle: {
            fontSize: 18,
            fontStyle: "300",
            fontFamily: "sans-serif",
          },
        },
        tooltip: {
          trigger: "axis",
@@ -803,9 +845,9 @@
      this.myChart.setOption(option);
      this.myChart.hideLoading();
      //建议加上以下这一行代码,不加的效果图如下(当浏览器窗口缩小的时候)。超过了div的界限(红色边框)
      window.addEventListener("resize", function () {
        myChart.resize();
      });
      // window.addEventListener("resize", function () {
      //   this.myChart.resize();
      // });
    },
    modifyl() {
      //right 修改按钮
@@ -897,8 +939,28 @@
    },
    stetDetails(d) {
      this.name = "无数据" && d.deviceName;
      this.state =
        "无数据" && d.dtype == 0 ? "掉线" : d.dtype == 1 ? "测试" : "报警";
      //设备状态
      // [grey,green,red][
      //   onlineStatus = 0,
      //   onlineStatus = 1,
      //   state!= "",
      //   jtype != 2
      //   ]
      var states,
      o = this.a.onlineStatus,
      s = this.a.state,
      j = this.a.jtype;
      if(o == 0){
        states = '掉线';
      }else if(o == 1){
        states = '在线';
      }else if(s != ""){
        states = '故障';
      }else if(j != 2){
        states = '预警';
      }
      this.state = "无数据" && states;
      this.evaluate = "空气质量";
      this.machineCode = "无数据" && d.deviceNumber;
      this.smoke = "烟雾";
@@ -907,7 +969,8 @@
      this.contacts = "无数据" && d.oneContacts;
      this.calls = "无数据" && d.onePhone;
      this.labels = ["无数据"] && [d.deviceType];
      this.imgsl = ["no"];
      var imgD = ["no"];
      this.imgsl = ["no"] && imgD;
      this.deploymentTime = "无数据" && d.stime;
      this.detailsData = {
@@ -997,6 +1060,18 @@
          creates(i, tData);
        }
      }
      for(var k1 in Num){//添加序号
        var n2 = Num[k1];
        for(var k2 in n2){
          if(k2 == 'year'){continue};
          // console.log(n2[k2])
          var n3 = n2[k2];
          for(var k3 in n3){
            // console.log(+k3 + 1);
            n3[k3].i = +k3 + 1;
          }
        }
      }
      // console.log(Num);
      this.eventDetaill = Num;
      this.eventDetails = this.eventDetaill; //载入历史事件数据
@@ -1021,15 +1096,30 @@
      this.numdatalist = dataM;
      this.startEcharts01();
    },
    getMap() {
      window.frames[0].init("DetailMap", {
        x: this.a.jd,
        y: this.a.wd,
      });
    },
    re() {
      //   var _body = window.parent;
      //   var _iframe1=_body.document.getElementById('detailMap');
      //   window.onbeforeunload=function(){};
      //   _iframe1.contentWindow.location.reload(true);
      location.reload();
    },
    handleCurrentChange(val){
        console.log(val.i)
    }
  },
  created() {
    // let loadingInstance1  = Loading.service({ fullscreen: true });
    this.baseUrl = `/map/index.html?openid=SupervisoryMap`;
    // this.baseUrl = `/map/index.html?openid=SupervisoryMap`;
    this.a = this.$route.query;
    this.baseUrl = `/map/index.html?ISinit=1&openid=DetailMap&jd=${this.a.jd}&wd=${this.a.wd}`;
    this.myDeviceNumber = this.$route.query.deviceNumber;
    var a = this.$route.query;
    console.log(a);
    // console.log(this.a);
    // console.log(this.myDeviceNumber);
    this.getdata();
    this.getdataG();
@@ -1038,13 +1128,27 @@
  mounted() {
    this.loginEcharts01(); //载入折线图等待数据
    // this.eventDetails = this.eventDetaill;//载入历史事件数据
    // this.doEvents();//cc
    // this.doEvents();
    // var timel = setTimeout(() => {
    this.$refs.detailMap.onload = () => {
      // window.frames[0].init("DetailMap", {
      //   x: this.a.jd,
      //   y: this.a.wd,
      // });
      if (window.frames[0].init) {
        this.getMap();
      } else {
        // this.re();
        console.log(`没有找到到window.frames[0].init`)
      }
    };
  },
};
</script>
<style lang="scss" >
#Lour {
  width: 100%;
  font-size: 14px;
  height: 100%;
  // font: 12px/1.5 Tahoma,Helvetica,Arial,'宋体',sans-serif;
  // font: 12px/1 Tahoma,Helvetica,Arial,"\5b8b\4f53",sans-serif;
@@ -1054,12 +1158,13 @@
  display: flex;
  // align-items: center;
  justify-content: space-around;
  position: relative;
  // position: relative;
  font-size: 13px;
  line-height: 20px;
  font-weight: normal;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  .left {
    width: 67%;
    height: 100%;
@@ -1113,16 +1218,20 @@
            .l-t-s-green {
              background-color: rgb(41, 202, 135);
            }
            .l-t-s-yewllo{
              background-color: rgb(240, 181, 20);
            }
            .l-t-s-red {
              background-color: rgb(243, 75, 75);
              background-color: rgba(247, 28, 28, 0.877);
            }
          }
        }
      }
      .left-bot,
      .top-r {
        font-weight: 900;
        color: rgba($color: #00000075, $alpha: 0.25);
        font-size: 14px;
        font-weight: 400;
        color: #c4c4c4;
        // border: 1px solid rgb(24, 207, 48);
      }
      .left-bot {
@@ -1223,7 +1332,12 @@
      .l-m-2-main {
        width: 100%;
        height: 370px;
        overflow: scroll;
        // overflow: scroll;
        overflow-y: scroll;//滚动条
        scrollbar-color: transparent transparent;
        scrollbar-track-color: transparent;
        -ms-scrollbar-track-color: transparent;
        // border: 1px solid rg b(23, 66, 209);
        .l-m-2-m-not {
          display: flex;
@@ -1278,7 +1392,7 @@
  }
  .right {
    width: 30%;
    height: 88.5%;
    height: 95.5%;
    // border: 1px solid rgb(23, 201, 62);
    background-color: #fff;
    display: flex;
@@ -1320,7 +1434,9 @@
          display: flex;
          align-items: center;
          justify-content: space-between;
          // border: 1px solid rgb(148, 199, 159);
          padding: 10px 0 10px 0;
          margin-bottom: 5px;
        }
        .r-b-t-left {
          display: block;
@@ -1332,6 +1448,8 @@
        .r-b-t-right {
          display: block;
          width: 70%;
          color: #5d5d5d;
          font-size: 12px;
          // border: 1px solid rgb(49, 74, 184);
          .r-b-t-r-label {
            float: left;
@@ -1350,11 +1468,13 @@
        }
      }
      .r-b-map {
        height: 550px;
        border: 1px solid rgba(109, 109, 109, 0.2);
        #supervisoryMap {
        height: 500px;
        // border: 1px solid rgba(109, 109, 109, 0.2);
        #detailMap {
          position: relative;
          top: 25px;
          width: 100%;
          height: 550px;
          height: 500px;
        }
      }
    }