Browse Source

摄像头图层隐藏过滤;火灾图层配置,报警联动效果测试

fan 4 months ago
parent
commit
b6903d12e4

+ 5 - 4
public/js/config.js

@@ -53,11 +53,11 @@ const MODULE_ENABLED = {
     /**
      * 围栏报警启用状态
      */
-    railAlarm: true,
+    railAlarm: false,
     /**
      * 区域报警启用状态
      */
-    areaAlarm: true,
+    areaAlarm: false,
     /**
      * 聚集报警
      */
@@ -133,6 +133,7 @@ const MQTT_CONFIG = {
     // 'Positioning/#',
     'Alarm/List',
     'Message/New',
+    'Fire/#',
     'Perimeter/#',
     'LaserPtz/#',
     'Risk/New',
@@ -142,8 +143,8 @@ const MQTT_CONFIG = {
 }
 //后台管理根路径
 const ISMSAdminWeb = {
-  path: "http://172.168.0.62:8080/#/",
-  // path: `http://192.168.195.136:8080/#/`,
+  // path: "http://172.168.0.62:8080/#/",
+  path: `http://192.168.195.136:8080/#/`,
   // path: `http://${window.location.hostname}:8080/#/`,
 }
 

+ 4 - 3
src/API/fire.js

@@ -1,13 +1,14 @@
 import $http from "@/utils/request";
 /**
- * 获取火灾配置
+ * 获取火灾点位配置
  */
 export const getTagList = (data) => {
   return $http({
     method: "POST",
-    url: "/fire/alarm/getTagList",
+    url: `/fire/config/getList`,
     data,
     notShowLoading: false,
+    headers: { "Content-Type": "application/json" }
   });
 };
 
@@ -15,7 +16,7 @@ export const getTagList = (data) => {
 export const getAlarmList = (data) =>
   $http({
     method: "POST",
-    url: `/fire/alarm/getAlarmList`,
+    url: `/fire/alarm/getList`,
     data,
     notShowLoading: true,
   });

+ 2 - 2
src/utils/index.js

@@ -43,8 +43,8 @@ export function _locate(xDist, yDist, c = { x: 108.4416707584088, y: 22.86248482
   // console.log(c, xDist, yDist);
   // console.log(c)
   const radius = 6378137 //坐标系球的半径  WGS84是6378137
-  let xOffset = -2700 //x偏移量 单位mm  -7400;// -2700 tkt  -700 duyun
-  let yOffset = 2000 //y偏移量 单位mm   1800;// 2000 tkt  1600 duyun
+  let xOffset = 0 //x偏移量 单位mm  -7400;// -2700 tkt  -700 duyun   tkt2  0
+  let yOffset = 1000 //y偏移量 单位mm   1800;// 2000 tkt  1600 duyun  tkt2 1000 
   //console.log("before", xDist, yDist)
   xDist = +xDist + xOffset
   yDist = +yDist + yOffset

+ 36 - 24
src/views/Home.vue

@@ -83,7 +83,7 @@ export default {
     SoundDialog,
     AlarmAudioDialog,
     RiskTipDialog,
-    BaseBlankDialog
+    BaseBlankDialog,
   },
   computed: {
     ...mapGetters([
@@ -199,7 +199,13 @@ export default {
     },
     startGlobalMqtt() {
       console.log(this.$refs);
-      const topics = ["Perimeter/#", "LaserPtz/#", "Message/New", "Alarm/List"];
+      const topics = [
+        "Fire/#",
+        "Perimeter/#",
+        "LaserPtz/#",
+        "Message/New",
+        "Alarm/List",
+      ];
       // const topics = ['Message/New']
       this.$store.dispatch("mqtt/subscribe", {
         // topic: ["dashboard/risk/newdata", "dashboard/risk/statistics", "dashboard/risk/list"],
@@ -234,28 +240,28 @@ export default {
             const data = JSON.parse(content);
             console.log("报警消息:", data);
             if (data[0]) {
-              setTimeout(() => {
-                this.$store.dispatch("globalConfig/setAlarmAudio", {
-                  show: true,
-                  // alarmType: "024001",
-                  alarmType: data[0].Level + "",
-                });
-                this.$store.dispatch("dialog/addRiskDialog", {
-                  dialogId: "risk_",
-                  show: true, //是否显示
-                  title: "警示详情",
-                  width: 500, //px宽度
-                  height: 320, //px高度
-                  center: true, //是否居中定位
-                  zIndex: 10,
-                  data: {
-                    id: data[0].Id,
-                    level: data[0].Level + "",
-                    riskTime: data[0].EventTime,
-                    content: data[0].Content,
-                  },
-                });
-              }, 200);
+              // setTimeout(() => {
+              //   this.$store.dispatch("globalConfig/setAlarmAudio", {
+              //     show: true,
+              //     // alarmType: "024001",
+              //     alarmType: data[0].Level + "",
+              //   });
+              //   this.$store.dispatch("dialog/addRiskDialog", {
+              //     dialogId: "risk_",
+              //     show: true, //是否显示
+              //     title: "警示详情",
+              //     width: 500, //px宽度
+              //     height: 320, //px高度
+              //     center: true, //是否居中定位
+              //     zIndex: 10,
+              //     data: {
+              //       id: data[0].Id,
+              //       level: data[0].Level + "",
+              //       riskTime: data[0].EventTime,
+              //       content: data[0].Content,
+              //     },
+              //   });
+              // }, 200);
             }
           } else if (topic.startsWith("Perimeter/")) {
             const data = JSON.parse(content);
@@ -263,6 +269,12 @@ export default {
             if (this.$refs.routerView.$options.name === "basePage") {
               this.$refs.routerView.pushPerimeterStatus(data);
             }
+          } else if (topic.startsWith("Fire/")) {
+            const data = JSON.parse(content);
+            console.log("火灾报警数据", data);
+            if (this.$refs.routerView.$options.name === "basePage") {
+              this.$refs.routerView.pushFireStatus(data);
+            }
           } else if (topic.startsWith("LaserPtz/")) {
             const data = JSON.parse(content);
             console.log("JGYT报警数据", data);

+ 47 - 2
src/views/basePage/components/dialog/AlarmMapDialog.vue

@@ -44,6 +44,35 @@
             </el-button>
           </div>
         </template>
+        <template v-if="alarmType === 'fire'">
+          <div class="warn-title">
+            {{ dialogConfig.dialogMsg.data.name }}
+          </div>
+          <div>
+            当前状态:<span
+              class="warn-type"
+              :style="{
+                color: perimeterAlarmTypeColor,
+              }"
+            >
+              {{ perimeterAlarmType }}
+            </span>
+          </div>
+          <div>
+            时间:<span class="warn-time">
+              {{
+                Dayjs(dialogConfig.dialogMsg.data.dateTime).format(
+                  "YYYY-MM-DD HH:mm:ss"
+                )
+              }}
+            </span>
+          </div>
+          <div class="perimeter-btn">
+            <el-button class="handle-btn" @click="handleCancelFireAlarm">
+              报警消除
+            </el-button>
+          </div>
+        </template>
         <template v-if="alarmType === 'jgyt'">
           <div class="warn-title">激光云台气体泄漏检测</div>
           <div>
@@ -220,7 +249,7 @@ export default {
   mounted() {
     this.alarmType === "perimeter" &&
       document.getElementById("mapAlarmAudio").play();
-    console.log(this.dialogConfig);
+    // console.log(this.dialogConfig);
   },
   methods: {
     Dayjs,
@@ -252,7 +281,10 @@ export default {
         this.handleCancelPerimeterAlarm();
         console.log("Perimeter");
       }
-      // console.log("20240327");
+      if (this.alarmType === "fire") {
+        this.handleCancelFireAlarm();
+        console.log("Fire");
+      }
     },
     handleChangeDefense() {
       this.dialogConfig.dialogMsg.data.defense =
@@ -271,6 +303,19 @@ export default {
         segmentId: this.dialogConfig.dialogMsg.data.segmentId,
       });
     },
+    handleCancelFireAlarm() {
+      console.log(this.dialogConfig.dialogMsg.data);
+      console.log(this.$parent.fireTagsData);
+      this.$emit("handleClose");
+      this.$parent.pushFireStatus({
+        alarmPoint: null,
+        alarmType: -1,
+        buildId: this.buildInfo.positioningBuildId,
+        camera: null,
+        floorNo: 2,
+        id: this.dialogConfig.dialogMsg.data.id,
+      });
+    },
     handleCancelJGYTAlarm() {
       this.$parent.pushJGYTStatus({
         alarmType: -1,

+ 1 - 1
src/views/basePage/components/monitorDialog/index.vue

@@ -243,7 +243,7 @@ export default {
           data: [
             // { category: '人员报警', name: '人员', num: 0, icon: 'people' },
             { category: "周界报警", name: "周界", num: 0, icon: "Perimeter" },
-            // { category: '火灾报警', name: '火灾', num: 0, icon: 'fire' },
+            // { category: "火灾报警", name: "火灾", num: 0, icon: "fire" },
             { category: "泄漏报警", name: "泄漏", num: 0, icon: "xielou" },
           ],
           tableConfig: [

+ 116 - 80
src/views/basePage/index.vue

@@ -8,7 +8,11 @@
       v-show="mapMode.value === '3d'"
     />
     <!-- 右侧监控窗口 -->
-    <monitor-dialog ref="monitor" @showPersonLayer="showPersonLayer" @openBuilding="openBuilding" />
+    <monitor-dialog
+      ref="monitor"
+      @showPersonLayer="showPersonLayer"
+      @openBuilding="openBuilding"
+    />
     <footer-navigation v-show="fullScreen" />
 
     <!-- 楼层控制 -->
@@ -34,7 +38,11 @@
     <!-- 人员窗口 -->
     <person-dialog ref="personInfo" @alarmTagClose="handleAlarmTagClose" />
     <!-- 一键报警窗口 -->
-    <one-key-alarm-dialog v-for="item in oneKeyAlarmDialogs" :key="item.dialogId" :dialogConfig="item" />
+    <one-key-alarm-dialog
+      v-for="item in oneKeyAlarmDialogs"
+      :key="item.dialogId"
+      :dialogConfig="item"
+    />
     <chemical-detail-dialog />
     <yuan-detail-dialog />
 
@@ -68,7 +76,11 @@
       />
     </template>
     <template v-for="(item, index) in alwaysShowDialogArr">
-      <tooltip-dialog :key="index" :id="'tooltip_' + item.dialogMsg.data.id" :dialogConfig="item" />
+      <tooltip-dialog
+        :key="index"
+        :id="'tooltip_' + item.dialogMsg.data.id"
+        :dialogConfig="item"
+      />
     </template>
     <model-view-toolbar-dialog v-show="false" />
 
@@ -97,7 +109,10 @@
     </template>
 
     <!-- 左侧面板 -->
-    <transition enter-active-class="animated fadeInLeft" leave-active-class="animated fadeOutLeft">
+    <transition
+      enter-active-class="animated fadeInLeft"
+      leave-active-class="animated fadeOutLeft"
+    >
       <div v-if="!fullScreen" class="panel_box left_panel">
         <overview />
         <risk-statistics />
@@ -105,7 +120,10 @@
       </div>
     </transition>
     <!-- 右侧面板 -->
-    <transition enter-active-class="animated fadeInRight" leave-active-class="animated fadeOutRight">
+    <transition
+      enter-active-class="animated fadeInRight"
+      leave-active-class="animated fadeOutRight"
+    >
       <div v-if="!fullScreen" class="panel_box right_panel">
         <!-- <weather /> -->
         <person-statistics />
@@ -113,7 +131,11 @@
       </div>
     </transition>
     <!-- 下侧面板 未使用 -->
-    <transition enter-active-class="animated fadeInDown" leave-active-class="animated fadeOutDown"> </transition>
+    <transition
+      enter-active-class="animated fadeInDown"
+      leave-active-class="animated fadeOutDown"
+    >
+    </transition>
     <!-- 站点选择 -->
     <!-- <station-select /> -->
     <!-- 蒙版 -->
@@ -131,16 +153,16 @@
 </template>
 
 <script>
-import LoadBuilding from './mixins/LoadBuilding'
-import LoadLayer from './mixins/LoadLayer'
-import MapEvent from './mixins/MapEvent'
-import MqttUtil from './mixins/MqttUtil'
-import LayerControl from '@/views/basePage/components/layerControl'
-import MonitorDialog from '@/views/basePage/components/monitorDialog'
-import FloorControl from '@/views/basePage/components/floorControl'
-import VideoImageWindow from '@/views/basePage/components/videoWindow/VideoImageWindow'
-import LayerDetail from '@/views/basePage/components/layerDetail'
-import GatherAlarmDialog from '@/views/components/dialog/GatherAlarmDialog'
+import LoadBuilding from "./mixins/LoadBuilding";
+import LoadLayer from "./mixins/LoadLayer";
+import MapEvent from "./mixins/MapEvent";
+import MqttUtil from "./mixins/MqttUtil";
+import LayerControl from "@/views/basePage/components/layerControl";
+import MonitorDialog from "@/views/basePage/components/monitorDialog";
+import FloorControl from "@/views/basePage/components/floorControl";
+import VideoImageWindow from "@/views/basePage/components/videoWindow/VideoImageWindow";
+import LayerDetail from "@/views/basePage/components/layerDetail";
+import GatherAlarmDialog from "@/views/components/dialog/GatherAlarmDialog";
 import {
   HistoryTrackDialog,
   HistoryPlayer,
@@ -154,24 +176,24 @@ import {
   OneKeyAlarmDialog,
   ModelViewToolbarDialog,
   AlarmMapDialog,
-} from './components/dialog/index'
-import Overview from './panels/Overview'
-import RiskStatistics from './panels/RiskStatistics'
-import RiskHint from './panels/RiskHint'
-import Weather from './panels/Weather'
-import PersonStatistics from './panels/PersonStatistics'
-import IntelligentVideo from './panels/IntelligentVideo/index'
-import StationSelect from './panels/StationSelect'
-import { mapGetters } from 'vuex'
-import { openDialog } from '@/utils/mapUtil'
-import LastPositionDialog from './components/dialog/LastPositionDialog.vue'
-import LastPositionPlayer from './components/dialog/LastPositionPlayer.vue'
-import StationAlarmDialog from './components/dialog/StationAlarmDialog.vue'
-import FooterNavigation from '../components/baseFooter/FooterNavigation.vue'
+} from "./components/dialog/index";
+import Overview from "./panels/Overview";
+import RiskStatistics from "./panels/RiskStatistics";
+import RiskHint from "./panels/RiskHint";
+import Weather from "./panels/Weather";
+import PersonStatistics from "./panels/PersonStatistics";
+import IntelligentVideo from "./panels/IntelligentVideo/index";
+import StationSelect from "./panels/StationSelect";
+import { mapGetters } from "vuex";
+import { openDialog } from "@/utils/mapUtil";
+import LastPositionDialog from "./components/dialog/LastPositionDialog.vue";
+import LastPositionPlayer from "./components/dialog/LastPositionPlayer.vue";
+import StationAlarmDialog from "./components/dialog/StationAlarmDialog.vue";
+import FooterNavigation from "../components/baseFooter/FooterNavigation.vue";
 
 // import ImageVideo from "./components/ImageVideo";
 export default {
-  name: 'basePage',
+  name: "basePage",
   data() {
     return {
       // 地图元素报警弹窗配置集合
@@ -182,7 +204,7 @@ export default {
       },
       alarmLiveData: [],
       fullScreen: false,
-    }
+    };
   },
   components: {
     LayerControl, // 左侧图层控制组件
@@ -219,67 +241,81 @@ export default {
   mixins: [LoadBuilding, LoadLayer, MapEvent, MqttUtil], //放入需要引用的模块
   computed: {
     ...mapGetters([
-      'alarmDataObj',
-      'videoDialogIds',
-      'oneKeyAlarmDialogs', //一键报警窗口的集合
-      'buildId',
-      'layerDetailDialog',
-      'mapMode',
-      'buildInfo',
+      "alarmDataObj",
+      "videoDialogIds",
+      "oneKeyAlarmDialogs", //一键报警窗口的集合
+      "buildId",
+      "layerDetailDialog",
+      "mapMode",
+      "buildInfo",
     ]),
   },
   watch: {
     alarmDataObj: {
       handler(newVal) {
+        console.log("报警对象信息", newVal);
         for (const key in newVal) {
-          if (['perimeter', 'jgyt'].includes(key)) {
+          if (["perimeter", "jgyt", "fire"].includes(key)) {
             // 当前显示的弹窗
-            let showIds = this.mapDialogConfig[key].map(item => item.dialogMsg.data.id)
-            newVal[key].forEach(val => {
+            let showIds = this.mapDialogConfig[key].map(
+              (item) => item.dialogMsg.data.id
+            );
+            newVal[key].forEach((val) => {
               //如果弹窗正在显示,则实时更新上面内容
               if (showIds.includes(val.id)) {
-                this.mapDialogConfig[key].forEach(data => {
+                this.mapDialogConfig[key].forEach((data) => {
                   if (val.id === data.dialogMsg.data.id) {
-                    this.$set(data.dialogMsg, 'data', val)
+                    this.$set(data.dialogMsg, "data", val);
                   }
-                })
+                });
               } else {
                 // 如果正在报警的点弹窗不显示,且没有被手动关闭过,自动打开
                 if (val.alarmState === 1 || val.alarmStatus === true) {
-                  let position = []
-                  if (key === 'jgyt') {
-                    position = [+val.longitude, +val.latitude, +val.height]
-                  } else if (key === 'perimeter') {
-                    position = [...val.alarmPosition, 4]
+                  let position = [];
+                  if (key === "jgyt") {
+                    position = [+val.longitude, +val.latitude, +val.height];
+                  } else if (key === "fire") {
+                    console.log(
+                      "火灾报警弹窗数据信息",
+                      this.mapDialogConfig[key]
+                    );
+                    position = val.alarmPosition;
+                  } else if (key === "perimeter") {
+                    console.log(
+                      "周界弹窗数据信息",
+                      this.mapDialogConfig[key]
+                    );
+                    position = [...val.alarmPosition, 4];
                     if (val.segmentName) {
-                      val.name = val.name + val.segmentName
+                      val.name = val.name + val.segmentName;
                     }
                   }
                   this.mapDialogConfig[key].push({
                     show: false,
                     dialogMsg: { data: val, position },
-                  })
+                  });
                   let p1 = 132,
-                    p2 = 236
-                  key === 'jgyt' && ((p1 = 200), (p2 = 210))
+                    p2 = 236;
+                  key === "jgyt" && ((p1 = 200), (p2 = 210));
+                  key === "fire" && ((p1 = 150), (p2 = 236));
                   for (let data of this.mapDialogConfig[key]) {
-                    ;(() => {
+                    (() => {
                       setTimeout(() => {
-                        data.show = true
-                        this.$store.dispatch('home/setMapPopupConfig', {
+                        data.show = true;
+                        this.$store.dispatch("home/setMapPopupConfig", {
                           isShow: true,
-                          type: 'point',
+                          type: "point",
                           position: data.dialogMsg.position,
-                          dialogid: key + '_' + data.dialogMsg.data.id,
+                          dialogid: key + "_" + data.dialogMsg.data.id,
                           p1,
                           p2,
-                        })
-                      }, 0)
-                    })()
+                        });
+                      }, 0);
+                    })();
                   }
                 }
               }
-            })
+            });
           }
         }
       },
@@ -287,7 +323,7 @@ export default {
     },
     mapMode: {
       handler(newValue) {
-        this.setMapMode(newValue)
+        this.setMapMode(newValue);
       },
       deep: true,
     },
@@ -296,22 +332,22 @@ export default {
     // console.log(this)
     // console.log(MAP_MODE_LIST)
     // console.log(this.mapMode)
-    this.setMapMode(this.mapMode)
+    this.setMapMode(this.mapMode);
   },
   beforeDestroy() {
-    this.$store.dispatch('globalConfig/clearSwitchConfig')
+    this.$store.dispatch("globalConfig/clearSwitchConfig");
   },
   methods: {
     openDialog,
     setMapMode(newValue) {
-      console.log(newValue.value)
-      const mode = MAP_MODE_LIST[newValue.value]
+      console.log(newValue.value);
+      const mode = MAP_MODE_LIST[newValue.value];
       if (!!mode) {
-        console.log('模式切换')
+        console.log("模式切换");
         //this.flyToPerspective(mode.perspective);
-        this.fullScreen = newValue.value === '3d'
+        this.fullScreen = newValue.value === "3d";
       } else {
-        console.log('模式不存在')
+        console.log("模式不存在");
       }
     },
 
@@ -319,9 +355,9 @@ export default {
      * 关闭地图元素点击的弹窗
      */
     closemapDialogConfig(key, index, item) {
-      const { perspective } = this.buildInfo
+      const { perspective } = this.buildInfo;
       if (!!perspective) {
-        this.flyToPerspective(perspective)
+        this.flyToPerspective(perspective);
       }
       // this.flyToPerspective({
       //   destination: {
@@ -335,15 +371,15 @@ export default {
       //     roll: 6.283183391886216,
       //   },
       // })
-      this.mapDialogConfig[key].splice(index, 1)
+      this.mapDialogConfig[key].splice(index, 1);
     },
     //弹窗内部点击事件后触发
     onPopupInnerAction() {
-      this.tooltipDialogArr = []
+      this.tooltipDialogArr = [];
     },
     pushAlarmList(list) {
-      this.alarmLiveData = list
-      this.$refs.monitor?.setAlarmData(list)
+      this.alarmLiveData = list;
+      this.$refs.monitor?.setAlarmData(list);
     },
     pushAlarmMessage(data) {
       if (!!data.NewMessage) {
@@ -351,12 +387,12 @@ export default {
           title: data.NewMessage.Type,
           message: data.NewMessage.Content,
           offset: 70,
-          type: 'warning',
-        })
+          type: "warning",
+        });
       }
     },
   },
-}
+};
 </script>
 <style lang="less" scoped>
 .basePage-container {

+ 2 - 2
src/views/basePage/mixins/LoadLayer/camera.js

@@ -53,7 +53,7 @@ export default {
         let p = { enable: true, buildId: this.buildInfo.positioningBuildId }
         let res = await getCameraList(p)
         // console.log('摄像头数据', res)
-        this.cameraTagsData = res.data.content || []
+        this.cameraTagsData = res.data.content.filter(e => !e.canHide) || []
         this.$store.dispatch('globalConfig/updateSwitchConfig', {
           type: this.cameraDataSourceName,
           label: '摄像头',
@@ -70,7 +70,7 @@ export default {
     addCameraTags() {
       let dataSource = addNewDatasource('layer_' + this.cameraDataSourceName)
       // console.log("摄像头基础信息", this.cameraTagsData);
-      this.cameraTagsData.filter(e => !e.canHide).forEach(d => {
+      this.cameraTagsData.forEach(d => {
         d.GPSPoints = this.transPosition([{ x: d.location.x, y: d.location.y, z: d.height }])
         dataSource.entities.add(
           new Entity({

+ 167 - 55
src/views/basePage/mixins/LoadLayer/fire.js

@@ -1,31 +1,64 @@
-import { Entity, Cartesian3, Color, PropertyBag, CallbackProperty } from "cesium";
-import { getTagList, getAlarmList } from "@/API/fire";
+import { Entity, NearFarScalar, PolylineDashMaterialProperty, DistanceDisplayCondition, Cartesian3, Color, PropertyBag } from "cesium";
+import { getTagList } from "@/API/fire";
 import { flyToByViewer, addNewDatasource } from "@/utils/mapUtil";
+import { _locate } from '@/utils'
 import { getViewer } from "@/store/map/mapService";
+import { mapGetters } from 'vuex'
 export default {
   data() {
     return {
       fireTagsData: [],
-      fireTagsShow: false,
       fireAlarmIds: [],
       cloneFireTagsData: [],
     };
   },
+  computed: {
+    ...mapGetters(['buildId', 'buildInfo', 'mapMode', 'switchConfig']),
+    fireTagsShow() {
+      return this.switchConfig.find(e => e?.type && e.type === 'fire')?.show
+    },
+  },
+  watch: {
+    buildId: {
+      handler(val) {
+        if (!val) return
+        setTimeout(() => {
+          // console.log('火灾图层建筑变化', val)
+          this.getFireTagsData()
+          // this.animationFire({})
+        }, 1000)
+      },
+      immediate: true,
+    },
+  },
   mounted() {
-    // setTimeout(() => {
-    //   this.getFireTagsData();
-    // }, 1100);
+    setTimeout(() => {
+      this.initFire()
+    }, 1000)
   },
   methods: {
+    initFire() {
+      this.$store.dispatch("globalConfig/pushSwitchConfig", {
+        type: "fire",
+        label: "火灾",
+        name: "火灾",
+        show: this.fireTagsShow,
+        selected: false,
+        elements: this.fireTagsData,
+      });
+    },
     async getFireTagsData() {
       try {
-        let res = await getTagList();
+        let p = { buildId: this.buildInfo.positioningBuildId }
+        // console.log('火灾数据获取参数:', p)
+        let res = await getTagList(p);
         this.fireTagsData = res.data.content || [];
-        this.$store.dispatch("globalConfig/pushSwitchConfig", {
+        // console.log("火灾信息", this.fireTagsData);
+        this.$store.dispatch("globalConfig/updateSwitchConfig", {
           type: "fire",
           label: "火灾",
           name: "火灾",
-          show: false,
+          show: this.fireTagsShow,
           selected: false,
           elements: this.fireTagsData,
         });
@@ -37,14 +70,30 @@ export default {
     addFireTags() {
       let dataSource = addNewDatasource("layer_fire");
       this.fireTagsData.forEach((data, index) => {
+        const gpsPoint = this.transPosition([{ x: data.location.x, y: data.location.y, z: data.height }])
         dataSource.entities.add(
           new Entity({
             id: data.id,
-            position: Cartesian3.fromDegrees(data.positionX, data.positionY, data.positionZ),
-            show: false,
-            point: {
-              pixelSize: 10,
-              color: Color.YELLOW,
+            position: Cartesian3.fromDegrees(...gpsPoint[0]),
+            show: this.fireTagsShow,
+            billboard: {
+              image: BASE_URL + data.iconPath,
+              scale: 0.5, //固定值
+              scaleByDistance: new NearFarScalar(10, 1, 10000, 1),
+            },
+            polyline: {
+              positions: Cartesian3.fromDegreesArrayHeights([
+                gpsPoint[0][0],
+                gpsPoint[0][1],
+                gpsPoint[0][2],
+                gpsPoint[0][0],
+                gpsPoint[0][1],
+                0,
+              ]),
+              width: 2,
+              material: new PolylineDashMaterialProperty({
+                color: Color.CYAN,
+              }),
             },
             properties: new PropertyBag({
               type: "layer_fire",
@@ -54,52 +103,115 @@ export default {
         );
       });
     },
-    changeFireTagsState() {
-      const viewer = getViewer();
-      const dataSource = viewer.dataSources.getByName("layer_fire");
+    async pushFireStatus(data) {
+      if (data.id) {
+        this.fireAlarmIds = [data.id]
+      } else {
+        data.id = this.fireAlarmIds.length ? this.fireAlarmIds[0] : ''
+      }
+      if (data.alarmType > 0) {
+        // console.log('火灾报警数据:', data)
+        //模型判断与切换
+        if (data?.buildId === this.buildInfo?.positioningBuildId) {
+          // console.log("聚焦报警");
+          this.animationFire(data)
+        } else {
+          const curStation = GY_STATIONS.find(e => e.positioningBuildId === data.buildId)
+          // console.log('报警站点信息:', curStation)
+          if (!curStation) return
+          this.$store.dispatch('globalConfig/setMapMode', {
+            value: '3d',
+          })
+          await this.$store.dispatch('model/setBuildInfoByBuildId', curStation.buildId)
+          setTimeout(() => {
+            this.animationFire(data)
+          }, 2000)
+        }
+      } else {
+        this.animationFire(data)
+      }
+    },
+    animationFire(data) {
+      const viewer = getViewer()
+      const dataSource = viewer.dataSources.getByName('layer_fire')
       if (dataSource.length > 0) {
-        const entities = dataSource[0].entities.values;
-        entities.forEach((item) => {
-          if (item.properties.type._value === "layer_fire") {
-            // 将实体内的值更换为变更后的值
-            const data = this.fireTagsData.find((d) => {
-              return item.properties.details._value.id === d.id;
-            });
-            item.properties.details._value = data;
-            // 如果发现报警
-            if (this.fireAlarmIds.includes(item.properties.details._value.id)) {
-              if (item.point.pixelSize._value != 20) {
-                // 点变大、变红、开始闪烁
-                let x = 1;
-                let flog = true;
-                let speed = 0.02;
-                item.point.pixelSize = 20;
-                item.point.color = new CallbackProperty(function () {
-                  if (flog) {
-                    x = x - speed;
-                    if (x <= 0.1) {
-                      flog = false;
-                    }
-                  } else {
-                    x = x + speed;
-                    if (x >= 0.9) {
-                      flog = true;
-                    }
-                  }
-                  return Color.fromCssColorString("#ff0000").withAlpha(x);
-                }, false);
-              }
-              item.show = true;
+        let item = dataSource[0].entities.getById(data.id)
+        console.log(item, "地图实体数据", item.properties.details._value, '接收参数', data);
+        if (!!item) {
+          const { longitude, latitude } = this.buildInfo.gpsCoordinate0
+          const gpsAlarmPoint = _locate(item.properties.details._value.location.x, item.properties.details._value.location.y, { x: longitude, y: latitude })
+          if (data.alarmType > 0) {
+            //报警点标记
+            if (data.alarmPoint) {
+              //地图元素
+              item.show = true
+              setTimeout(() => {
+                item.billboard = {
+                  image: BASE_URL + "/Resource/Portrait/2024/12/05/icon_HZ_sel@2x_2d5703e3.png",
+                  width: 50,
+                  height: 50,
+                  // verticalOrigin: VerticalOrigin.BOTTOM,
+                  distanceDisplayCondition: new DistanceDisplayCondition(0, 700.0),
+                }
+                item.position = Cartesian3.fromDegrees(gpsAlarmPoint.x, gpsAlarmPoint.y, item.properties.details._value.height)
+                //视角漂移
+                flyToByViewer(item)
+                //增加属性
+                item.properties.details._value.alarmPoint = data.alarmPoint
+                item.properties.details._value.alarmType = data.alarmType
+                item.properties.details._value.camera = data.camera
+                item.properties.details._value.alarmState = 1
+                item.properties.details._value.alarmStatus = true
+                item.properties.details._value.alarmPosition = [gpsAlarmPoint.x, gpsAlarmPoint.y, item.properties.details._value.height]
+                // console.log(item.properties.details._value, "66666666666666666666666666666");
+                //数据
+                this.$store.dispatch('globalConfig/updateAlarmDataObj', {
+                  fire: [item.properties.details._value],
+                })
+                //视频弹窗
+                if (!!data?.camera?.id) {
+                  this.$store.dispatch('dialog/openVideoDialog', data.camera.id)
+                }
+              }, 1000)
             } else {
-              item.show = this.fireTagsShow;
-              if (this.fireTagsShow) {
-                item.point.pixelSize = 10;
-                item.point.color = Color.YELLOW;
-              }
+              item.show = true
+              setTimeout(() => {
+                item.billboard = {
+                  image: BASE_URL + item.properties.details._value.iconPath,
+                  width: 50,
+                  height: 50,
+                  distanceDisplayCondition: new DistanceDisplayCondition(0, 700.0),
+                }
+                item.position = Cartesian3.fromDegrees(gpsAlarmPoint.x, gpsAlarmPoint.y, item.properties.details._value.height)
+              }, 200)
             }
+          } else {
+            // this.$store.dispatch('globalConfig/updateAlarmDataObj', {
+            //   fire: this.fireTagsData,
+            // })
+            item.show = true
+            setTimeout(() => {
+              item.billboard = {
+                image: BASE_URL + item.properties.details._value.iconPath,
+                width: 50,
+                height: 50,
+                distanceDisplayCondition: new DistanceDisplayCondition(0, 700.0),
+              }
+              item.position = Cartesian3.fromDegrees(gpsAlarmPoint.x, gpsAlarmPoint.y, item.properties.details._value.height)
+            }, 200)
+            // console.log('c测试', gpsAlarmPoint, item);
+
           }
-        });
+        }
       }
     },
+    transPosition(pointList = []) {
+      const { longitude, latitude } = this.buildInfo.gpsCoordinate0
+      return pointList.reduce((pre, cur) => {
+        const { x, y } = _locate(cur.x, cur.y, { x: longitude, y: latitude })
+        pre.push([x, y, +cur.z])
+        return pre
+      }, [])
+    },
   },
 };

+ 1 - 1
src/views/basePage/mixins/LoadLayer/index.js

@@ -5,7 +5,7 @@ import JGYT from './JGYT' //激光云台/泄漏
 import perimeter from './perimeter' //周界
 import camera from './camera' //摄像头
 import fire from './fire' //火灾
-import risk from './risk' //火灾
+import risk from './risk' //风险
 
 export default {
   mixins: [Person, Rail, AreaAlarm, JGYT, perimeter, camera, fire, risk],

+ 4 - 9
src/views/basePage/mixins/MapEvent.js

@@ -436,7 +436,6 @@ export default {
                 })()
               }
             }
-
             if (type === 'layer_fire') {
               if (this.mapDialogConfig.fire.some(item => item.dialogMsg?.data?.id == data.id)) {
                 this.mapDialogConfig.fire = this.mapDialogConfig.fire.filter(
@@ -445,7 +444,7 @@ export default {
               }
               this.mapDialogConfig.fire.push({
                 show: false,
-                dialogMsg: { data },
+                dialogMsg: { data, position: [longitude, latitude, height] },
               })
               for (let d of this.mapDialogConfig.fire) {
                 ; (() => {
@@ -455,14 +454,10 @@ export default {
                     this.$store.dispatch('home/setMapPopupConfig', {
                       isShow: true,
                       type: 'point',
-                      position: [
-                        +d.dialogMsg?.data?.positionX,
-                        +d.dialogMsg?.data?.positionY,
-                        +d.dialogMsg?.data?.positionZ,
-                      ],
+                      position: d.dialogMsg?.data?.alarmPosition,
                       dialogid: 'fire_' + d.dialogMsg?.data?.id,
-                      p1: 202,
-                      p2: d.dialogMsg?.data?.alarmState === 1 ? 240 : 210,
+                      p1: 150,
+                      p2: 236,
                     })
                   }, 0)
                 })()