| | |
| | | }); |
| | | console.log("getRainfallData:", response); |
| | | return response.data; |
| | | } |
| | | |
| | | // 查询雨量计读数 |
| | | export async function getYLJData(data) { |
| | | // 获取当前时间 |
| | | const now = new Date(); |
| | | |
| | | // 计算一小时前的时间 |
| | | const oneHourAgo = new Date(now.getTime() - 2 * 60 * 60 * 1000); |
| | | |
| | | // 格式化时间为YYYY-MM-DD HH:mm:ss |
| | | const formatTime = (date) => { |
| | | const pad = (num) => num.toString().padStart(2, '0'); |
| | | return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`; |
| | | }; |
| | | |
| | | const response = await axios.post("/hp/ylclyPacket/getData", { |
| | | "currentPage": 1, |
| | | "pageSize": 20, |
| | | "filterObject": { |
| | | "deviceName": "", |
| | | "deviceCode": data, |
| | | "sendTimeList": [ |
| | | formatTime(oneHourAgo), // 一小时前 |
| | | formatTime(now) // 当前时间 |
| | | ], |
| | | "divisionDistrict": "110116000000", |
| | | "townCode": "110116110000", |
| | | "dictPacketsDataStatus": "1887255639886540806", |
| | | } |
| | | }); |
| | | |
| | | console.log("getYLJData:", response); |
| | | return response.data; |
| | | } |
| | | |
| | | // 按照北京市code查询行政区code |
| | | export async function getAeraCode() { |
| | | const response = await axios.post("/hp/sinoDzHiddenDangerPoint/getHiddenDangerCountByDistrict", { |
| | | "dictDisasterGrade": "", |
| | | "dictDisasterType": "", |
| | | "dictRiskLevel": "", |
| | | "districtCode": "110000000000", |
| | | "dictThreatObj": "", |
| | | "year": "2025" |
| | | }); |
| | | console.log("getAeraCode:", response); |
| | | return response.data; |
| | | } |
| | | |
| | | // 按照行政区code查询乡镇code |
| | | export async function getAeraTownCode(data) { |
| | | const response = await axios.post("/hp/sinoDzHiddenDangerPoint/getHiddenDangerTownCount", { |
| | | "dictDisasterGrade": "", |
| | | "dictDisasterType": "", |
| | | "dictRiskLevel": "", |
| | | "districtCode": data, |
| | | "dictThreatObj": "", |
| | | "year": "2025" |
| | | }); |
| | | console.log("getAeraCode:", response); |
| | | return response.data; |
| | | } |