李神峰 2025-09-24 16:28:50 +08:00
commit 11550d4654
1 changed files with 18 additions and 4 deletions

View File

@ -56,12 +56,19 @@ const Page = () => {
}, [dmName,trData])
const getTableData = async (params) => {
setLoading(true)
try {
setLoading(true)
const res = await httppost2(apiurl.gcaqjc.sjtjcx.ndsytjb.page, params)
setLoading(false)
const { code, data } = res
if(code!==200 || data.length>10000){
setDataSource([])
setLoading(false)
console.log('请求失败或者数组超长,data长度'+data?.length||0);
return
}
console.log('开始计算-------');
let newArr = [];
let newData = res.data?.map((s, i) => {
let newData = data?.map((s, i) => {
newArr.push(s.list?.map(c => ({
[c.stationCode]: c.value || '-',
tm:c.tm
@ -89,7 +96,9 @@ const Page = () => {
}
})
setDataSource(result)
setLoading(false)
} catch (error) {
setLoading(false)
console.log(error);
}
}
@ -110,7 +119,12 @@ const Page = () => {
const getTable2Data = async (params) => {
try {
const res = await httppost2(apiurl.gcaqjc.sjtjcx.ndsytjb.list1, params)
setTable2Data(res.data)
const { code, data } = res
if(code!==200){
setTable2Data([])
return
}
setTable2Data(data||[])
} catch (error) {
console.log(error);
}