update code

main
lijun 2024-11-23 18:57:14 +08:00
parent 0f4c38e89f
commit 1cf7f37fe2
1 changed files with 19 additions and 40 deletions

View File

@ -171,8 +171,7 @@
<div :style="'background-image:url('+mapInfo.url+')'" class="map-image"> <div :style="'background-image:url('+mapInfo.url+')'" class="map-image">
<el-popover v-for="(it,idx) in mapInfo.regions" popper-class="power-pop" <el-popover v-for="(it,idx) in mapInfo.regions" popper-class="power-pop"
placement="top-start" placement="top-start"
:title="it.regionName" :title="it.regionName"
trigger="click" trigger="click"
> >
<div class="pop-body"> <div class="pop-body">
@ -394,26 +393,7 @@
{ {
projectId: 1912, projectId: 1912,
url: './power/prj3.png', url: './power/prj3.png',
regions: [ 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
}
]
} }
] ]
</script> </script>
@ -513,6 +493,13 @@
let url = '/api/device/smart_meter/region_information'; let url = '/api/device/smart_meter/region_information';
this.post(url, { projectId: projectId }).then(d => { this.post(url, { projectId: projectId }).then(d => {
this.regions = d.data?.data || []; 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++; this.regionElKey++;
}); });
}, },
@ -544,7 +531,6 @@
this.loadAreaEleTrendSel(); this.loadAreaEleTrendSel();
this.loadWarningCount(); this.loadWarningCount();
this.loadWarningList(); this.loadWarningList();
//this.loadMapInfo();
setTimeout(this.init, 10000) setTimeout(this.init, 10000)
}, },
getDates(n) { getDates(n) {
@ -836,17 +822,7 @@
this.block1.MonthAvgDailyElectricity = (data.MonthAvgDailyElectricity || 0).toFixed(2) this.block1.MonthAvgDailyElectricity = (data.MonthAvgDailyElectricity || 0).toFixed(2)
this.block1.YearAvgDailyElectricity = (data.YearAvgDailyElectricity || 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){ getRegionMapInfo(it){
let url="/api/device/smart_meter/region_electricity_information"; let url="/api/device/smart_meter/region_electricity_information";
let postData={ let postData={
@ -855,12 +831,15 @@
}; };
it.dailyElectricity="加载中..." it.dailyElectricity="加载中..."
this.post(url,postData).then(d=>{ this.post(url,postData).then(d=>{
let data=d.data?.data||{}; let datas=d.data?.data||[];
it.CurrentType=data.CurrentType||''; if(datas.length>0){
it.dailyElectricity=data.dailyElectricity||''; let data=datas[0];
it.load=data.load||''; it.CurrentType=data.CurrentType||'';
it.data=d.data?.data||null; it.dailyElectricity=data.dailyElectricity||'';
if(it.data==null){ it.load=data.load||'';
it.data=data
}else{
it.data=null;
it.dailyElectricity="暂无数据" it.dailyElectricity="暂无数据"
} }
}); });