index.vue 15.4 KB
Newer Older
耿迪迪's avatar
耿迪迪 committed
1 2 3 4
<!--
 * @Author: 纪泽龙 jizelong@qq.com
 * @Date: 2022-09-03 10:51:24
 * @LastEditors: 纪泽龙 jizelong@qq.com
5
 * @LastEditTime: 2022-11-22 14:16:37
耿迪迪's avatar
耿迪迪 committed
6 7 8 9 10 11
 * @FilePath: /danger-manage-web/src/views/index.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="index-wrapper">
    <Top />
12 13
    <Left
      v-if="charsShow"
耿迪迪's avatar
耿迪迪 committed
14 15 16 17
      ref="left"
      @clickShow="clickShow"
      @dangerDeviceChange="dangerDeviceChange"
    />
纪泽龙's avatar
纪泽龙 committed
18
    <Right v-if="charsShow" ref="right" />
耿迪迪's avatar
耿迪迪 committed
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
    <Bottom
      v-show="deviceOrDangerType == 1"
      @deviceChange="deviceChange"
      ref="bottom"
    />

    <div id="mapbox"></div>
  </div>
</template>

<script>
import CreateCesium from "@/utils/cesium/cesiumClass.js";
import Video from "@/components/bigWindow/video";
import tcq from "@/components/bigWindow/tcq";
import Null from "@/components/bigWindow/Null";
import Danger from "@/components/bigWindow/Danger";
35
import Danger2 from "@/components/bigWindow/Danger2";
耿迪迪's avatar
耿迪迪 committed
36 37 38 39 40 41 42 43
import weixiandian from "@/components/bigWindow/weixiandian";
import ydqt from "@/components/bigWindow/ydqt";
import danger from "@/assets/images/danger.png";

import Top from "@/views/indexComponents/Top";
import Left from "@/views/indexComponents/Left";
import Right from "@/views/indexComponents/Right";
import Bottom from "@/views/indexComponents/Bottom";
纪泽龙's avatar
纪泽龙 committed
44 45

import { deviceInfoLists } from "@/api/map/deviceInfo";
46 47

