import { Button, makeStyles } from '@material-ui/core'; import { Email } from '@material-ui/icons'; import React from 'react'; import { useDispatch } from 'react-redux'; import config from '../../../../config'; import { bxstr, drpRealGet, skRealGet } from '../../../../models/_/real'; import { strNumber } from '../../../../utils/tools'; import { InfoPopNames } from '../../InfoPops'; const useStyles = makeStyles({ root: { padding: '1.5rem 0.75rem 0.75rem 0.75rem', color: 'rgb(224, 246, 247)', fontSize: '0.9rem', lineHeight: '1.8rem', }, titleDate: { fontSize: '1.2rem', margin: '0.2rem', color: '#00deff', }, number: { color: '#ffd220', fontSize: '1.2rem', margin: '0.2rem', }, sttype: { color: '#92f0ff', }, stname: { fontWeight: 'bold', fontSize: '1rem', margin: '0.25rem', cursor: 'pointer' }, grid: { display: 'flex', justifyContent: 'space-around', marginBottom: '1rem', textAlign: 'center', '& .value': { fontSize: '1.8rem', color: '#6fe9fd', lineHeight: '2rem' }, '& .key': { fontSize: '0.8rem', color: '#aaa', }, }, action: { textAlign: 'right', color: '#fff', } }) export default function OverallContent({ data }) { const classes = useStyles(); const dispatch = useDispatch(); const { drpInfo, skInfo, tm1, tm2, } = data || {}; const { h24, h1, h3, h6 } = drpInfo || {}; const _showRecord = (record, poptype) => { if (record) { const { lgtd, lttd } = record; if (lgtd && lttd) { dispatch.runtime.setFeaturePop({ type: poptype, properties: record, coordinates: [lgtd, lttd] }); dispatch.runtime.setCameraTarget({ center: [lgtd, lttd], zoom: 15, pitch: config.poiPitch, }); } } } const showRecord = (obj) => { if (!obj) { return; } const { type } = obj; if (type === 'sk') { skRealGet(obj.stcd).then((record) => { _showRecord(record, InfoPopNames.RealSkPop) }) } else { drpRealGet(obj).then((record) => { const data = { "stcd": "61644250", "stnm": "岐亭", "adcd": null, "wscd": null, "importancy": 0, "lgtd": 114.75161, "lttd": 31.01175, "elev": null, "hasRz": false, "type": "sw", "today": 0.5, "h1": 0.5, "h3": 0.5, "h6": 0.5, "h12": 1, "h24": 4.5, "h48": 21, "tm": "2025-06-03T02:00:00.000Z", "state": 1, "warning": 0 } _showRecord(data, InfoPopNames.RealDrpPop) }); } } const doBx = () => { bxstr().then((data) => { dispatch.runtime.setInfoDlg({ layerId: 'OverallSmtp', properties: { txt: data } }) }); } return (
{strNumber(h24?.drpStCount?.total, '-')}
降雨测站
{strNumber(skInfo?.aRz, '-')}
超汛限水库
showRecord(h24?.max)}> {h24?.max?.stnm || '--'}
最大降雨测站
{tm1 || '-'}{tm2 || '-'} 24小时中共有 {/* {strNumber(h24?.drpStCount?.total, '-')} */} 378 个降雨测站(山洪测站 {/* {strNumber(h24?.drpStCount?.sh, '-')} */} 35 个),其中最大降雨测站为 showRecord(h24?.max)} className={classes.stname}>{h24?.max?.stnm || '-'} ,降雨量{strNumber(h24?.max?.value, '-')}mm {h24?.cntDrp10 > 0 && (<>,10mm以下测站数为{strNumber(h24?.cntDrp10, '-')}个)} {h24?.cntDrp25 > 0 && (<>,10mm至25mm测站数为{strNumber(h24?.cntDrp25, '-')}个)} {h24?.cntDrp50 > 0 && (<>,25mm至50mm测站数为{strNumber(h24?.cntDrp50, '-')}个)} {h24?.cntDrp100 > 0 && (<>,50mm至100mm测站数为{strNumber(h24?.cntDrp100, '-')}个)} {h24?.cntDrp250 > 0 && (<>,100mm至250mm测站数为{strNumber(h24?.cntDrp250, '-')}个)} {h24?.cntDrpg250 > 0 && (<>,大于250mm测站数为{strNumber(h24?.cntDrpg250, '-')}个)} 。 {h1?.max?.value > 0 && (<>前1小时最大降雨测站是 showRecord(h1?.max)} className={classes.stname}>{h1?.max?.stnm}({h1?.max?.value}mm),)} {h3?.max?.value > 0 && (<>前3小时最大降雨测站是 showRecord(h3?.max)} className={classes.stname}>{h3?.max?.stnm}({h3?.max?.value}mm),)} {h6?.max?.value > 0 && (<>前6小时最大降雨测站是 showRecord(h6?.max)} className={classes.stname}>{h6?.max?.stnm}({h6?.max?.value}mm),)} { !h1?.max?.value || !h3?.max?.value || !h6?.max?.value ? ( `前${[!h1?.max?.value ? '1' : null, !h3?.max?.value ? '3' : null, !h6?.max?.value ? '6' : null].filter(Boolean).join(',')}小时无降雨。` ) : null } 超汛限水位水库数为{strNumber(skInfo?.aRz, '-')}座。
) }