index.vue 30.8 KB
Newer Older
zhangjianqian's avatar
zhangjianqian committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
<!--
 * @Author: your name
 * @Date: 2022-01-11 13:44:17
 * @LastEditTime: 2022-03-10 09:12:48
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: /test/hello-world/src/views/Home.vue
-->
<template>
  <div class="home bigwindow">
    <!--<div class="goSystem" @click="$router.push('/index')">进入管理系统</div>-->
    <div id="map"></div>
    <!-- <Center :show="show" :centerData="centerData" /> -->
    <UserCenter
      :title="centerTitle"
      :show="userCenterShow"
      ref="userCenter"
      :detcetorList="detcetorList"
      :userId="centerUserId"
      :total="centerTotal"
      :pageSize="20"
    />
    <OtherCenter
      :title="centerTitle"
      :show="otherCenterShow"
      ref="otherCenter"
      :detcetorList="detcetorList"
      :userId="centerUserId"
      :total="centerTotal"
      :pageSize="20"
    />
    <PipeColor />
    <!-- 底部按钮 -->
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
    <!--<div class="home-div">-->
      <!--<img src="@/assets/mapinages/bottombanner.png" alt="" style="" />-->
      <!--<div class="listingsSty fangy">-->
        <!--<div-->
          <!--@click="allCompany"-->
          <!--:class="selarr.length == companyLength ? 'active' : ''"-->
          <!--class="firsty"-->
        <!--&gt;-->
          <!--全部-->
        <!--</div>-->
        <!--<div-->
          <!--class="firsty"-->
          <!--:class="selarr.indexOf(item.val) >= 0 ? 'active' : ''"-->
          <!--v-for="(item, index) in typeList"-->
          <!--:key="item.val"-->
          <!--@click="sel(index, item)"-->
        <!--&gt;-->
          <!--{{ item.name }}-->
        <!--</div>-->
      <!--</div>-->
    <!--</div>-->
zhangjianqian's avatar
zhangjianqian committed
55 56 57
    <div class="event_div" @click="handleAdd">
        事件接报
    </div>
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
    <!--<div class="mouseToolBtn">-->
      <!--<button class="serBtn" @click="openDraw()" id="mouseToolBtn">画图</button>-->
    <!--</div>-->
    <!--<div class="delTu" id="delTu">-->
      <!--&lt;!&ndash;<input name="in" type="radio" @click="delRadioLays()"/>&ndash;&gt;-->
    <!--</div>-->
    <!--<div class="toolBtn" :style="display">-->
      <!--<div class="el-form-div" style="height: 30px;background: black">-->
        <!--<div class="detail-title">标绘工具</div>-->
        <!--<div style="cursor: pointer;" >-->
          <!--<img style="width: 20px;height: 20px;margin-top: 5px;" @click="closeDraw" src="@/assets/mapImages/closeBtn.png" alt="" />-->
        <!--</div>-->
      <!--</div>-->
      <!--<div class="el-form-div">-->
          <!--<div style="width: 50%">-->
            <!--<div class="tool-div" @click="drawMark()">标记</div>-->
            <!--<div class="tool-div" @click="drawCircle()">圆形 </div>-->
            <!--<div class="tool-div" @click="drawRule()">测距</div>-->
            <!--<div class="tool-div" @click="editDraw()">编辑图形</div>-->
            <!--<div class="tool-div" @click="map.delOverlays()">删除图形</div>-->
            <!--<div class="tool-div" @click="mouseToolDrawClear">清除所有</div>-->
          <!--</div>-->
          <!--<div style="width: 50%">-->
            <!--<div class="tool-div" @click="drawPolyline()">线段</div>-->
            <!--<div class="tool-div" @click="drawPolygon()">多边形</div>-->
            <!--<div class="tool-div" @click="drawMeasureArea()">面积</div>-->
            <!--<div class="tool-div" @click="endEditDraw()">关闭编辑</div>-->
            <!--<div class="tool-div" @click="map.endOverlays()">结束绘制</div>-->
            <!--<div class="tool-div">保存图片</div>-->
          <!--</div>-->
      <!--</div>-->
    <!--</div>-->
