From 1cf7f37fe233077ea5675c0bec6e6473fa9d3516 Mon Sep 17 00:00:00 2001 From: lijun Date: Sat, 23 Nov 2024 18:57:14 +0800 Subject: [PATCH] update code --- power.html | 59 ++++++++++++++++++------------------------------------ 1 file changed, 19 insertions(+), 40 deletions(-) diff --git a/power.html b/power.html index dc7ba1f..f3f2789 100644 --- a/power.html +++ b/power.html @@ -171,8 +171,7 @@
@@ -394,26 +393,7 @@ { projectId: 1912, url: './power/prj3.png', - regions: [ - { - "regionId": 1, - "regionName": "区域1", - x:400, - y:300 - }, - { - "regionId": 2, - "regionName": "区域1245", - x:470, - y:490 - }, - { - "regionId": 3, - "regionName": "区域2", - x:770, - y:160 - } - ] + regions: [] } ] @@ -513,6 +493,13 @@ let url = '/api/device/smart_meter/region_information'; this.post(url, { projectId: projectId }).then(d => { this.regions = d.data?.data || []; + this.mapInfo.regions=this.regions.map(it=>{ + it.data=null; + it.CurrentType=''; + it.dailyElectricity='加载中...'; + it.load=''; + return it; + }) this.regionElKey++; }); }, @@ -544,7 +531,6 @@ this.loadAreaEleTrendSel(); this.loadWarningCount(); this.loadWarningList(); - //this.loadMapInfo(); setTimeout(this.init, 10000) }, getDates(n) { @@ -836,17 +822,7 @@ this.block1.MonthAvgDailyElectricity = (data.MonthAvgDailyElectricity || 0).toFixed(2) this.block1.YearAvgDailyElectricity = (data.YearAvgDailyElectricity || 0).toFixed(2) }); - }, - loadMapInfo(){ - let url="/api/device/smart_meter/region_electricity_information"; - let postData={ - projectId:projectId, - regionId:1 - }; - this.post(url,postData).then(d=>{ - - }); - }, + }, getRegionMapInfo(it){ let url="/api/device/smart_meter/region_electricity_information"; let postData={ @@ -855,12 +831,15 @@ }; it.dailyElectricity="加载中..." this.post(url,postData).then(d=>{ - let data=d.data?.data||{}; - it.CurrentType=data.CurrentType||''; - it.dailyElectricity=data.dailyElectricity||''; - it.load=data.load||''; - it.data=d.data?.data||null; - if(it.data==null){ + let datas=d.data?.data||[]; + if(datas.length>0){ + let data=datas[0]; + it.CurrentType=data.CurrentType||''; + it.dailyElectricity=data.dailyElectricity||''; + it.load=data.load||''; + it.data=data + }else{ + it.data=null; it.dailyElectricity="暂无数据" } });