李神峰 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]) }, [dmName,trData])
const getTableData = async (params) => { const getTableData = async (params) => {
setLoading(true)
try { try {
setLoading(true)
const res = await httppost2(apiurl.gcaqjc.sjtjcx.ndsytjb.page, params) 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 newArr = [];
let newData = res.data?.map((s, i) => { let newData = data?.map((s, i) => {
newArr.push(s.list?.map(c => ({ newArr.push(s.list?.map(c => ({
[c.stationCode]: c.value || '-', [c.stationCode]: c.value || '-',
tm:c.tm tm:c.tm
@ -89,7 +96,9 @@ const Page = () => {
} }
}) })
setDataSource(result) setDataSource(result)
setLoading(false)
} catch (error) { } catch (error) {
setLoading(false)
console.log(error); console.log(error);
} }
} }
@ -110,7 +119,12 @@ const Page = () => {
const getTable2Data = async (params) => { const getTable2Data = async (params) => {
try { try {
const res = await httppost2(apiurl.gcaqjc.sjtjcx.ndsytjb.list1, params) 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) { } catch (error) {
console.log(error); console.log(error);
} }