feat():首页闸门控制接口联调

master
李神峰 2025-01-10 17:56:12 +08:00
parent f579043c5b
commit 3199168dd5
4 changed files with 54 additions and 18 deletions

View File

@ -66,7 +66,10 @@ const Page = () => {
render: (v) => <Status1 val={v} /> render: (v) => <Status1 val={v} />
}, },
{ title: '实时开度(m)', key: 'realAperture', dataIndex: 'realAperture', width: 140}, {
title: '实时开度(m)', key: 'realAperture', dataIndex: 'realAperture', width: 140,
render:(v) => <span>{(v/1000).toFixed(2)}</span>
},
{ {
title: '监测时间', key: 'tm', dataIndex: 'tm', width: 150, title: '监测时间', key: 'tm', dataIndex: 'tm', width: 150,
}, },

View File

@ -116,7 +116,29 @@ export default function Home() {
} }
} }
//安全监测数据 //安全监测数据
const [safeData, setSafeData] = useState(Array(5).fill(0).map((item, i) => ({ id: i, cd: "SY01", dm: '1#断面', kpa: 2749, time: '2024-08-15 15:00:00' }))) const [safeData, setSafeData] = useState([])
const getSafeData = async () => {
const start = moment().subtract(7, 'days').format('YYYY-MM-DD 00:00:00')
const end = moment().format('YYYY-MM-DD 23:59:59')
let params = {
pageSo: {
pageSize: 999,
pageNumber: 1
},
dateTimeRangeSo: {
start,
end
}
}
try {
const res = await httppost2(apiurl.aqjc.syjc.page, params)
if (res.code == 200) {
setSafeData(res.data?.records)
}
} catch (error) {
console.log(error);
}
}
//操作日志 //操作日志
const [operateData, setOperateData] = useState([]) const [operateData, setOperateData] = useState([])
const getLogData = async () => { const getLogData = async () => {
@ -232,6 +254,7 @@ export default function Home() {
getLogData() getLogData()
getPoliceData() getPoliceData()
getMenu() getMenu()
getSafeData()
}, []) }, [])
return ( return (
@ -246,7 +269,7 @@ export default function Home() {
))} ))}
</div> </div>
<div className='content-box'> <div className='content-box'>
<Zmjk /> <Zmjk water={ RealData.find(item => item?.type == 2)} />
</div> </div>
{showTabLeft && {showTabLeft &&
<div <div
@ -304,18 +327,18 @@ export default function Home() {
<thead> <thead>
<tr style={{ background: '#455a87', height: 35, fontSize: 14 }}> <tr style={{ background: '#455a87', height: 35, fontSize: 14 }}>
<th>测点编号</th> <th>测点编号</th>
<th>监测断面</th> <th style={{ width: 90 }}>水位高程(m)</th>
<th>(KPa)</th> <th>(KPa)</th>
<th style={{ width: 137 }}>监测时间</th> <th style={{ width: 137 }}>监测时间</th>
</tr> </tr>
</thead> </thead>
<tbody style={{ overflowY: safeData.length > 4 ? 'scroll' : 'hidden' }}> <tbody style={{ overflowY: safeData.length > 4 ? 'scroll' : 'hidden' }}>
{safeData.length > 0 ? safeData.map((item, i) => ( {safeData.length > 0 ? safeData.map((item, i) => (
<tr style={{ borderBottom: '2px solid #536cc6', textAlign: 'center' }} className={clsx({ 'odd_row': i % 2 })} key={i}> <tr style={{ borderBottom: '2px solid #536cc6', textAlign: 'center' }} className={clsx({ 'odd_row': i % 2 })} key={i}>
<td>{item.cd}</td> <td>{item.stationCode}</td>
<td>{item.dm}</td> <td>{item.waterEle}</td>
<td>{item.kpa}</td> <td>{item.press}</td>
<td style={{ width: 137 }}>{item.time}</td> <td style={{ width: 137 }}>{item.tm}</td>
</tr> </tr>
)) : <Empty /> )) : <Empty />
} }

View File

@ -116,7 +116,9 @@ const zmobj ={
"_sort": 10086 "_sort": 10086
} }
const Page = () => { const Page = ({ water }) => {
console.log("water",water);
const [waterRatio,setWaterRatio] = useState(0) const [waterRatio,setWaterRatio] = useState(0)
const [data,setData] = useState({}) const [data,setData] = useState({})
const [damList, setDamList ] = useState([]) const [damList, setDamList ] = useState([])
@ -128,10 +130,11 @@ const Page = () => {
const eqpnoList = useMemo(() => damList ? new Array(damList.length).fill(0).map((o, index) => index) : [], [damList]); const eqpnoList = useMemo(() => damList ? new Array(damList.length).fill(0).map((o, index) => index) : [], [damList]);
useEffect(()=>{ useEffect(()=>{
getList() // getList()
getDamData()
},[]) },[])
const getList = async()=>{ const getList = async () => {
const {code, data} = await httppost2(apiurl.zmjk.getList) const {code, data} = await httppost2(apiurl.zmjk.getList)
if(code!==200){ if(code!==200){
return return
@ -144,8 +147,8 @@ const Page = () => {
const getDamData = async(stcd)=>{ const getDamData = async () => {
const {code, data} = await httpget2(apiurl.zmjk.getDamData,{stcd}) const {code, data} = await httppost2(apiurl.gcyx.yxqk.list)
if(code!==200){ if(code!==200){
return return
} }
@ -153,10 +156,9 @@ const Page = () => {
data.map((item)=>{ data.map((item)=>{
list.push({ list.push({
...item, ...item,
realAperture:item.realAperture + 200
}) })
}) })
setDamList([...list,...list, ...list,list[0]]) setDamList(list)
} }
const getInformation = async(gateCode)=>{ const getInformation = async(gateCode)=>{
@ -164,7 +166,8 @@ const Page = () => {
if(code!==200){ if(code!==200){
return return
} }
data.map((item)=>{ data.map((item) => {
// 闸后流量
if(item.type===2){ if(item.type===2){
setWaterRatio(item.value/5||0) setWaterRatio(item.value/5||0)
} }
@ -172,6 +175,13 @@ const Page = () => {
setList(data) setList(data)
} }
useEffect(() => {
if (water?.type) {
setWaterRatio(water.value/20||0)
}
}, [water])
return ( return (
<> <>
<div className='sg_zmjk' style={{paddingRight:"0",paddingBottom:"0"}}> <div className='sg_zmjk' style={{paddingRight:"0",paddingBottom:"0"}}>

View File

@ -61,7 +61,7 @@ const ModalForm = ({ mode, record, onUerEdit, onSave }) => {
const res = await xyt_httpget2(apiurl.systemM.userM.list, { pageNum: 1, pageSize: 9999 }) const res = await xyt_httpget2(apiurl.systemM.userM.list, { pageNum: 1, pageSize: 9999 })
setRoleOptions(res.rows.map(item => ({ label: item.roleName, value: item.roleId }))) setRoleOptions(res.rows.map(item => ({ label: item.roleName, value: item.roleId })))
} catch (error) { } catch (error) {
console.log(error);
} }
} }
const onFinish = () => { const onFinish = () => {