zhangjianqian's avatar
zhangjianqian committed
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
    <!-- 设备按钮 -->
    <div class="typelist-div">
      <div
        class="list"
        v-for="(item, index) in arr"
        :key="index"
        :class="selarr1.indexOf(item.val) >= 0 ? 'active' : ''"
        @click="sel1(index, item)"
      >
        <img
          :src="item.imgurl"
          style="margin-top: 2px; float: left; margin-right: 3px"
        />
        {{ item.name }}
      </div>
    </div>
    <div class="typelist-div2">
      <div
        class="list"
109
        style="width: 146px;height: 35px;line-height: 35px;"
zhangjianqian's avatar
zhangjianqian committed
110 111 112 113 114 115 116
        v-for="(item, index) in arr2"
        :key="index"
        :class="selarr1.indexOf(item.val) >= 0 ? 'active' : ''"
        @click="sel1(index, item)"
      >
        <img
          :src="item.imgurl"
117
          style="margin-top: 6px;float: left; margin-right: 3px;width: 18px;height: 18px;margin-left: 10px;"
zhangjianqian's avatar
zhangjianqian committed
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234
        />
        {{ item.name }}
      </div>
    </div>


    <!--&lt;!&ndash; 左边 &ndash;&gt;-->
    <!--<div class="leftbar">-->
      <!--<leftBar ref="mychild2"></leftBar>-->
    <!--</div>-->
    <!-- 右边 -->
    <div class="rightbar">
      <rightBar ref="mychild"></rightBar>
    </div>
    <!-- 添加或修改事件接报对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="900px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
        <div class="el-form-div">
          <div style="width: 50%">
            <el-form-item label="事件名称" prop="eventName">
              <el-input v-model="form.eventName" :disabled="readonly" placeholder="请输入事件名称" />
            </el-form-item>
            <el-form-item label="事件类型" prop="eventType">
              <el-select v-model="form.eventType" placeholder="请选择事件类型" style="width: 100%" :disabled="readonly">
                <el-option
                  v-for="dict in eventTypeOptions"
                  :key="dict.dictValue"
                  :label="dict.dictLabel"
                  :value="parseInt(dict.dictValue)"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="事件等级">
              <el-radio-group v-model="form.eventGrade">
                <el-radio
                  :disabled="readonly"
                  v-for="dict in eventGradeOptions"
                  :key="dict.dictValue"
                  :label="parseInt(dict.dictValue)"
                >{{dict.dictLabel}}</el-radio>
              </el-radio-group>
            </el-form-item>
          </div>
          <div style="width: 50%">
            <el-form-item label="报案人" prop="informant" >
              <el-input v-model="form.informant" placeholder="请输入报案人" :disabled="readonly"/>
            </el-form-item>
            <el-form-item label="案发时间" prop="inforTime" >
              <el-date-picker clearable size="small"
                              :disabled="readonly"
                              v-model="form.inforTime"
                              type="datetime"
                              style="width: 100%"
                              value-format="yyyy-MM-dd HH:mm:ss"
                              placeholder="选择报案时间">
              </el-date-picker>
            </el-form-item>
            <el-form-item label="报案人电话" prop="informantPhone">
              <el-input v-model="form.informantPhone" placeholder="请输入报案人电话" :disabled="readonly"/>
            </el-form-item>
          </div>
        </div>


        <el-form-item label="事发地点" prop="address">
          <el-input v-model="form.address" placeholder="请输入事发地点" :disabled="readonly"/>
        </el-form-item>
        <el-form-item label="经度" prop="longitude">
          <div class="el-form-div">
            <el-input v-model="form.longitude" placeholder="请输入经度" style="width: 120px" :disabled="readonly"/>
            <el-input v-model="form.latitude" placeholder="请输入纬度" style="width: 120px;margin-left: 10px;" :disabled="readonly"/>
            <el-button type="primary" style="margin-left: 10px;" plain @click="MapdialogFun">选择经纬度</el-button>
          </div>

        </el-form-item>

        <el-form-item label="事件描述" prop="describe">
          <el-input v-model="form.describe" type="textarea" placeholder="请输入事件描述" :disabled="readonly"/>
        </el-form-item>
        <el-form-item label="所属企业" prop="enterpriseId">
            <el-select v-model="form.enterpriseName" placeholder="请选择预案等级"  @change="qiyechang" >
              <el-option
                v-for = "dict in enterpriseList"
                :key = "dict.enterpriseId"
                :label = "dict.enterpriseName"
                :value = "dict.enterpriseId"
              />
            </el-select>
        <!--<el-input v-model="form.beyondEnterpriseId" placeholder="请输入所属企业" />-->
        </el-form-item>
        <!--<el-form-item label="指派公司id" prop="enterpriseId">-->
          <!--<el-input v-model="form.enterpriseId" placeholder="请输入指派公司id" />-->
        <!--</el-form-item>-->
        <!--<el-form-item label="指派公司名称" prop="enterpriseName">-->
          <!--<el-input v-model="form.enterpriseName" placeholder="请输入指派公司名称" />-->
        <!--</el-form-item>-->
        <el-form-item label="备注" prop="remarks">
          <el-input v-model="form.remarks" placeholder="请输入备注" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <GetPos
      :dialogVisible.sync="dialogTableVisible"
      device=""
      :devicePos="devicePos"
      @close="dialogcancelFun"
      @getPath="getPath"
    />
  </div>
