diff --git a/src/views/gcaqjc/sjtjcx/ndsytjb/index.js b/src/views/gcaqjc/sjtjcx/ndsytjb/index.js index 07cf6b168..21f034f84 100644 --- a/src/views/gcaqjc/sjtjcx/ndsytjb/index.js +++ b/src/views/gcaqjc/sjtjcx/ndsytjb/index.js @@ -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); }