|
|
@@ -1,67 +1,73 @@
|
|
|
-import Bus from "@/utils/bus";
|
|
|
-import bus from "@/utils/bus";
|
|
|
-import {useAppStore} from '@/stores/app'
|
|
|
-import {useTimeScrollbarStore} from '@/stores/timeScrollbar'
|
|
|
-import {useStationStore} from "@/stores/station";
|
|
|
-import {extractList} from "../list";
|
|
|
-import {stationList} from "@/assets/js/station";
|
|
|
-import {slopeCalculation} from "@/utils/slopeCalculation";
|
|
|
-import {getYuyanDataList} from "@/api/yuyan";
|
|
|
-import {convertDate} from "@/utils/date";
|
|
|
-import {useTyphoonStore} from "@/stores/typhoon";
|
|
|
-import {getRainfallForecastRadarMap, getRainfallForecastRadarMapList} from "@/api/typhoon";
|
|
|
-import {Layer} from "@/utils/tdInstruction/index";
|
|
|
-import {formatd} from "@/utils/ruoyi";
|
|
|
-
|
|
|
-let waterLevel = "";
|
|
|
-let waterSpeed = "";
|
|
|
+import Bus from '@/utils/bus'
|
|
|
+import bus from '@/utils/bus'
|
|
|
+import { useAppStore } from '@/stores/app'
|
|
|
+import { useTimeScrollbarStore } from '@/stores/timeScrollbar'
|
|
|
+import { useStationStore } from '@/stores/station'
|
|
|
+import { extractList } from '../list'
|
|
|
+import { stationList } from '@/assets/js/station'
|
|
|
+import { slopeCalculation } from '@/utils/slopeCalculation'
|
|
|
+import { getYuyanDataList } from '@/api/yuyan'
|
|
|
+import { convertDate } from '@/utils/date'
|
|
|
+import { useTyphoonStore } from '@/stores/typhoon'
|
|
|
+import {
|
|
|
+ getRainfallForecastRadarMap,
|
|
|
+ getRainfallForecastRadarMapList,
|
|
|
+} from '@/api/typhoon'
|
|
|
+import { Layer } from '@/utils/tdInstruction/index'
|
|
|
+import { formatd } from '@/utils/ruoyi'
|
|
|
+
|
|
|
+let waterLevel = ''
|
|
|
+let waterSpeed = ''
|
|
|
|
|
|
/**
|
|
|
* 设置测站水位
|
|
|
* @param stcd 测站编码
|
|
|
* @param value 水位
|
|
|
*/
|
|
|
-export async function setWaterLevel(stcd: any, value: any = waterLevel, speed: any = waterSpeed) {
|
|
|
+export async function setWaterLevel(
|
|
|
+ stcd: any,
|
|
|
+ value: any = waterLevel,
|
|
|
+ speed: any = waterSpeed,
|
|
|
+) {
|
|
|
if (value) {
|
|
|
- waterLevel = value + ""
|
|
|
+ waterLevel = value + ''
|
|
|
} else {
|
|
|
if (!waterLevel) {
|
|
|
const store = useStationStore()
|
|
|
store.setStcd(stcd)
|
|
|
- waterLevel = await store.getZ() + ''
|
|
|
+ waterLevel = (await store.getZ()) + ''
|
|
|
}
|
|
|
}
|
|
|
if (speed) {
|
|
|
- waterSpeed = speed + ""
|
|
|
+ waterSpeed = speed + ''
|
|
|
}
|
|
|
let descriptor = {
|
|
|
- "command": "WaterLevel",
|
|
|
- "data": {
|
|
|
- "ID": stcd,
|
|
|
- "code": waterLevel,
|
|
|
- "wave": waterSpeed
|
|
|
- }
|
|
|
+ command: 'WaterLevel',
|
|
|
+ data: {
|
|
|
+ ID: stcd,
|
|
|
+ code: waterLevel,
|
|
|
+ wave: waterSpeed,
|
|
|
+ },
|
|
|
}
|
|
|
Bus.emit('emitUIInteraction', descriptor)
|
|
|
- console.log("-- 设置测站水位,流速", JSON.stringify(descriptor));
|
|
|
+ console.log('-- 设置测站水位,流速', JSON.stringify(descriptor))
|
|
|
}
|
|
|
|
|
|
-
|
|
|
export async function setUnderwaterState(stcd: any, show = true) {
|
|
|
- let value = "-5"
|
|
|
+ let value = '-5'
|
|
|
if (!show) {
|
|
|
const store = useStationStore()
|
|
|
- value = waterLevel ? waterLevel : await store.getZ() + ''
|
|
|
+ value = waterLevel ? waterLevel : (await store.getZ()) + ''
|
|
|
}
|
|
|
let descriptor = {
|
|
|
- "command": "WaterLevel",
|
|
|
- "data": {
|
|
|
- "ID": stcd,
|
|
|
- "code": value,
|
|
|
- }
|
|
|
+ command: 'WaterLevel',
|
|
|
+ data: {
|
|
|
+ ID: stcd,
|
|
|
+ code: value,
|
|
|
+ },
|
|
|
}
|
|
|
Bus.emit('emitUIInteraction', descriptor)
|
|
|
- console.log("-- 水下地形:", JSON.stringify(descriptor));
|
|
|
+ console.log('-- 水下地形:', JSON.stringify(descriptor))
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -71,14 +77,14 @@ export async function setUnderwaterState(stcd: any, show = true) {
|
|
|
*/
|
|
|
export function setWaterSpeed(stcd: any, speed: any = waterSpeed) {
|
|
|
let descriptor = {
|
|
|
- "command": "WaterLevel",
|
|
|
- "data": {
|
|
|
- "ID": stcd,
|
|
|
- "speed": speed
|
|
|
- }
|
|
|
+ command: 'WaterLevel',
|
|
|
+ data: {
|
|
|
+ ID: stcd,
|
|
|
+ speed: speed,
|
|
|
+ },
|
|
|
}
|
|
|
Bus.emit('emitUIInteraction', descriptor)
|
|
|
- console.log("-- 设置测站流速", JSON.stringify(descriptor));
|
|
|
+ console.log('-- 设置测站流速', JSON.stringify(descriptor))
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -88,14 +94,14 @@ export function setWaterSpeed(stcd: any, speed: any = waterSpeed) {
|
|
|
*/
|
|
|
export function testSimulation(stcd: any, type: any = '播放') {
|
|
|
let descriptor = {
|
|
|
- "command": "InstrumentMovie",
|
|
|
- "data": {
|
|
|
- "Type": type,
|
|
|
- "ID": stcd
|
|
|
- }
|
|
|
+ command: 'InstrumentMovie',
|
|
|
+ data: {
|
|
|
+ Type: type,
|
|
|
+ ID: stcd,
|
|
|
+ },
|
|
|
}
|
|
|
Bus.emit('emitUIInteraction', descriptor)
|
|
|
- console.log("-- 测验模拟:" + type, JSON.stringify(descriptor));
|
|
|
+ console.log('-- 测验模拟:' + type, JSON.stringify(descriptor))
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -105,14 +111,14 @@ export function testSimulation(stcd: any, type: any = '播放') {
|
|
|
*/
|
|
|
export function flowComparative(stcd: any, type: any = '播放') {
|
|
|
let descriptor = {
|
|
|
- "command": "ADCPship",
|
|
|
- "data": {
|
|
|
- "Type": type,
|
|
|
- "ID": stcd
|
|
|
- }
|
|
|
+ command: 'ADCPship',
|
|
|
+ data: {
|
|
|
+ Type: type,
|
|
|
+ ID: stcd,
|
|
|
+ },
|
|
|
}
|
|
|
Bus.emit('emitUIInteraction', descriptor)
|
|
|
- console.log("-- 流量比对:" + type, JSON.stringify(descriptor));
|
|
|
+ console.log('-- 流量比对:' + type, JSON.stringify(descriptor))
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -122,61 +128,67 @@ export function flowComparative(stcd: any, type: any = '播放') {
|
|
|
*/
|
|
|
export function roam(type: any = 'river', operate: any = 'play') {
|
|
|
let descriptor = {
|
|
|
- "command": "Roaming",
|
|
|
- "data": {
|
|
|
- "tag": type === 'river' ? "太师桥远" : "太师桥近",
|
|
|
- "Type": operate
|
|
|
- }
|
|
|
+ command: 'Roaming',
|
|
|
+ data: {
|
|
|
+ tag: type === 'river' ? '太师桥远' : '太师桥近',
|
|
|
+ Type: operate,
|
|
|
+ },
|
|
|
}
|
|
|
Bus.emit('emitUIInteraction', descriptor)
|
|
|
- console.log("-- 漫游:" + (type === 'river' ? "河道" : "测站"), JSON.stringify(descriptor));
|
|
|
+ console.log(
|
|
|
+ '-- 漫游:' + (type === 'river' ? '河道' : '测站'),
|
|
|
+ JSON.stringify(descriptor),
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
export function setPointState(stcd: any, name: string, type: string) {
|
|
|
let descriptor = {
|
|
|
- "command": "POIwarning",
|
|
|
- "data": {
|
|
|
- "ID": stcd,
|
|
|
- "Name": name,
|
|
|
- "type": type
|
|
|
- }
|
|
|
+ command: 'POIwarning',
|
|
|
+ data: {
|
|
|
+ ID: stcd,
|
|
|
+ Name: name,
|
|
|
+ type: type,
|
|
|
+ },
|
|
|
}
|
|
|
- Bus.emit('emitUIInteraction', descriptor);
|
|
|
- console.log("-- 设置设备告警:", JSON.stringify(descriptor));
|
|
|
+ Bus.emit('emitUIInteraction', descriptor)
|
|
|
+ console.log('-- 设置设备告警:', JSON.stringify(descriptor))
|
|
|
}
|
|
|
|
|
|
export async function addTyphoonTrack(tfid: string) {
|
|
|
const typhoonStore = useTyphoonStore()
|
|
|
- let yuyanData: any[] = await getYuyanDataList("2025041714054696095")
|
|
|
- .then(res => {
|
|
|
+ let yuyanData: any[] = await getYuyanDataList('2025041714054696095').then(
|
|
|
+ res => {
|
|
|
return res.data.map(item => {
|
|
|
return {
|
|
|
...item,
|
|
|
- YMDHM: convertDate(item.YMDHM)
|
|
|
+ YMDHM: convertDate(item.YMDHM),
|
|
|
}
|
|
|
})
|
|
|
- })
|
|
|
+ },
|
|
|
+ )
|
|
|
|
|
|
const appStore = useAppStore()
|
|
|
const timeScrollbarStore = useTimeScrollbarStore()
|
|
|
- appStore.changeCurrentView("Globe")
|
|
|
+ appStore.changeCurrentView('Globe')
|
|
|
|
|
|
// 获取台风数据
|
|
|
- const typhoonData = await import(`@/assets/json/typhoon/${tfid}.json`).then(res => res.default);
|
|
|
+ const typhoonData = await import(`@/assets/json/typhoon/${tfid}.json`).then(
|
|
|
+ res => res.default,
|
|
|
+ )
|
|
|
typhoonData.points.length
|
|
|
|
|
|
timeScrollbarStore.setTimeScrollbarShow(true)
|
|
|
timeScrollbarStore.setMax(typhoonData.points.length)
|
|
|
|
|
|
- const timeList = typhoonData.points.map((element: any) => element.time);
|
|
|
+ const timeList = typhoonData.points.map((element: any) => element.time)
|
|
|
const timeObj = extractList(timeList, 4)
|
|
|
for (let key in timeObj) {
|
|
|
timeObj[key] = {
|
|
|
style: {
|
|
|
color: '#00c7e3',
|
|
|
- 'text-shadow': '0 0 4px #32003C'
|
|
|
+ 'text-shadow': '0 0 4px #32003C',
|
|
|
},
|
|
|
- label: timeObj[key].substring(0, 10) + '\n' + timeObj[key].substring(11)
|
|
|
+ label: timeObj[key].substring(0, 10) + '\n' + timeObj[key].substring(11),
|
|
|
}
|
|
|
}
|
|
|
timeScrollbarStore.setMarks(timeObj)
|
|
|
@@ -199,21 +211,24 @@ export async function addTyphoonTrack(tfid: string) {
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
- value: `${(d.DATA).toFixed(2)}`,
|
|
|
+ value: `${d.DATA.toFixed(2)}`,
|
|
|
name: station.name,
|
|
|
x: station.lgtd,
|
|
|
- y: station.lttd
|
|
|
+ y: station.lttd,
|
|
|
}
|
|
|
})
|
|
|
|
|
|
if (data && data.length > 0) {
|
|
|
- const res: any = slopeCalculation(data);
|
|
|
- taihuUI(res.direction, res.slope, res.max, res.min);
|
|
|
+ const res: any = slopeCalculation(data)
|
|
|
+ taihuUI(res.direction, res.slope, res.max, res.min)
|
|
|
}
|
|
|
|
|
|
if (timeList[value].substring(0, 10) != time) {
|
|
|
time = timeList[value].substring(0, 10)
|
|
|
- bus.emit('chat', `汇报当前时间 ${time} 台风情况,太湖局应该如何响应,回复内容简单明了,条理清晰,通俗易懂,字数限制200字。如果没有信息就返回null。 台风信息如下:${JSON.stringify(typhoonData.points[value])}`)
|
|
|
+ bus.emit(
|
|
|
+ 'chat',
|
|
|
+ `汇报当前时间 ${time} 台风情况,太湖局应该如何响应,回复内容简单明了,条理清晰,通俗易懂,字数限制200字。如果没有信息就返回null。 台风信息如下:${JSON.stringify(typhoonData.points[value])}`,
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
setTyphoonTrack(tfid, timeList[value])
|
|
|
@@ -221,30 +236,29 @@ export async function addTyphoonTrack(tfid: string) {
|
|
|
}
|
|
|
|
|
|
let descriptor = {
|
|
|
- "command": "AddTyphoonTrack",
|
|
|
- "data": {
|
|
|
- "tfid": tfid
|
|
|
- }
|
|
|
+ command: 'AddTyphoonTrack',
|
|
|
+ data: {
|
|
|
+ tfid: tfid,
|
|
|
+ },
|
|
|
}
|
|
|
- Bus.emit('emitUIInteraction', descriptor);
|
|
|
- console.log("-- 台风路径:", JSON.stringify(descriptor));
|
|
|
+ Bus.emit('emitUIInteraction', descriptor)
|
|
|
+ console.log('-- 台风路径:', JSON.stringify(descriptor))
|
|
|
|
|
|
timeScrollbarStore.play()
|
|
|
|
|
|
typhoonStore.setTyphoon(true)
|
|
|
}
|
|
|
|
|
|
-
|
|
|
export function setTyphoonTrack(tfid: string, time: string) {
|
|
|
let descriptor = {
|
|
|
- "command": "TyphoonTime",
|
|
|
- "data": {
|
|
|
- "tfid": tfid,
|
|
|
- "time": time
|
|
|
- }
|
|
|
+ command: 'TyphoonTime',
|
|
|
+ data: {
|
|
|
+ tfid: tfid,
|
|
|
+ time: time,
|
|
|
+ },
|
|
|
}
|
|
|
- Bus.emit('emitUIInteraction', descriptor);
|
|
|
- console.log("-- 设置台风时间点:", JSON.stringify(descriptor));
|
|
|
+ Bus.emit('emitUIInteraction', descriptor)
|
|
|
+ console.log('-- 设置台风时间点:', JSON.stringify(descriptor))
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -255,17 +269,17 @@ export function deleteTyphoonTrack(tfid: string) {
|
|
|
const timeScrollbarStore = useTimeScrollbarStore()
|
|
|
timeScrollbarStore.close()
|
|
|
let descriptor = {
|
|
|
- "command": "DelLevel",
|
|
|
- "data": {
|
|
|
- "tfid": 'TyphoonTrack',
|
|
|
+ command: 'DelLevel',
|
|
|
+ data: {
|
|
|
+ tfid: 'TyphoonTrack',
|
|
|
// "tfid": tfid,
|
|
|
- "type": "3"
|
|
|
- }
|
|
|
+ type: '3',
|
|
|
+ },
|
|
|
}
|
|
|
- Bus.emit('emitUIInteraction', descriptor);
|
|
|
- console.log("-- 删除台风路径:", JSON.stringify(descriptor));
|
|
|
+ Bus.emit('emitUIInteraction', descriptor)
|
|
|
+ console.log('-- 删除台风路径:', JSON.stringify(descriptor))
|
|
|
|
|
|
- taihuUI('', '', '', '', false);
|
|
|
+ taihuUI('', '', '', '', false)
|
|
|
const store = useTyphoonStore()
|
|
|
store.setTyphoon(false)
|
|
|
}
|
|
|
@@ -275,34 +289,33 @@ export function deleteTyphoonTrack(tfid: string) {
|
|
|
*/
|
|
|
export function realTimeTyphoon(show = true) {
|
|
|
let descriptor = {
|
|
|
- "command": "RuntimeTyphoon",
|
|
|
- "data": {
|
|
|
- "Display": show ? "true" : "false"
|
|
|
- }
|
|
|
+ command: 'RuntimeTyphoon',
|
|
|
+ data: {
|
|
|
+ Display: show ? 'true' : 'false',
|
|
|
+ },
|
|
|
}
|
|
|
- Bus.emit('emitUIInteraction', descriptor);
|
|
|
- console.log("-- 实时台风:", JSON.stringify(descriptor));
|
|
|
+ Bus.emit('emitUIInteraction', descriptor)
|
|
|
+ console.log('-- 实时台风:', JSON.stringify(descriptor))
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 设置站点基础数据
|
|
|
* @param data
|
|
|
*/
|
|
|
export function setStationData(data: any) {
|
|
|
let descriptor = {
|
|
|
- "command": "SetScene",
|
|
|
- "data": {
|
|
|
- "id": data.name,
|
|
|
- "堤顶高程": data.damel,
|
|
|
- "保证水位": data.grz,
|
|
|
- "青坎线": data.qingkang,
|
|
|
- "警戒水位": data.wrz,
|
|
|
- "当前水位": data.z,
|
|
|
- }
|
|
|
+ command: 'SetScene',
|
|
|
+ data: {
|
|
|
+ id: data.name,
|
|
|
+ 堤顶高程: data.damel,
|
|
|
+ 保证水位: data.grz,
|
|
|
+ 青坎线: data.qingkang,
|
|
|
+ 警戒水位: data.wrz,
|
|
|
+ 当前水位: data.z,
|
|
|
+ },
|
|
|
}
|
|
|
- Bus.emit('emitUIInteraction', descriptor);
|
|
|
- console.log("-- 设置站点基础数据:", JSON.stringify(descriptor));
|
|
|
+ Bus.emit('emitUIInteraction', descriptor)
|
|
|
+ console.log('-- 设置站点基础数据:', JSON.stringify(descriptor))
|
|
|
}
|
|
|
|
|
|
let strategyMapState = false
|
|
|
@@ -315,36 +328,44 @@ let strategyMapState = false
|
|
|
*/
|
|
|
export function strategyMap(direction: string, slope: string, show = true) {
|
|
|
let descriptor = {
|
|
|
- "command": "InclinedAngle",
|
|
|
- "data": {
|
|
|
- "Direction": direction,
|
|
|
- "Slope": slope,
|
|
|
- "Display": show ? 'true' : 'false'
|
|
|
- }
|
|
|
+ command: 'InclinedAngle',
|
|
|
+ data: {
|
|
|
+ Direction: direction,
|
|
|
+ Slope: slope,
|
|
|
+ Display: show ? 'true' : 'false',
|
|
|
+ },
|
|
|
}
|
|
|
- Bus.emit('emitUIInteraction', descriptor);
|
|
|
- console.log("-- 太湖湖面图层:", JSON.stringify(descriptor));
|
|
|
+ Bus.emit('emitUIInteraction', descriptor)
|
|
|
+ console.log('-- 太湖湖面图层:', JSON.stringify(descriptor))
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-export function taihuUI(direction: string, slope: string, max: string, min: string, show = true) {
|
|
|
+export function taihuUI(
|
|
|
+ direction: string,
|
|
|
+ slope: string,
|
|
|
+ max: string,
|
|
|
+ min: string,
|
|
|
+ show = true,
|
|
|
+) {
|
|
|
let descriptor = {
|
|
|
- "command": "TaihuUI",
|
|
|
- "data": {
|
|
|
- "Direction": direction,
|
|
|
- "Slope": slope,
|
|
|
- "Max": max,
|
|
|
- "Min": min,
|
|
|
- "Display": show ? "true" : "false"
|
|
|
- }
|
|
|
+ command: 'TaihuUI',
|
|
|
+ data: {
|
|
|
+ Direction: direction,
|
|
|
+ Slope: slope,
|
|
|
+ Max: max,
|
|
|
+ Min: min,
|
|
|
+ Display: show ? 'true' : 'false',
|
|
|
+ },
|
|
|
}
|
|
|
- Bus.emit('emitUIInteraction', descriptor);
|
|
|
- console.log("-- 台风太湖UI:", JSON.stringify(descriptor));
|
|
|
+ Bus.emit('emitUIInteraction', descriptor)
|
|
|
+ console.log('-- 台风太湖UI:', JSON.stringify(descriptor))
|
|
|
}
|
|
|
|
|
|
export async function addRadar(type: any) {
|
|
|
- let radarList: any = await getRainfallForecastRadarMapList(formatd(new Date(), 'yyyy-MM-dd'), formatd(new Date(), 'yyyy-MM-dd'), type)
|
|
|
- .then(res => res)
|
|
|
+ let radarList: any = await getRainfallForecastRadarMapList(
|
|
|
+ formatd(new Date(), 'yyyy-MM-dd'),
|
|
|
+ formatd(new Date(), 'yyyy-MM-dd'),
|
|
|
+ type,
|
|
|
+ ).then(res => res)
|
|
|
|
|
|
const appStore = useAppStore()
|
|
|
const timeScrollbarStore = useTimeScrollbarStore()
|
|
|
@@ -354,15 +375,15 @@ export async function addRadar(type: any) {
|
|
|
timeScrollbarStore.setMax(radarList.length)
|
|
|
timeScrollbarStore.setStep(3)
|
|
|
|
|
|
- const timeList = radarList.map((element: any) => element.TBA_GETDATE);
|
|
|
+ const timeList = radarList.map((element: any) => element.TBA_GETDATE)
|
|
|
const timeObj = extractList(timeList, 4)
|
|
|
for (let key in timeObj) {
|
|
|
timeObj[key] = {
|
|
|
style: {
|
|
|
color: '#00c7e3',
|
|
|
- 'text-shadow': '0 0 4px #32003C'
|
|
|
+ 'text-shadow': '0 0 4px #32003C',
|
|
|
},
|
|
|
- label: timeObj[key].substring(0, 10) + '\n' + timeObj[key].substring(11)
|
|
|
+ label: timeObj[key].substring(0, 10) + '\n' + timeObj[key].substring(11),
|
|
|
}
|
|
|
}
|
|
|
timeScrollbarStore.setMarks(timeObj)
|
|
|
@@ -373,13 +394,11 @@ export async function addRadar(type: any) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 删除台风路径
|
|
|
*/
|
|
|
export function deleteRadar() {
|
|
|
const timeScrollbarStore = useTimeScrollbarStore()
|
|
|
timeScrollbarStore.close()
|
|
|
- Layer.radarMap("", false)
|
|
|
+ Layer.radarMap('', false)
|
|
|
}
|
|
|
-
|