</template>

<script>
// @ is an alias to /src
235
import { EditorMap } from "@/utils/mapClass/yjmap";
zhangjianqian's avatar
zhangjianqian committed
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272
import { mapGetters, mapActions } from "vuex";
import { listDetectorInfo } from "@/api/detector/detectorInfo";
import { detectorUserList } from "@/api/detector/detectorUser";
import { listReceive, getReceive, delReceive, addReceive, updateReceive } from "@/api/system/receive";

import {
  pipeData,
  tiaoyaxiang,
  famen,
  changzhan,
  jiankong,
  user,
  alarmtime,
} from "@/utils/mapClass/config.js";
import {
  getPipe,
  getTyx,
  getFm,
  getCz,
  getVideo,
  getUser,
  getEnterprise,
  userAlarm,
  getTcqDevice,
} from "@/api/bigWindow/getDevice";
import { listDevice } from "@/api/system/device";
import Line from "@/components/bigWindow/Line.vue";
import VideoView from "@/components/bigWindow/VideoView.vue";
import Device from "@/components/bigWindow/Device.vue";
import Cz from "@/components/bigWindow/Cz.vue";
import User from "@/components/bigWindow/User.vue";
import UserCenter from "@/components/bigWindow/UserCenter.vue";
import OtherCenter from "@/components/bigWindow/OtherCenter.vue";
import Company from "@/components/bigWindow/Company.vue";
import PipeColor from "@/components/emergency/PipeColor.vue";
import GetPos from '@/components/GetPos';
import rightBar from "@/components/emergency/rightBar.vue";
273
import deviceMaterial from "@/components/emergency/deviceMaterial.vue";
zhangjianqian's avatar
zhangjianqian committed
274 275 276 277 278 279 280 281 282
export default {
  name: "Home",
  components: {
    GetPos,
    rightBar,
    // Center,
    UserCenter,
    OtherCenter,
    PipeColor,
283 284
    deviceMaterial,

zhangjianqian's avatar
zhangjianqian committed
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326
  },
  data() {
    return {
      // 是否显示弹出层
      open: false,
      // 事件类型 1水灾 2火灾 3突发字典
      eventTypeOptions: [],
      // 事件等级 1级 2级 3级字典
      eventGradeOptions: [],
      // 弹出层标题
      title: "",
      //选择经纬度
      dialogTableVisible:false,
      devicePos:[],
      deviceList:[],
      enterpriseList:[],
      map: null,
      show: false,
      readonly:true,
      // centerData: null,
      selarr: [1, 2, 3],
      weather: "",
      lower: "",
      higher: "",
      nowDate: "",
      nowweek: "",
      nowtime: "", // 当前日期

      typeList: [
        {
          val: 1,
          name: "中燃翔科",
        },
        {
          val: 2,
          name: "中诚然气",
        },
        {
          val: 3,
          name: "中燃韵科",
        },
      ],
327
      display:"display:none",
zhangjianqian's avatar
zhangjianqian committed
328 329 330 331 332 333 334 335 336 337 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
      //      2:"调压箱",
      // 3:"阀门",
      // 4:"厂站",
      // 5:"监控",
      // 6:"用户",
      arr: [
        {
          val: 2,
          ischeck: false,
          imgurl: require("@/assets/image/tyxsub.svg"),
          name: "调压箱",
        },
        {
          val: 3,
          ischeck: false,
          imgurl: require("@/assets/image/fmjsub.svg"),
          name: "阀门井",
        },
        {
          val: 4,
          ischeck: false,
          imgurl: require("@/assets/image/czsub.svg"),
          name: "场 站",
        },
        {
          val: 6,
          ischeck: false,
          imgurl: require("@/assets/image/usersub.svg"),
          name: "用 户",
        },
        {
          val: 5,
          ischeck: false,
          imgurl: require("@/assets/image/jksub.svg"),
          name: "监 控",
        },
      ],
      arr2: [
        {
367
          val: 10,
zhangjianqian's avatar
zhangjianqian committed
368
          ischeck: false,
369
          imgurl: require("@/assets/image/yj-jydw.png"),
zhangjianqian's avatar
zhangjianqian committed
370 371 372
          name: "救援队伍",
        },
        {
373
          val: 11,
zhangjianqian's avatar
zhangjianqian committed
374
          ischeck: false,
375
          imgurl: require("@/assets/image/yj-wz.png"),
zhangjianqian's avatar
zhangjianqian committed
376 377 378
          name: "救援物资",
        },
        {
379
          val: 12,
zhangjianqian's avatar
zhangjianqian committed
380
          ischeck: false,
381
          imgurl: require("@/assets/image/yj-cl.png"),
zhangjianqian's avatar
zhangjianqian committed
382 383 384
          name: "救援车辆",
        },
        {
385
          val: 13,
zhangjianqian's avatar
zhangjianqian committed
386
          ischeck: false,
387
          imgurl: require("@/assets/image/yj-yy.png"),
zhangjianqian's avatar
zhangjianqian committed
388 389
          name: "医 院",
        },
390
        {
391
          val: 15,
392 393 394 395 396
          ischeck: false,
          imgurl: require("@/assets/image/yj-xf.png"),
          name: "消防队伍",
        },
        {
397
          val: 16,
398 399 400 401
          ischeck: false,
          imgurl: require("@/assets/image/yj-xj.png"),
          name: "巡检人员",
        },
zhangjianqian's avatar
zhangjianqian committed
402 403 404 405 406 407 408 409 410 411 412 413 414 415 416
      ],
      selarr1: [],
      // 用户的center数据
      detcetorList: [],
      centerUserId: null,
      centerTotal: null,
      userCenterShow: false,
      centerTitle: "",

      // 其他设备的center数据
      // 除了这个值,用来显示隐藏,其他值与user共用
      otherCenterShow: false,

      // 报警轮询timer
      alarmTimer: null,
417 418
      //绘制工具
      markNum:0,
zhangjianqian's avatar
zhangjianqian committed
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        eventName: [
          { required: true, message: "请输入事件名称", trigger: "blur" }
        ],
        eventType: [
          { required: true, message: "请选择事件类型", trigger: "blur" }
        ],
        informant: [
          { required: true, message: "请输入报案人", trigger: "blur" }
        ],
        inforTime: [
          { required: true, message: "请输入案发时间", trigger: "blur" }
        ],
        informantPhone: [
          { required: true, message: "请输入报案人电话", trigger: "blur" }
        ],
        longitude: [
          { required: true, message: "请输入经纬度", trigger: "blur" }
        ],
      }
    };
  },

  computed: {
    ...mapGetters(["company", "systemSetting"]),
    companyLength() {
      return this.typeList.length;
    },
  },
  watch: {
    selarr(newValue) {
      if (newValue.length == this.companyLength) {
        // this.$refs.mychild2.choice(0);
      }
    },
  },
  created() {
    //this.getList();
    this.getDicts("event_type").then(response => {
      this.eventTypeOptions = response.data;
  });
    this.getDicts("event_grade").then(response => {
      this.eventGradeOptions = response.data;
  });
  },
  async mounted() {
    this.getList();
    // console.log(99999999999999)
    //   getPipe().then(res=>{
    //   console.log("成功成功成功成功成功成功成功成功成功成功成功成功成功成功成功成功成功成功成功成功",res)
    // }).catch(res=>{
    //   console.log(123)
    // })
    // return;

    const path = eval(this.systemSetting.map_center);
    this.map = new EditorMap(
      "map",
      {
        center: path,
482
        //mapStyle: "amap://styles/f71d3a3d73e14f5b2bf5508bf1411758",
zhangjianqian's avatar
zhangjianqian committed
483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537
        zoom: 14.5,
      },
      this
    );
    // 这是测试,用本地数据
    if (this.systemSetting.prod_test === "test") {
      this.addPipeLine(pipeData, Line);
      this.addDevice(tiaoyaxiang, Device);
      this.addDevice(famen, Device);
      this.addDevice(changzhan, Cz);
      this.addDevice(user, User);
      this.addDevice(jiankong, VideoView);
    } else {
      // 调用状态管理器方法获取公司信息每次都要调取,因为每次进来都是更新的
      this.GetCompany();
      this.typeList = this.company.map((item) => ({
        val: item.conpanyId,
        name: item.companyName,
      }));
      var allarr = this.arr.concat(this.arr2);
      this.selarr = this.company.map((item) => item.conpanyId);
      this.selarr1 = allarr.map((item) => item.val);
      this.arr.forEach((item) => (item.ischeck = true));

      // getPipe() getTyx() getFm() getCz() getVideo() getUser()
      await this.goMap(getEnterprise, this.addDevice, Company);
      this.goMap(getPipe, this.addPipeLine, Line);
      this.goMap(getTyx, this.addDevice, Device);
      this.goMap(getFm, this.addDevice, Device);
      this.goMap(getCz, this.addDevice, Cz);
      this.goMap(getVideo, this.addDevice, VideoView);

      // 用户要等一下 因为有报警数据
      this.goMap(detectorUserList, this.addDevice, User).then((res) => {
        // 先查一下,然后开启定时器
        this.userAlarm();
        this.alarmTimer = setInterval(() => {
          this.userAlarm();
          // console.log("查询报警");
        }, alarmtime);
      });
    }
    this.currentTime();
    // this.$refs.mychild.choice(this.selarr);
    // this.$refs.mychild2.choice(this.selarr);
  },
  methods: {
    /** 查询应急设备列表 */
    getList() {
        var params = {
            "pageNum": 1,
            "pageSize": 1000
          };
        listDevice(params).then(response => {
          response.rows.forEach((item) => {
538
              item.iconType = item.deviceType+9;
zhangjianqian's avatar
zhangjianqian committed
539 540 541
          });
          this.deviceList = response.rows;
          //console.log(this.deviceList)
542
          this.addDevice({"data":this.deviceList},deviceMaterial)
zhangjianqian's avatar
zhangjianqian committed
543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646
           this.arr2.forEach((item) => (item.ischeck = true));
      });
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.readonly=false;
      this.reset();
      this.open = true;
      this.title = "添加事件接报";
    },
    qiyechang(value){
      let obj = {};
      obj = this.enterpriseList.find((item)=>{
        return item.enterpriseId === value;
      ``});
      this.form.enterpriseName = obj.enterpriseName;
      this.form.enterpriseId = value;
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.readonly=true;
      this.reset();
      const id = row.id || this.ids
      getReceive(id).then(response => {
        this.form = response.data;
      this.open = true;
      this.title = "修改事件接报";
    });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            this.form.status = 2;
            updateReceive(this.form).then(response => {
              this.msgSuccess("修改成功");
            this.open = false;
            this.$refs.mychild.choice(0);
          });
          } else {
            addReceive(this.form).then(response => {
              this.msgSuccess("新增成功");
            this.open = false;
            this.$refs.mychild.choice(0);
          });
          }
        }
      });
    },
    //选择经纬度
    MapdialogFun() {
      this.dialogTableVisible = true;
    },
    dialogcancelFun() {
      this.dialogTableVisible = false;
    },
    getPath(res){
      console.log("res", res);
      console.log(this.form.longitude, this.form.latitude);
      //确认选择经纬度
      this.form.longitude = res[0];
      this.form.latitude = res[1];
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        eventName: null,
        eventType: null,
        eventGrade: 0,
        address: null,
        longitude: null,
        latitude: null,
        informant: null,
        inforTime: null,
        informantPhone: null,
        describe: null,
        enterpriseId: null,
        enterpriseName: null,
        remarks: null,
        isDel: null,
        createTime: null
      };
      this.resetForm("form");
    },
    ...mapActions({
      GetCompany: "bigWindowCompany/GetCompany",
    }),
    // 管道上图
    addPipeLine(data, component) {
      for (let comp in data) {
        data[comp].forEach((pipe) => {
          this.map.addPipeLine(pipe, component);
        });
      }
    },
    // 设备上图
    addDevice(data, component) {
647
      //console.log(data,data)
zhangjianqian's avatar
zhangjianqian committed
648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819
      for (let comp in data) {
        data[comp].forEach((pipe) => {
          this.map.addDevice(pipe, component);
        });
      }
    },
    goMap(httpFunc, addFunc, component) {
      return httpFunc().then((res) => {
        // 给用户加icontype
        if (res.data && !res.data[0].iconType) {
          res.data.forEach((item) => {
            item.iconType = 6;
          });
        }
        if(httpFunc==getEnterprise){
          //console.log("000000000",res.data)
          this.enterpriseList= res.data;
        }
        // 根据数据格式不同,赋值不同,如果是个数组,就用res,如果不是就用res.data
        let config = {};
        if (Array.isArray(res)) {
          config = { data: res };
          // 给视频设备的conpanyType变成null,因为视频不受企业控制
          if (res[0].iconType == 5) {
            res.forEach((item) => {
              item.companyType = null;
            });
          }
        } else {
          config = { data: res.data };
        }
        //console.log("======", config);

        addFunc(config, component);
        return config.iconType;
      });
    },
    userAlarm() {
      userAlarm().then((res) => {
        console.log("报警", res.data);
        if (res.data.length > 0) {
          // 报警
          res.data.forEach((item) => {
            this.map.deviceAlarm(item);
          });
          // 看看谁告消警
        }
        this.map.relieveAlarm(res.data);
      });
    },

    myCenterShow(boolean) {
      this.show = boolean;
    },
    // centerDataFunc(centerData) {
    //   this.centerData = centerData;
    //   console.log(centerData);
    //   this.show = true;
    // },

    allCompany() {
      if (this.selarr.length == this.companyLength) {
        this.selarr = [];
      } else {
        this.selarr = this.company.map((item) => item.conpanyId);
      }

      // this.map.companyFilter(this.selarr);
      this.map.allfilter(this.selarr, this.selarr1);
      this.map.infowindowClose();
      this.show = false;
    },
    sel(index, item) {
      this.map.infowindowClose();
      this.show = false;
      const ind = this.selarr.indexOf(item.val);
      if (ind >= 0) {
        this.selarr.splice(ind, 1);
        if (item.val == 3) {
          // this.$refs.mychild.choice(1);
          // this.$refs.mychild2.choice(1);
        } else {
          // this.$refs.mychild.choice(item.val + 1);
          // this.$refs.mychild2.choice(item.val + 1);
        }
      } else {
        this.selarr.push(item.val);
        // this.$refs.mychild.choice(item.val);
        // this.$refs.mychild2.choice(item.val);
      }
      // this.map.companyFilter(this.selarr);
      this.map.allfilter(this.selarr, this.selarr1);
    },

    sel1(index, item) {
      const ind = this.selarr1.indexOf(item.val);
      if (ind >= 0) {
        this.selarr1.splice(ind, 1);
      } else {
        this.selarr1.push(item.val);
      }
      this.map.allfilter(this.selarr, this.selarr1);
    },
    //用户的设备center
    getDetectorInfoList(httpFunc, queryParams, title) {
      console.log(queryParams);
      return httpFunc(queryParams).then((res) => {
        // console.log("queryParams", res);
        if (res.code == 200) {
          this.detcetorList = res.rows;
          this.centerUserId = queryParams.userId;
          // 总数据
          this.centerTotal = res.total;
          // this.$refs.userCenter.fade = "fade";
          this.otherCenterShow = false;
          this.userCenterShow = true;
          this.centerTitle = title;
          // 传递回去
          return res.code;
        }
      });
    },
    // 调压箱,阀门,场站睇下的设备
    getTcqDevice(queryParams, title) {
      console.log(queryParams);
      return getTcqDevice(queryParams).then((res) => {
        // console.log("queryParams", res);
        console.log("resresresresreszzzzzzzzzzzzzzz", res);

        this.detcetorList = res;
        this.centerUserId = queryParams.devId;
        // 总数据
        this.centerTotal = res.length;
        // this.$refs.userCenter.fade = "fade";
        this.userCenterShow = false;

        this.otherCenterShow = true;
        this.centerTitle = title;
        // 传递回去
        return res.code;
      });
    },
    currentTime() {
      setInterval(() => {
        this.formatDate();
      }, 1000);
    },
    formatDate() {
      let date = new Date();
      let year = date.getFullYear(); // 年
      let month = date.getMonth() + 1; // 月
      let day = date.getDate(); // 日
      let week = date.getDay(); // 星期
      let weekArr = [
        "星期日",
        "星期一",
        "星期二",
        "星期三",
        "星期四",
        "星期五",
        "星期六",
      ];
      let hour = date.getHours(); // 时
      hour = hour < 10 ? "0" + hour : hour; // 如果只有一位,则前面补零
      let minute = date.getMinutes(); // 分
      minute = minute < 10 ? "0" + minute : minute; // 如果只有一位,则前面补零
      let second = date.getSeconds(); // 秒
      second = second < 10 ? "0" + second : second; // 如果只有一位,则前面补零
      this.nowtime = `${hour}:${minute}:${second}`;
      this.nowweek = `${weekArr[week]}`;
      this.nowDate = `${year}${month}${day}`;
    },
