添加模拟监听
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { $api } from '@/api/api';
|
import { $api } from '@/api/api';
|
||||||
import { useRainstormDeduction } from '@/hooks/rainstorm/useRainstormDeduction';
|
import { useRainstormDeduction } from '@/hooks/rainstorm/useRainstormDeduction';
|
||||||
|
import { useSimulationIdStore } from '@/stores/useSimulationIdStore';
|
||||||
import { useStatusStore } from '@/stores/useStatusStore';
|
import { useStatusStore } from '@/stores/useStatusStore';
|
||||||
import { useStepStore } from '@/stores/useStepStore';
|
import { useStepStore } from '@/stores/useStepStore';
|
||||||
import type { ApiResponse } from '@/types/ApiResponse';
|
import type { ApiResponse } from '@/types/ApiResponse';
|
||||||
@@ -19,6 +20,7 @@
|
|||||||
const { triggerLayerShowStatus, addGridLayer } = useRainstormDeduction();
|
const { triggerLayerShowStatus, addGridLayer } = useRainstormDeduction();
|
||||||
const statusStore = useStatusStore();
|
const statusStore = useStatusStore();
|
||||||
const stepStore = useStepStore();
|
const stepStore = useStepStore();
|
||||||
|
const simulationIdStore = useSimulationIdStore();
|
||||||
|
|
||||||
// 请求降雨栅格数据
|
// 请求降雨栅格数据
|
||||||
const requestRainfallData = () => {
|
const requestRainfallData = () => {
|
||||||
@@ -59,12 +61,13 @@
|
|||||||
.then((res) => {
|
.then((res) => {
|
||||||
// 进行预警
|
// 进行预警
|
||||||
CesiumUtilsSingleton.addPulseEffect(res.data.list);
|
CesiumUtilsSingleton.addPulseEffect(res.data.list);
|
||||||
|
// 设置事件id
|
||||||
|
simulationIdStore.setId(res.data.record_id);
|
||||||
|
|
||||||
// 推进到下一步
|
// 推进到下一步
|
||||||
stepStore.nextStep();
|
stepStore.nextStep();
|
||||||
|
|
||||||
// 产出报告
|
// 产出报告
|
||||||
|
|
||||||
console.log(res);
|
console.log(res);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -4,12 +4,15 @@ import config from '@/config/config.json';
|
|||||||
import { useLeftLegendStore } from '@/stores/useLeftLegendStore';
|
import { useLeftLegendStore } from '@/stores/useLeftLegendStore';
|
||||||
import { useScene } from '../useScene';
|
import { useScene } from '../useScene';
|
||||||
import { useRainstormDeduction } from '../rainstorm/useRainstormDeduction';
|
import { useRainstormDeduction } from '../rainstorm/useRainstormDeduction';
|
||||||
|
import { useSimulationIdStore } from '@/stores/useSimulationIdStore';
|
||||||
|
|
||||||
export const useRightHandle = () => {
|
export const useRightHandle = () => {
|
||||||
const statusStore = useStatusStore();
|
const statusStore = useStatusStore();
|
||||||
const leftLegendStore = useLeftLegendStore();
|
const leftLegendStore = useLeftLegendStore();
|
||||||
const scene = useScene();
|
const scene = useScene();
|
||||||
const rainstormDeduction = useRainstormDeduction();
|
const rainstormDeduction = useRainstormDeduction();
|
||||||
|
const simulationIdStore = useSimulationIdStore();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 暴雨模拟
|
* 暴雨模拟
|
||||||
* @param status - 状态
|
* @param status - 状态
|
||||||
@@ -28,6 +31,9 @@ export const useRightHandle = () => {
|
|||||||
|
|
||||||
// 如果有脉冲,显示脉冲
|
// 如果有脉冲,显示脉冲
|
||||||
CesiumUtilsSingleton.showPulseEffects();
|
CesiumUtilsSingleton.showPulseEffects();
|
||||||
|
|
||||||
|
// 模拟id状态为true
|
||||||
|
simulationIdStore.status = true;
|
||||||
} else {
|
} else {
|
||||||
// 关闭暴雨模拟:隐藏降雨栅格图层
|
// 关闭暴雨模拟:隐藏降雨栅格图层
|
||||||
statusStore.weatherLayers.showRainfallGrid.show = false;
|
statusStore.weatherLayers.showRainfallGrid.show = false;
|
||||||
@@ -40,6 +46,9 @@ export const useRightHandle = () => {
|
|||||||
|
|
||||||
// 隐藏脉冲
|
// 隐藏脉冲
|
||||||
CesiumUtilsSingleton.hidePulseEffects();
|
CesiumUtilsSingleton.hidePulseEffects();
|
||||||
|
|
||||||
|
// 模拟id状态为false
|
||||||
|
simulationIdStore.status = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import { defineStore } from 'pinia';
|
||||||
|
import { type Ref, ref } from 'vue';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模拟暴雨、地震灾害链id
|
||||||
|
*/
|
||||||
|
export const useSimulationIdStore = defineStore('simulationId', () => {
|
||||||
|
const status: Ref<boolean> = ref(false);
|
||||||
|
const id: Ref<number> = ref(-1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置模拟id
|
||||||
|
*/
|
||||||
|
const resetSimulationId = () => {
|
||||||
|
status.value = false;
|
||||||
|
id.value = -1;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置id
|
||||||
|
*/
|
||||||
|
const setId = (value: number) => {
|
||||||
|
status.value = true;
|
||||||
|
id.value = value;
|
||||||
|
};
|
||||||
|
|
||||||
|
return { id, status, resetSimulationId, setId };
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user