import { dangerArr } from "@/utils/cesium/dangerArr.js";
耿迪迪's avatar
耿迪迪 committed
48 49
export default {
  name: "shouye",
50 51 52 53 54
  props: {
    charsShow: {
      type: Boolean,
      default: true,
    },
纪泽龙's avatar
纪泽龙 committed
55
  },
耿迪迪's avatar
耿迪迪 committed
56 57 58 59 60 61 62 63 64 65 66 67
  components: {
    Top,
    Left,
    Right,
    Bottom,
  },
  data() {
    return {
      timer: null,
      deviceOrDangerType: 1,
      data2: [
        {
纪泽龙's avatar
纪泽龙 committed
68
          deviceType: 10,
纪泽龙's avatar
纪泽龙 committed
69
          longitude: 114.081436341043262,
70
          latitude: 38.24983817327583,
71
          shortNum: 7,
耿迪迪's avatar
耿迪迪 committed
72 73 74 75 76 77 78 79 80 81 82 83 84
          title: "锅炉点火",
          wxymc: "煤气管道",
          zj: "DN1600",
          zc: "500m",
          fxjb: "四级",
          knyfdfx: "中毒",
          wxxlb: "易燃气体,类别1;加压气体",
          qrtj: "吸入",
          hjwh: "对环境有危害,对大气可造成污染",
          rbwx: "本品易燃",
          yhrscw: "二氧化碳。",
        },
        {
纪泽龙's avatar
纪泽龙 committed
85
          deviceType: 10,
纪泽龙's avatar
纪泽龙 committed
86
          longitude: 114.07705728663734,
87 88
          latitude: 38.249097661403205,
          shortNum: 6,
耿迪迪's avatar
耿迪迪 committed
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
          title: "有害气体",
          wxymc: "氮气储罐",
          gtrl: "2万m3",
          ccl: "22.86 t",
          ljl: "20 t",
          fxjb: "四级",
          yhwcf: "氮",
          nd: "≥99.999%",
          wxxlb: "加压气体",
          qrtj: "吸入",
          knyfdfx: "缺氧窒息",
          rbwx: "本品不燃",
          wxtx: "若遇高热,容器内压增大,有开裂和爆炸的危险",
        },
      ],
      danger: [
        {
          lnglatArr: [
107 108 109 110
            [114.07699224128288, 38.24917864421566],
            [114.07647701382231, 38.24916311225547],
            [114.07651429608312, 38.24895731354076],
            [114.07708709377842, 38.248960473114614],
耿迪迪's avatar
耿迪迪 committed
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
          ],
          colorNum: 1,
          fxlb: "高风险区域",
          bsjh: "",
          wxy: "锅炉操作",
          fxd: "锅炉点火",
          wxys: "操作人员违章作业来点火成功继续频繁点火",
          whhg: "丧失劳动能力",
          sglx: "锅炉爆炸,出点活在",
          sgfspl: "平均2-3年发生一起",
          gkcj: "班组级",
          gkbm: "安全管理部",
          gkzrgw: "锅炉工",
          gkzrr: "张三",
          gl: "公司建立有奖惩制度,安全巡检制度,及时制止违章操作,开对为长者进行适量触发,锅炉工持证上岗,定期接受安全培训",
          gcjs: "根据作业活动风险分析,指定适用的安全作业规程",
          src: danger,
        },
        {
          lnglatArr: [
131 132 133 134
            [114.07806724970564, 38.25034815051717],
            [114.07639696862833, 38.2502261900133],
            [114.07639078797055, 38.24993383198078],
            [114.078151284626, 38.25000196180475],
耿迪迪's avatar
耿迪迪 committed
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
          ],
          colorNum: 2,
          fxlb: "中风险区域",
          bsjh: "",
          wxy: "锅炉操作",
          fxd: "锅炉点火",
          wxys: "操作人员违章作业来点火成功继续频繁点火",
          whhg: "丧失劳动能力",
          sglx: "锅炉爆炸,出点活在",
          sgfspl: "平均2-3年发生一起",
          gkcj: "班组级",
          gkbm: "安全管理部",
          gkzrgw: "锅炉工",
          gkzrr: "张三",
          gl: "公司建立有奖惩制度,安全巡检制度,及时制止违章操作,开对为长者进行适量触发,锅炉工持证上岗,定期接受安全培训",
          gcjs: "根据作业活动风险分析,指定适用的安全作业规程",
          src: danger,
        },
        {
          lnglatArr: [
155 156 157 158
            [114.0777392710896, 38.250782019890394],
            [114.07734950538038, 38.250761421969486],
            [114.0773933590535, 38.25022891713582],
            [114.07777116413182, 38.250232988449945],
耿迪迪's avatar
耿迪迪 committed
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
          ],
          colorNum: 3,
          fxlb: "低风险区域",
          bsjh: "",
          wxy: "锅炉操作",
          fxd: "锅炉点火",
          wxys: "操作人员违章作业来点火成功继续频繁点火",
          whhg: "丧失劳动能力",
          sglx: "锅炉爆炸,出点活在",
          sgfspl: "平均2-3年发生一起",
          gkcj: "班组级",
          gkbm: "安全管理部",
          gkzrgw: "锅炉工",
          gkzrr: "张三",
          gl: "公司建立有奖惩制度,安全巡检制度,及时制止违章操作,开对为长者进行适量触发,锅炉工持证上岗,定期接受安全培训",
          gcjs: "根据作业活动风险分析,指定适用的安全作业规程",
          src: danger,
        },
        {
          lnglatArr: [
179 180 181 182
            [114.08185866090808, 38.24985142677479],
            [114.08093871524032, 38.24985819653048],
            [114.08100272185587, 38.249491674544146],
            [114.08185575292462, 38.24951700145305],
耿迪迪's avatar
耿迪迪 committed
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
          ],
          colorNum: 4,
          fxlb: "中低风险区域",
          bsjh: "",
          wxy: "锅炉操作",
          fxd: "锅炉点火",
          wxys: "操作人员违章作业来点火成功继续频繁点火",
          whhg: "丧失劳动能力",
          sglx: "锅炉爆炸,出点活在",
          sgfspl: "平均2-3年发生一起",
          gkcj: "班组级",
          gkbm: "安全管理部",
          gkzrgw: "锅炉工",
          gkzrr: "张三",
          gl: "公司建立有奖惩制度,安全巡检制度,及时制止违章操作,开对为长者进行适量触发,锅炉工持证上岗,定期接受安全培训",
          gcjs: "根据作业活动风险分析,指定适用的安全作业规程",
          src: danger,
        },
      ],
      data11: [
        {
纪泽龙's avatar
纪泽龙 committed
204
          deviceType: 5,
205 206
          longitude: 114.07848044941088,
          latitude: 38.24830985372926,
耿迪迪's avatar
耿迪迪 committed
207
          shortNum: 10,
208
          title: "视频1",
耿迪迪's avatar
耿迪迪 committed
209 210
        },
        {
纪泽龙's avatar
纪泽龙 committed
211
          deviceType: 5,
212 213
          longitude: 114.07858975280202,
          latitude: 38.24853877908846,
耿迪迪's avatar
耿迪迪 committed
214 215 216
          shortNum: 16,
          title: "视频2",
        },
217
        {
纪泽龙's avatar
纪泽龙 committed
218
          deviceType: 5,
219 220 221 222 223 224
          longitude: 114.0788726514246,
          latitude: 38.24854905109693,
          shortNum: 16,
          title: "视频3",
        },
        {
纪泽龙's avatar
纪泽龙 committed
225
          deviceType: 5,
226 227 228 229 230 231
          longitude: 114.07933673582353,
          latitude: 38.24932372451273,
          shortNum: 10,
          title: "视频4",
        },
        {
纪泽龙's avatar
纪泽龙 committed
232
          deviceType: 5,
233 234 235 236 237 238
          longitude: 114.07943113040781,
          latitude: 38.249634714126636,
          shortNum: 16,
          title: "视频5",
        },
        {
纪泽龙's avatar
纪泽龙 committed
239
          deviceType: 5,
240 241 242 243 244 245
          longitude: 114.08000305885355,
          latitude: 38.2494852174479,
          shortNum: 16,
          title: "视频6",
        },
        {
纪泽龙's avatar
纪泽龙 committed
246
          deviceType: 5,
247 248 249 250 251 252
          longitude: 114.08007200486942,
          latitude: 38.249835018521594,
          shortNum: 16,
          title: "视频7",
        },
        {
纪泽龙's avatar
纪泽龙 committed
253
          deviceType: 5,
254 255 256 257 258
          longitude: 114.07771206027549,
          latitude: 38.252223651533114,
          shortNum: 16,
          title: "视频8",
        },
耿迪迪's avatar
耿迪迪 committed
259 260 261 262 263
      ],
      data12: [
        {
          deviceType: 12,
          deviceState: 1,
264 265
          longitude: 114.08259457996853,
          latitude: 38.25080252536212,
耿迪迪's avatar
耿迪迪 committed
266 267 268 269 270 271 272 273 274 275
          shortNum: 12,
          title: "报警器",
          sbmc: "气体报警器",
          sbbh: "HBS030015037",
          tcjz: "甲烷",
          sbzt: "正常",
        },
        {
          deviceType: 12,
          deviceState: 2,
276 277
          longitude: 114.08158936858243,
          latitude: 38.25068850682793,
耿迪迪's avatar
耿迪迪 committed
278 279 280 281 282 283 284 285 286 287
          shortNum: 12,
          title: "报警器",
          sbmc: "气体报警器",
          sbbh: "HBS030015037",
          tcjz: "甲烷",
          sbzt: "警告",
        },
        {
          deviceType: 12,
          deviceState: 3,
288 289
          longitude: 114.08105373626017,
          latitude: 38.2510912127248,
耿迪迪's avatar
耿迪迪 committed
290 291 292 293 294 295 296 297 298
          shortNum: 12,
          title: "报警器",
          sbmc: "气体报警器",
          sbbh: "HBS030015037",
          tcjz: "甲烷",
          sbzt: "报警",
        },
        {
          deviceType: 13,
299 300 301
          longitude: 114.08375950924253,
          latitude: 38.25066072012857,
          shortNum: 8,
耿迪迪's avatar
耿迪迪 committed
302 303 304 305 306 307 308 309 310
          title: "探测器",
          sbmc: "电力探测器",
          sbbh: "HBS030015032",
          tcjz: "电力",
          sbzt: "正常",
          jcz: "32A",
        },
        {
          deviceType: 14,
311 312 313
          longitude: 114.08344461545148,
          latitude: 38.249814328043456,
          shortNum: 8,
耿迪迪's avatar
耿迪迪 committed
314 315 316 317 318 319 320 321 322
          title: "探测器",
          sbmc: "压力探测器",
          sbbh: "HBS030015037",
          tcjz: "压力",
          sbzt: "正常",
          jcz: "2.3MPa",
        },
        {
          deviceType: 14,
323 324 325
          longitude: 114.08201936134395,
          latitude: 38.25019833311851,
          shortNum: 8,
耿迪迪's avatar
耿迪迪 committed
326 327 328 329 330 331 332 333 334
          title: "探测器",
          sbmc: "压力探测器",
          sbbh: "HBS030015037",
          tcjz: "压力",
          sbzt: "正常",
          jcz: "1.3MPa",
        },
        {
          deviceType: 15,
335 336 337
          longitude: 114.08274961653991,
          latitude: 38.24983876031178,
          shortNum: 8,
耿迪迪's avatar
耿迪迪 committed
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372
          title: "探测器",
          sbmc: "温度探测器",
          sbbh: "HBS030015037",
          tcjz: "温度",
          sbzt: "正常",
          jcz: "42°C",
        },
      ],
    };
  },
  // beforeMount() {
  //   // 渲染之前,让顶部消失
  //   this.rootTopShowChange(false);
  // },
  // destroyed() {
  //   // 消失之后,让顶部出现
  //   clearTimeout(this.timer);
  //   this.timer = setTimeout(() => {
  //     if (this.$route.path === "/index") {
  //       return;
  //     }
  //     this.rootTopShowChange(true);
  //   }, 500);
  // },
  mounted() {
    this.Cesium = new CreateCesium(
      "mapbox",
      ["../3dtiles/jsondata/tileset.json"],
      this
    );
    this.init();
  },
  beforeDestroy() {
    // 挂掉该关的 infowindow 跟计算infowindow位置的计时器
    this.Cesium.clearInfoWindow();
373
    this.Cesium.destroy();
耿迪迪's avatar
耿迪迪 committed
374 375 376 377 378 379
  },
  methods: {
    //进入此页面监听路由变化 让最顶上的东西隐藏
    // rootTopShowChange(boolean) {
    //   this.$parent.$parent.topShow = boolean;
    // },
纪泽龙's avatar
纪泽龙 committed
380

耿迪迪's avatar
耿迪迪 committed
381
    init() {
382 383 384 385 386 387 388
      // this.data2.forEach((item, index) => {
      //   if (index == 0) {
      //     this.Cesium.addDevice(item, "pic", weixiandian);
      //   } else {
      //     this.Cesium.addDevice(item, "pic", ydqt);
      //   }
      // });
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415
      // 如果有缓存
      // const J =  localStorage.getItem("J");
      // if (J) {
      //   const data = JSON.parse(J);
      //   data
      //     .map((item) => {
      //       return {
      //         lnglatArr: item.path,
      //         ...item,
      //       };
      //     })
      //     .forEach((item) => {
      //       this.Cesium.addDanger(item, Null);
      //     });
      // } else {
      //   this.danger.forEach((item) => {
      //     this.Cesium.addDanger(item, Danger);
      //   });
      // }
      dangerArr
        .map((item) => {
          return {
            lnglatArr: item.path,
            ...item,
          };
        })
        .forEach((item) => {
416
          this.Cesium.addDanger(item, Danger);
417
        });
纪泽龙's avatar
纪泽龙 committed
418 419 420 421
      // this.data11.forEach((item) => {
      //   item.config = { scale: 1, textHeight: -32 };
      //   this.Cesium.addDevice(item, "pic", Video);
      // });
纪泽龙's avatar
纪泽龙 committed
422 423 424 425 426
      // this.data12.forEach((item) => {
      //   item.config = { scale: 1, textHeight: -94 };
      //   this.Cesium.addDevice(item, "pic", tcq);
      // });
      // // 初始化危险源关闭
耿迪迪's avatar
耿迪迪 committed
427
      this.Cesium.dangerAllShow(false);
纪泽龙's avatar
纪泽龙 committed
428 429 430 431 432 433 434 435 436
      this.deviceInfoLists();
    },
    deviceInfoLists() {
      deviceInfoLists().then((res) => {
        console.log("设备", res);
        res
          .map((item) => {
            let obj;
            // 视频
437

纪泽龙's avatar
纪泽龙 committed
438
            if (item.mapDeviceType == 5) {
439
            console.log(item,"item");
纪泽龙's avatar
纪泽龙 committed
440 441 442
              obj = {
                latitude: item.latitude,
                longitude: item.longitude,
443
                deviceId: item.mapDeviceId,
纪泽龙's avatar
纪泽龙 committed
444 445
                shortNum: 10,
                deviceType: item.mapDeviceType,
446
                sbbh: item.mapDeviceNum,
纪泽龙's avatar
纪泽龙 committed
447
                title: item.mapDeviceName,
448
                config: { scale: 1, textHeight: -32 },
纪泽龙's avatar
纪泽龙 committed
449 450 451
              };
            } else {
              obj = {
452
                deviceId: item.mapDeviceId,
纪泽龙's avatar
纪泽龙 committed
453 454 455 456 457 458 459 460 461 462
                latitude: item.latitude,
                longitude: item.longitude,
                deviceType: item.mapDeviceType,
                title: item.mapDeviceName,
                sbmc: item.mapDeviceName,
                // 号
                sbbh: item.mapDeviceNum,
                // 探测介质
                tcjz: item.mapDeviceMedium,
                sbzt: item.monitorDeviceStatus,
463
                jcz:item.monitorValue?item.monitorValue + "" + item.mapDeviceUnit:'-',
纪泽龙's avatar
纪泽龙 committed
464
                shortNum: 12,
465
                config: { scale: 1, textHeight: -94 },
纪泽龙's avatar
纪泽龙 committed
466 467 468 469 470 471 472 473 474 475 476 477
              };
            }
            return obj;
          })
          .forEach((item) => {
            if (item.deviceType == 5) {
              this.Cesium.addDevice(item, "pic", Video);
            } else {
              this.Cesium.addDevice(item, "pic", tcq);
            }
          });
      });
耿迪迪's avatar
耿迪迪 committed
478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497
    },
    clickShow(e) {
      // 控制两个组件的展示与隐藏
      this.$refs.left.domShow(e);
      this.$refs.right.domShow(e);
    },
    deviceChange(obj) {
      const { activeArr, deviceType } = obj;
      this.bottomObj = obj;
      // 如果存在于数组,就是要展示了,如果不存在就隐藏
      const bool = activeArr.includes(deviceType);
      this.Cesium.deviceFilter(bool, deviceType);
    },
    dangerDeviceChange(e) {
      if (e.type == 1) {
        this.deviceOrDangerType = e.type;
      } else {
        this.deviceOrDangerType = e.type;
      }
      console.log(this.$refs.bottom.activeArr);
498
      this.Cesium.dangeDeviceChange(e.type, this.$refs.bottom.activeArr);
耿迪迪's avatar
耿迪迪 committed
499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520
    },

    // DeviceChange(){

    // }
  },
};
</script>
<style lang="scss" scoped>
.index-wrapper {
  width: 100%;
  // height: 100%;
  // height: calc(100vh - 84px);
  height: 100vh;
  // background: red;
  position: relative;
  #mapbox {
    width: 100%;
    height: 100%;
  }
}
</style>