820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856
    // 地图绘制
    // drawMark() {
    //   this.map.mouseAddMarker();
    // },
    // drawPolyline() {
    //    this.map.mouseAddPipeline("Polyline");
    // },
    // drawCircle() {
    //   this.map.mouseAddCircle("Circle");
    // },
    // drawPolygon() {
    //   this.map.mouseAddPolygon("Polygon");
    // },
    // drawRule() {
    //   this.map.mouseAddRule();
    // },
    // drawMeasureArea() {
    //   this.map.mouseAddMeasureArea();
    // },
    // mouseToolDrawClear(){
    //   this.map.mousetoolClose(true);
    // },
    // editDraw(){
    //   this.map.editOverlays();
    // },
    // endEditDraw(){
    //   this.map.endEditOverlays();
    // },
    // delRadioLays(num){
    //   console.log("---"+num)
    // },
    // openDraw(){
    //   this.display="";
    // },
    // closeDraw(){
    //   this.display="display:none";
    // }
zhangjianqian's avatar
zhangjianqian committed
857
  },
858

zhangjianqian's avatar
zhangjianqian committed
859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909
};
</script>
<style lang="scss" scoped>
.home {
  position: relative;
  height: calc(100vh - 50px);
}
.goSystem {
  position: fixed;
  z-index: 9999;
  top: 50px;
  right: 20px;
  font-size: 14px;
  color: #18baff;
  cursor: pointer;
  padding: 3px 5px;
  border: 1px solid #339cc9;
  color: #339cc9;
  &:hover {
    background-color: #053b6a;
    color: #2cd5db;
  }
}
#map {
  position: absolute;
  top: 0px;
  bottom: 0;
  width: 100%;
}
.banner-test {
  width: 100%;
  height: 85px;
  position: relative;
  top: 0;
  z-index: 999;
}
.banner-test img {
  width: 100%;
  height: 100%;
}

