From 7688c590379d1de6c9037ac8138ebaf7bd3c0fc2 Mon Sep 17 00:00:00 2001 From: qzc Date: Wed, 24 Sep 2025 09:37:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E6=8E=A5=E5=8F=A3=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E8=B6=85=E9=95=BF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/gcaqjc/sjtjcx/ndsytjb/index.js | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) 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); }