|
@@ -47,7 +47,7 @@
|
|
|
|
|
|
<script setup>
|
|
|
import eventBus from "@/api/eventBus";
|
|
|
-import { onMounted, ref } from "vue";
|
|
|
+import { nextTick, onMounted, ref } from "vue";
|
|
|
|
|
|
const alarmList = ref([
|
|
|
// { name: "低温冻害", id: 1 },
|
|
@@ -72,7 +72,9 @@ onMounted(() => {
|
|
|
}).then(({data}) => {
|
|
|
mapLayerList.value = data
|
|
|
eventBus.emit("alarmList:warningLayers", data)
|
|
|
- toggleAlarm(alarmList.value[0], 1)
|
|
|
+ setTimeout(() => {
|
|
|
+ toggleAlarm(alarmList.value[0], 1)
|
|
|
+ }, 500)
|
|
|
})
|
|
|
eventBus.on("warningHome:toggleArea", (id) => {
|
|
|
activeAlarm.value = null
|
|
@@ -83,7 +85,12 @@ const activeAlarm = ref(1);
|
|
|
const toggleAlarm = (item, type) => {
|
|
|
activeAlarm.value = item.id;
|
|
|
// eventBus.emit("alarmList:changeMapLayer", {name: item.name, url: mapLayerList.value[item.name]})
|
|
|
- eventBus.emit("alarmList:changeMapLayer", {url: mapLayerList.value[item.name], type, name: item.name})
|
|
|
+ if (type === 1) {
|
|
|
+ // 种植风险
|
|
|
+ eventBus.emit("chat:showMapLayer", {name: item.name, mapName: item.name, isHome: true})
|
|
|
+ } else {
|
|
|
+ eventBus.emit("alarmList:changeMapLayer", {url: mapLayerList.value[item.name], type, name: item.name})
|
|
|
+ }
|
|
|
};
|
|
|
</script>
|
|
|
|