.leftbar {
  width: 450px;
  height: 90%;
  position: fixed;
  top: 10%;
  left: 0;
  background: #112238;
}
.rightbar {
  width: 470px;
910
  height: 92%;
zhangjianqian's avatar
zhangjianqian committed
911 912 913
  position: fixed;
  top: 50px;
  right: 0;
914
  background: #ffffff;
zhangjianqian's avatar
zhangjianqian committed
915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029
}
.home-div {
  width: 50%;
  height: 70px;
  position: fixed;
  bottom: 0;
  margin-left: 20%;
  // z-index: 1000;
  img {
    width: 100%;
    height: 100%;
    position: absolute;
    z-index: -1;
  }
}
.event_div{
  position: fixed;
  margin-left: 20%;
  z-index:999;
  width: 100px;
  height: 50px;
  color: white;
  background: #053b6a;
  line-height: 50px;
  bottom: 50px;
  text-align: center;
  cursor:pointer;
}
.listingsSty {
  /* height: 25px; */
  // position: fixed;
  /* border: 1px solid #fff; */
  margin-left: 25%;
  width: 50%;
  display: flex;
  justify-content: space-between;
  padding-top: 25px;
  // font-family: 'arialbd';
}
.firsty {
  // width: 15%;
  min-width: 80px;
  height: 35px;
  text-align: center;
  line-height: 35px;
  /* border: 1px solid #fff; */
  color: #fff;
  font-size: 16px;
  // float: left;
  // margin-left: 8%;
  cursor: pointer;
  // font-family: 'arialbd';
}
.active {
  color: #2ee7e7;
  background: url(../../assets/mapinages/background.png);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  font-size: 18px;

  /*position:relative;*/
  /*&::after{
    width: 80px;
    height: 50px;
    z-index: -1;
    content: " ";
    position: absolute;
    top: -7px;
    left: 50%;
    margin-left:-40px;
    background: url(/img/bac1.0ec28f27.png);
    background-repeat: no-repeat;
    background-size: 100% 100%;
    background-position: center;
    color: aquamarine;
  }*/
}
.weather-icon {
  float: left;
  width: 30px !important;
  height: 30px !important;
  margin-top: 10px !important;
  margin-left: 10px !important;
  padding-right: 5px;
}
.tttt {
  background-image: -webkit-linear-gradient(
    bottom,
    rgb(134, 185, 233),
    #ffffff
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.typelist-div {
  width: 450px;
  height: 50px;
  z-index: 9999;
  position: fixed;
  top: 0;
  margin-top: 80px;
  right: 450px;
}
.typelist-div2{
  width: 150px;
  height: 50px;
  z-index: 9999;
  position: fixed;
  margin-top: 80px;
  margin-left: 10px;
}
.list {
  z-index: 9999;
  float: left;
  margin-left: 15px;
1030
  color: #000000;
zhangjianqian's avatar
zhangjianqian committed
1031
  line-height: auto;
1032 1033
  background: #ffffff;
  box-shadow: inset 0px 1px 2px 1px #ffffff;
zhangjianqian's avatar
zhangjianqian committed
1034 1035 1036 1037 1038 1039
  font-size: 14px;
  padding: 5px 7px;
  cursor: pointer;
}

.list.active {
1040 1041 1042
  background: #ffffff;
  box-shadow: inset 0px 1px 2px 1px #ffffff;
  color: #1890ff;
zhangjianqian's avatar
zhangjianqian committed
1043 1044
  font-size: 14px;
}
1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078
.mouseToolBtn {
  position: fixed;
  margin-left: 100px;
  z-index: 999;
  bottom: 50px;
}
.delTu{
  position: fixed;
  margin-left: 30%;
  margin-top: 300px;
  z-index: 999;
  height: 150px;
  width: 450px;
  background: #1c84c6;
}
.serBtn {
  background: #fff;
  width: 50px;
  height: 50px;
  text-align: center;
  outline: none;
  border-radius: 5px;
  border: none;
  cursor: pointer;
}
.toolBtn{
  background: white;
  width: 160px;
  position: fixed;
  margin-left: 100px;
  z-index: 999;
  bottom: 100px;
  height: 200px;
}
zhangjianqian's avatar
zhangjianqian committed
1079 1080 1081 1082 1083 1084 1085
.el-form-div{
  display:flex;
  flex-direction:row;
  justify-content:flex-start;
  justify-content:flex-start;
  width: 100%;
}
1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104
.detail-title{
  height: 30px;
  color: white;
  line-height: 30px;
  width: 130px;
  font-size: 15px;
  margin-left: 5px;
}
.tool-div{
  border: 1px solid #cccccc;
  width: 80%;
  margin-left: 10%;
  text-align: center;
  margin-top: 4px;
  font-size: 14px;
  height: 24px;
  line-height: 24px;
  cursor:pointer;
}
zhangjianqian's avatar
zhangjianqian committed
1105 1106 1107 1108
::v-deep .el-dialog:not(.is-fullscreen) {
  margin-top: 13vh !important;
}
</style>