electronicMonitoring.vue 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433
  1. <template>
  2. <view>
  3. <view class="background">
  4. <u-picker v-model="tabsFrom.show1"
  5. :defaultSelector="[tabsFrom.show1Index]"
  6. mode="selector" :range="tabsFrom.selector1" range-key="label" @confirm="selector1confirm" ></u-picker>
  7. <u-picker-select title="日期选择" v-model="tabsFrom.show2"
  8. :defaultTime="tabsFrom.show2Index" :endYear="endYear" @cancel="selector2cancel"
  9. mode="time" :params="params" :noselect="false" @confirm="selector2confirm" @reset="selector2reset" ></u-picker-select>
  10. <u-navbar :background="background"
  11. @titleCk="titleCk" :title-icon="electricityMeterList.length>1?'arrow-down':''"
  12. back-icon-color="#fff" :title="title" title-color="#fff">
  13. <!-- <view class="u-nav-slot" slot="right" @click="tabsFrom.show2=true,params.day=true">
  14. <image class="img" src="@/assets/img/riLine-calendar-todo-line 1.svg" mode=""></image>
  15. </view> -->
  16. </u-navbar>
  17. <!-- 日期 -->
  18. <view class="date-box" v-if="false" >
  19. <view class="item" v-for="(item,i) in topDate"
  20. :class="{
  21. 'item-today':item.queryDate==FormData.queryDate
  22. }"
  23. @click="queryDate(item.queryDate,true)"
  24. :key="i">
  25. <view class="date">
  26. {{item.num}}
  27. </view>
  28. <view class="week">
  29. {{item.week}}
  30. </view>
  31. <view class="dot" v-if="item.today==0">
  32. </view>
  33. </view>
  34. <view class="item item-today" v-if="0">
  35. <view class="date">
  36. 26
  37. </view>
  38. <view class="week ">
  39. 今天
  40. </view>
  41. <view class="dot">
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. <!-- 用电量 -->
  47. <view class="electricity-consumption">
  48. <!-- 统计 -->
  49. <view class="statistics-content">
  50. <view class="statistics-item"
  51. @click="gotoUrl('/pages/mine/electricityConsumptionDetail?id='
  52. +FormData.meterId+'&type='+FormData.type)">
  53. <view class="item-title">
  54. <image class="img" src="@/assets/img/meterStatistics@3x.png"></image>电量统计(度)
  55. </view>
  56. <view class="item-value">
  57. <text>{{electricityNum}}</text> <u-icon name="arrow-right" color="#cccccc" size="24" ></u-icon>
  58. </view>
  59. </view>
  60. <view class="statistics-item" >
  61. <view class="item-title item-title2">
  62. <image class="img" src="@/assets/img/electricityStatistics@3x.png"></image>电费统计(元)
  63. </view>
  64. <view class="item-value">
  65. {{fee}}
  66. </view>
  67. </view>
  68. </view>
  69. <view class="radio">
  70. <u-radio-group v-model="value" @change="radioGroupChange">
  71. <u-radio @change="radioChange" v-for="(item, index) in list" :key="index" :name="item.id"
  72. :disabled="item.disabled">
  73. {{item.name}}
  74. </u-radio>
  75. </u-radio-group>
  76. </view>
  77. </view>
  78. <!-- 远程控制电源开关 -->
  79. <view class="control"
  80. v-if="meterDetail.type!=6&&meterDetail.allowSwitch">
  81. <view class="text" @click="gotoUrl('/pages/remoteControl/switchDetail?id='+meterDetail.id)" >
  82. 智能监控电源
  83. <u-icon name="arrow-right" color="#cccccc" size="24" ></u-icon>
  84. </view>
  85. <view class="icon" style=" display: flex;" >
  86. <span>关</span>
  87. <u-switch size="32" @change="switchBtnApi(meterDetail,$event)"
  88. v-model="meterDetail.switchStatus" inactive-color="#ff9900" ></u-switch >
  89. <span >开</span>
  90. <!-- <img src="@/assets/img/control.png"
  91. @tap.stop="switchBtnApi(meterDetail,0)"
  92. v-if="meterDetail.switchStatus"
  93. alt="" />
  94. <img @tap.stop="switchBtnApi(meterDetail,1)"
  95. v-else
  96. src="@/assets/img/switchClose.png" alt="" /> -->
  97. </view>
  98. <!-- <view class="icon" v-i>
  99. <img src="@/assets/img/control.png"
  100. @tap.stop="switchBtnApi(meterDetail,0)"
  101. v-if="meterDetail.switchStatus"
  102. alt="" />
  103. <img @tap.stop="switchBtnApi(meterDetail,1)"
  104. v-else
  105. src="@/assets/img/switchClose.png" alt="" />
  106. </view> -->
  107. </view>
  108. <!-- 各时段用电量 -->
  109. <view class="electricity-chart">
  110. <view class="title">
  111. <view class="text">
  112. <view class="icon-title">
  113. </view> 各时段用电量 (度)
  114. </view>
  115. <view @click="tabsFrom.show2=true,params.day=true" class="queryDayClass" >
  116. {{queryDay}}<u-icon name="arrow-down"></u-icon>
  117. </view>
  118. </view>
  119. <view class="chart">
  120. <view id="pieEcharts" >
  121. </view>
  122. <view
  123. style="background: white; display: flex;justify-content: space-between;padding: 0 12px;" >
  124. <view>电量合计:{{sumQuantity}}度</view>
  125. <view>电费合计:{{sumFee}}元</view>
  126. </view>
  127. </view>
  128. </view>
  129. <!-- 设备信息 -->
  130. <view class="equipment-information">
  131. <view class="title">
  132. <view class="icon-title">
  133. </view>
  134. <view class="text">
  135. 设备信息
  136. </view>
  137. <view class="more" @click="equipmentInfosShow=true">
  138. 查看全部<u-icon name="arrow-right" size="24" color="#d4d4d4"></u-icon>
  139. </view>
  140. </view>
  141. <view class="infos">
  142. <view class="item" style="width: 30%;">
  143. <view class="item-title">
  144. 设备类型
  145. </view>
  146. <view class="item-value">
  147. {{meterDetail.deviceTypeN}}
  148. </view>
  149. </view>
  150. <view class="border">
  151. </view>
  152. <view class="item" style="width: 30%;">
  153. <view class="item-title">
  154. 设备编号
  155. </view>
  156. <view class="item-value">
  157. {{meterDetail.deviceNo}}
  158. </view>
  159. </view>
  160. <view class="border">
  161. </view>
  162. <view class="item" style="width: 30%;">
  163. <view class="item-title">
  164. 设备地址
  165. </view>
  166. <view class="item-value">
  167. {{meterDetail.installationAddressSimple}}
  168. </view>
  169. </view>
  170. </view>
  171. </view>
  172. <!-- 设备信息弹窗 -->
  173. <view class="equipment-popup">
  174. <u-popup v-model="equipmentInfosShow" mode="bottom" border-radius="12">
  175. <view class="content">
  176. <view class="headline">
  177. 设备信息
  178. </view>
  179. <view class="infos">
  180. <view class="item">
  181. <view class="item-title">
  182. 设备名称
  183. </view>
  184. <view class="item-value">
  185. {{meterDetail.name}}
  186. </view>
  187. </view>
  188. <view class="item">
  189. <view class="item-title">
  190. 设备类型
  191. </view>
  192. <view class="item-value">
  193. {{meterDetail.deviceTypeN}}
  194. </view>
  195. </view>
  196. <view class="item">
  197. <view class="item-title">
  198. 设备编号
  199. </view>
  200. <view class="item-value">
  201. {{meterDetail.deviceNo}}
  202. </view>
  203. </view>
  204. <view class="item">
  205. <view class="item-title">
  206. 产权单位
  207. </view>
  208. <view class="item-value">
  209. {{meterDetail.companyFullName}}
  210. </view>
  211. </view>
  212. <view class="item">
  213. <view class="item-title">
  214. 设备地址
  215. </view>
  216. <view class="item-value">
  217. <span>{{meterDetail.installationAddress}}</span>
  218. <image class="img" v-if="false" src="@/assets/img/riFill-navigation-fill 1.svg"></image>
  219. </view>
  220. </view>
  221. <view class="item">
  222. <view class="item-title">
  223. 地址简称
  224. </view>
  225. <view class="item-value">
  226. <span>{{meterDetail.installationAddressSimple}}</span>
  227. <image class="img" v-if="false" src="@/assets/img/riFill-navigation-fill 1.svg"></image>
  228. </view>
  229. </view>
  230. <view class="item">
  231. <view class="item-title">
  232. 使用单位
  233. </view>
  234. <view class="item-value">
  235. {{meterDetail.customer}}
  236. </view>
  237. </view>
  238. <view class="item">
  239. <view class="item-title">
  240. 启用时间
  241. </view>
  242. <view class="item-value">
  243. {{meterDetail.enablingTime}}
  244. </view>
  245. </view>
  246. </view>
  247. <button class="get" @click="equipmentInfosShow=false">知道了</button>
  248. </view>
  249. </u-popup>
  250. </view>
  251. </view>
  252. </template>
  253. <script>
  254. import {
  255. parseUnixTime,
  256. beforeTimeStamp,
  257. getWeek,newDate
  258. } from '@/apis/utils'
  259. import * as API from '@/apis/pagejs/tenantElectricityMeter.js'
  260. import * as echarts from "echarts";
  261. export default {
  262. data() {
  263. return {
  264. queryDay:'',
  265. title:"查询中",
  266. myChart:null,
  267. showTop: [0, 0, 0, 0, 0, 0, 0, 0],
  268. fee:0,
  269. topDate:[],
  270. electricityMeterList:[],
  271. FormData:{
  272. },
  273. FormData2:{
  274. },
  275. endYear:'',
  276. params: {
  277. year: true,
  278. month: true,
  279. day: true,
  280. hour: false,
  281. minute: false,
  282. second: false
  283. },
  284. tabsFrom: {
  285. show1: false,
  286. show1Index:0,
  287. show2Index:'',
  288. show2: false,
  289. show1Text: "全部类型",
  290. show2Text: "全部时间",
  291. selector1:[
  292. {
  293. label: '全部类型',
  294. value: '',
  295. },
  296. {
  297. label: '线上充值',
  298. value: '1',
  299. },
  300. {
  301. label: '线下充值',
  302. value: '2',
  303. },
  304. ]
  305. },
  306. background: {
  307. backgroundColor: '#1677FF',
  308. },
  309. list: [
  310. {
  311. id:1,
  312. name: '本月',
  313. disabled: false
  314. },
  315. {
  316. id:4,
  317. name: '今日',
  318. disabled: false
  319. },
  320. {
  321. id:2,
  322. name: '上月',
  323. disabled: false
  324. },
  325. {
  326. id:3,
  327. name: '本年',
  328. disabled: false
  329. }, {
  330. id:0,
  331. name: '合计',
  332. disabled: false
  333. }, {
  334. id:10,
  335. name: '指定月份',
  336. disabled: false
  337. }
  338. ],
  339. sumQuantity:0,
  340. sumFee:0,
  341. // u-radio-group的v-model绑定的值如果设置为某个radio的name,就会被默认选中
  342. value: '4',
  343. oldvalue: '4',
  344. intervalId: null, // 用于存储间隔ID
  345. intervalReady: true, // 用于存储间隔ID
  346. electricityNum: 0, //电量统计
  347. electricity:{
  348. },
  349. meterDetail:{
  350. },
  351. meterId:"",
  352. equipmentInfosShow:false,
  353. };
  354. },
  355. onLoad(op) {
  356. if(op.id){
  357. this.meterId=op.id;
  358. //this.getMeter()
  359. }
  360. this.endYear=new Date().getFullYear()
  361. this.FormData.queryDate=parseUnixTime(new Date(), '{y}-{m}-{d}')
  362. this.FormData2.queryDate=parseUnixTime(new Date(), '{y}-{m}-{d}')
  363. this.FormData.type=4
  364. this.getElectricityMeterList();
  365. // for(var i =4;i>=0;i--){
  366. // var time=new Date(beforeTimeStamp(i,new Date()));
  367. // this.topDate.push({
  368. // num:time.getDate(),
  369. // week:i==0?'今日':getWeek(time),
  370. // today:i,
  371. // queryDate:parseUnixTime(time, '{y}-{m}-{d}')
  372. // })
  373. // }
  374. // console.log( this.topDate)
  375. },
  376. beforeDestroy() {
  377. this.clearTimer(); // 组件销毁前清除定时器
  378. this.intervalReady=false;
  379. console.log( "组件销毁前清除定时器")
  380. },
  381. methods: {
  382. clearTimer() {
  383. if (this.intervalId) {
  384. clearInterval(this.intervalId); // 清除定时器
  385. this.intervalId = null; // 重置定时器ID
  386. }
  387. },
  388. startInterval(){
  389. this.clearTimer(); // 组件销毁前清除定时器
  390. this.intervalId = setInterval(() => {
  391. // 每隔5秒运行的代码
  392. console.log('这段代码每隔5秒运行一次');
  393. this.getTimeSlotStatistics(true)
  394. this.getElectricityStatistics(true)
  395. }, 60*1000);
  396. },
  397. titleCk(){
  398. if(this.electricityMeterList.length>1){
  399. this.tabsFrom.show1=true
  400. }
  401. },
  402. selector1confirm(e){
  403. var index=e[0]
  404. this.tabsFrom.show1Index=index
  405. this.tabsFrom.show1Text=this.tabsFrom.selector1[index].label
  406. this.title=this.tabsFrom.selector1[index].label
  407. this.FormData.meterId=this.tabsFrom.selector1[index].value
  408. this.FormData.queryDate=parseUnixTime(new Date(), '{y}-{m}-{d}')
  409. this.FormData2.meterId=this.tabsFrom.selector1[index].value
  410. this.FormData2.queryDate=parseUnixTime(new Date(), '{y}-{m}-{d}')
  411. this.FormData.type=4
  412. this.value="4"
  413. this.electricity=this.electricityMeterList[index]
  414. this.getMeterDetails()
  415. this.getTimeSlotStatistics()
  416. this.getElectricityStatistics()
  417. },
  418. queryDate(queryTime,day){
  419. if(day){
  420. this.FormData2.queryDate=queryTime;
  421. //this.FormData2.type =day?"9":"10"
  422. //this.value="-1"
  423. this.getTimeSlotStatistics()
  424. }else{
  425. this.FormData.queryDate=queryTime+"-01";
  426. this.FormData.type ="10"
  427. //this.value="-1"
  428. this.list[5].name = queryTime;
  429. this.getElectricityStatistics()
  430. }
  431. },
  432. getElectricityStatistics(interval){
  433. // if(!this.intervalReady){
  434. // return
  435. // }
  436. if(!interval){
  437. uni.showLoading({
  438. title: "加载中",
  439. mask: true,
  440. })
  441. }
  442. var obj={
  443. ...this.FormData
  444. }
  445. if(obj.type!=10){
  446. this.list[5].name = '指定月份';
  447. }
  448. API.electricityStatistics(obj).then((response) => {
  449. if(!interval){
  450. uni.hideLoading();
  451. }
  452. this.showTop = [0, 0, 0, 0, 0, 0, 0, 0]
  453. var electricity = response.data.kwhMap.kwh+"";
  454. this.electricityNum = response.data.kwhMap.kwh;
  455. this.fee = response.data.kwhMap.fee;
  456. if (electricity) {
  457. var sz = electricity.split(".")
  458. var str1 = sz[0];
  459. var str2 = [];
  460. if (sz.length > 1) {
  461. str2 = sz[1];
  462. this.showTop[7] = str2[0];
  463. }
  464. var j = 0;
  465. for (var i in str1) {
  466. if (i != undefined) {
  467. this.showTop[6 - str1.length + j + 1] = str1[i]
  468. }
  469. j++;
  470. }
  471. this.$forceUpdate()
  472. }
  473. //this.electricityMeterList=response.data.meterList
  474. if(!interval){
  475. this.startInterval(); // 组件挂载后开始间隔
  476. }
  477. }).catch(error => {
  478. uni.showToast({
  479. title: error,
  480. icon: "none"
  481. })
  482. })
  483. },
  484. getMeterDetails(){
  485. API.meterDetails({
  486. meterId:this.FormData.meterId
  487. }).then((response) => {
  488. this.meterDetail=response.data.meter;
  489. }).catch(error => {
  490. uni.showToast({
  491. title: error,
  492. icon: "none"
  493. })
  494. })
  495. },
  496. getTimeSlotStatistics(interval){
  497. if(!interval){
  498. uni.showLoading({
  499. title: "加载中",
  500. mask: true,
  501. })
  502. }
  503. this.queryDay=parseUnixTime(newDate(this.FormData2.queryDate), '{y}年{m}月{d}日');
  504. API.timeSlotStatistics(this.FormData2).then((response) => {
  505. if(!interval){
  506. uni.hideLoading();
  507. }
  508. this.hourMap=response.data.hourMap
  509. this.sumQuantity=response.data.kwhMap.kwh
  510. this.sumFee=response.data.kwhMap.fee
  511. this.getPle(this.hourMap,interval)
  512. }).catch(error => {
  513. uni.showToast({
  514. title: error,
  515. icon: "none"
  516. })
  517. })
  518. },
  519. getPle(list,interval){
  520. if (!this.myChart) {
  521. this.myChart = echarts.init(document.getElementById('pieEcharts'),null,{
  522. width:uni.upx2px(700),height:uni.upx2px(480)
  523. });
  524. }
  525. if(!interval){
  526. this.myChart.clear();
  527. }
  528. var data1=[];
  529. var data2=[];
  530. for(var i in list){
  531. data1.push(i)
  532. data2.push(list[i].kwh)
  533. }
  534. var axisLabel={
  535. rotate:40,
  536. interval:0,
  537. textStyle: {
  538. color: "#333"
  539. }
  540. }
  541. if(data1.length<4){
  542. axisLabel={
  543. interval:0,
  544. textStyle: {
  545. color: "#333"
  546. },
  547. }
  548. }
  549. var headitemby=""
  550. var showkey = "";
  551. var option = {
  552. tooltip: {
  553. trigger: 'axis',
  554. formatter: (value) => {
  555. var name = value[0].name;
  556. var obj=list[name]
  557. var text= `<p>${name}</p>`
  558. if(obj.electricityPrice!=undefined){
  559. text+=`<p>电价:${obj.electricityPrice}元/度</p>`
  560. }
  561. if(obj.kwh!=undefined){
  562. text+=`<p>电量:${obj.kwh}度</p>`
  563. }
  564. if(obj.amount!=undefined){
  565. text+=` <p>电费:${obj.amount}元</p>`
  566. }
  567. return text
  568. }
  569. },
  570. grid: {
  571. top: 20,
  572. left: 5,
  573. right: 10,
  574. bottom: 20,
  575. containLabel: true
  576. },
  577. xAxis: {
  578. type: 'category',
  579. data: data1,
  580. axisLabel: axisLabel,
  581. },
  582. yAxis: {
  583. type: 'value',
  584. },
  585. series: [
  586. {
  587. name: '电量',
  588. data: data2,
  589. type: 'bar',
  590. label: {
  591. show: true,
  592. position: 'top',
  593. color: '#5C7BD9'
  594. }
  595. }
  596. ]
  597. }
  598. console.log(option)
  599. this.myChart.setOption(option);
  600. },
  601. switchBtnApiMethod(node,key){
  602. uni.showLoading({
  603. title: "加载中",
  604. mask: true,
  605. })
  606. API.remoteSwitch({
  607. meterId:node.id,
  608. enabled:key
  609. }).then((res) => {
  610. uni.hideLoading();
  611. node.switchStatus=key
  612. }).catch(error => {
  613. uni.showToast({
  614. title: error,
  615. icon: "none"
  616. })
  617. })
  618. },
  619. switchBtnApi(node,key){
  620. uni.showModal({
  621. confirmColor:`${key?'#3CC51F':'red'}`,
  622. confirmText:`${key?'开启':'关闭'}`,
  623. content: `确认是否要"${key?'开启':'关闭'}"${node.name}`,
  624. title: "提示",
  625. success:res=> {
  626. if(res.confirm){
  627. this.switchBtnApiMethod(node,key);
  628. }else{
  629. node.switchStatus=!key
  630. }
  631. }
  632. })
  633. console.log(node,key)
  634. },
  635. getElectricityMeterList(){
  636. uni.showLoading({
  637. title: "加载中",
  638. mask: true,
  639. })
  640. API.electricityMeterList().then((response) => {
  641. uni.hideLoading();
  642. this.electricityMeterList=response.data.meterList
  643. if(this.electricityMeterList.length){
  644. var index=0;
  645. for(var i in this.electricityMeterList){
  646. var obj=this.electricityMeterList[i]
  647. if(obj.id==this.meterId){
  648. index=i
  649. this.tabsFrom.show1Index=i;
  650. }
  651. }
  652. this.electricity=this.electricityMeterList[index];
  653. this.FormData.meterId=this.electricityMeterList[index].id
  654. this.FormData2.meterId=this.electricityMeterList[index].id
  655. this.title=this.electricityMeterList[index].name
  656. // {
  657. // label: '全部类型',
  658. // value: '',
  659. // }
  660. this.tabsFrom.selector1=[]
  661. this.tabsFrom.selector1=this.electricityMeterList.map(item=>{
  662. return {
  663. label:item.name,
  664. value:item.id
  665. }
  666. })
  667. this.getMeterDetails();
  668. this.getTimeSlotStatistics()
  669. this.getElectricityStatistics()
  670. }else{
  671. uni.showModal({
  672. title:"提示",
  673. content:"未绑定电表,请联系管理员!",
  674. showCancel:false,
  675. success() {
  676. uni.navigateBack()
  677. }
  678. })
  679. }
  680. }).catch(error => {
  681. uni.showToast({
  682. title: error,
  683. icon: "none"
  684. })
  685. })
  686. },
  687. selector2confirm(e){
  688. this.tabsFrom.show2Text=e.year+"年"+e.month+"月"
  689. this.tabsFrom.show2Index=e.year+"-"+e.month
  690. if(e.day){
  691. this.tabsFrom.show2Text+=e.day+"日"
  692. this.tabsFrom.show2Index+='-'+e.day
  693. this.queryDate(this.tabsFrom.show2Index,true)
  694. }else{
  695. this.queryDate(this.tabsFrom.show2Index,false)
  696. }
  697. },
  698. selector2reset(e){
  699. console.log(e)
  700. this.tabsFrom.show2Text='全部时间'
  701. this.tabsFrom.show2Index='';
  702. if(this.params.day){
  703. this.FormData2.queryDate=parseUnixTime(new Date(), '{y}-{m}-{d}')
  704. this.getTimeSlotStatistics()
  705. }else{
  706. this.oldvalue="4";
  707. this.selector2cancel()
  708. }
  709. },
  710. // 选中某个单选框时,由radio时触发
  711. radioChange(e) {
  712. //console.log(e);
  713. },
  714. // 选中任一radio时,由radio-group触发
  715. selector2cancel(){
  716. this.value=this.oldvalue;
  717. // this.FormData.type=this.value
  718. // this.getElectricityStatistics()
  719. },
  720. radioGroupChange(e) {
  721. console.log(e);
  722. this.oldvalue= this.FormData.type;
  723. this.FormData.type=e
  724. if(e==10){
  725. this.tabsFrom.show2=true
  726. this.params.day=false
  727. }else{
  728. this.getElectricityStatistics()
  729. }
  730. }
  731. }
  732. };
  733. </script>
  734. <style lang="scss" scoped>
  735. page {
  736. padding-bottom: 100rpx;
  737. }
  738. .background {
  739. background-color: rgba(22, 119, 255, 1);
  740. padding-bottom: 100rpx;
  741. /deep/.u-border-bottom:after {
  742. border: none;
  743. }
  744. .u-nav-slot {
  745. margin-right: 32rpx;
  746. .img {
  747. width: 48rpx;
  748. height: 48rpx;
  749. vertical-align: middle;
  750. }
  751. }
  752. }
  753. .background::after {
  754. content: '';
  755. position: absolute;
  756. width: 160%;
  757. height: 80px;
  758. background-color: rgba(22, 119, 255, 1);
  759. left: -30%;
  760. border-radius: 0 0 50% 50%;
  761. }
  762. // // 日期
  763. .date-box {
  764. display: flex;
  765. align-items: center;
  766. justify-content: space-between;
  767. margin: 24rpx 32rpx;
  768. .item {
  769. border-radius: 8px;
  770. background-color: rgba(255, 255, 255, 0.1);
  771. border: 1px solid rgba(255, 255, 255, 0.15);
  772. width: 120rpx;
  773. height: 120rpx;
  774. color: #fff;
  775. text-align: center;
  776. display: flex;
  777. flex-direction: column;
  778. justify-content: center;
  779. align-items: center;
  780. .date {
  781. font-size: 40rpx;
  782. }
  783. .dot{
  784. width: 10rpx;
  785. height: 10rpx;
  786. background-color: rgba(255,150,0,1);
  787. border-radius: 999px;
  788. bottom: -5rpx;
  789. left: 50%;
  790. transform: translateX(-50%);
  791. }
  792. }
  793. .item-today {
  794. background-color: rgba(255, 255, 255, 1);
  795. position: relative;
  796. .date {
  797. color: rgba(22, 119, 255, 1);
  798. }
  799. .week {
  800. color: rgba(16, 16, 16, 1);
  801. }
  802. }
  803. }
  804. // 用电量
  805. .electricity-consumption {
  806. background-color: #fff;
  807. padding: 40rpx 32rpx 0rpx;
  808. border-radius: 8px;
  809. margin: -48rpx 32rpx 0;
  810. position: relative;
  811. border: 1px solid rgba(255,255,255,1);
  812. background: linear-gradient(180deg, rgba(187,216,255,1) 0%,rgba(255,255,255,1) 63%);
  813. // 统计
  814. .statistics-content{
  815. display: flex;
  816. align-items: center;
  817. justify-content: space-between;
  818. .statistics-item{
  819. width: 300rpx;
  820. padding: 24rpx 0 24rpx 24rpx;
  821. border-radius: 8px;
  822. box-shadow: 0px 0px 8px 0px rgba(22,119,255,0.3);
  823. background-color: #fff;
  824. }
  825. .item-title{
  826. color: rgba(22,119,255,1);
  827. font-size: 32rpx;
  828. display: flex;
  829. align-items: center;
  830. font-weight: bold;
  831. .img{
  832. width: 32rpx;
  833. height: 32rpx;
  834. vertical-align: middle;
  835. margin-right: 4rpx;
  836. }
  837. }
  838. .item-title2{
  839. color: rgba(129,97,255,1);
  840. }
  841. .item-value{
  842. color: rgba(16,16,16,1);
  843. font-size: 48rpx;
  844. font-weight: bold;
  845. margin-top: 8rpx;
  846. overflow: hidden;
  847. white-space: nowrap;
  848. text-overflow: ellipsis;
  849. text{
  850. display: inline-block;
  851. width: 80%;
  852. margin-right: 4rpx;
  853. }
  854. }
  855. }
  856. .title{
  857. display: flex;
  858. justify-content: space-between;
  859. .titleUnit{
  860. color: rgba(16,16,16,1);
  861. font-size: 36rpx;
  862. }
  863. .titleElectricity{
  864. color:#333333 100%;
  865. font-size: 28rpx;
  866. .spanradius{
  867. width: 20rpx;
  868. height: 20rpx;
  869. background-color: #FF7B00 ;
  870. color: #FF7B00 ;
  871. margin-right: 4rpx;
  872. border-radius: 50%; /* 将正方形变成圆形 */
  873. display: inline-block;
  874. }
  875. .normal{
  876. background-color: #00B962 ;
  877. color: #00B962 ;
  878. }
  879. }
  880. }
  881. .degree{
  882. display: flex;
  883. margin-top: 32rpx;
  884. .item{
  885. margin-right: 6rpx;
  886. text-align: center;
  887. .item-text{
  888. color: rgba(16,16,16,1);
  889. }
  890. .item-number{
  891. margin-top: 24rpx;
  892. width: 72rpx;
  893. height: 96rpx;
  894. background-color: rgba(16,16,16,1);
  895. color: #fff;
  896. font-size: 72rpx;
  897. }
  898. .decimal{
  899. background-color: #900005;
  900. }
  901. }
  902. }
  903. // .tab {
  904. // width: 240rpx;
  905. // height: 0;
  906. // border-width: 0px 48rpx 72rpx 0px;
  907. // border-radius: 8px 8px 0 0;
  908. // border-style: none solid solid none;
  909. // border-color: transparent transparent #fff;
  910. // position: absolute;
  911. // top: -72rpx;
  912. // left: 0rpx;
  913. // right: 0rpx;
  914. // color: #101010;
  915. // color: rgba(16, 16, 16, 1);
  916. // text-align: center;
  917. // line-height: 72rpx;
  918. // z-index: 999;
  919. // text-indent: 16rpx;
  920. // }
  921. // .tab2 {
  922. // width: 240rpx;
  923. // height: 0;
  924. // border-width: 0px 48rpx 72rpx 0px;
  925. // border-radius: 8px 8px 0 0;
  926. // border-style: none solid solid none;
  927. // border-color: transparent transparent #D4DBE4;
  928. // position: absolute;
  929. // top: -72rpx;
  930. // left: 210rpx;
  931. // right: 0rpx;
  932. // color: #777777;
  933. // text-align: center;
  934. // line-height: 72rpx;
  935. // text-indent: 16rpx;
  936. // }
  937. .radio {
  938. margin-top: 24rpx;
  939. padding-left: 8rpx;
  940. /deep/.u-radio {
  941. margin-bottom: 8px;
  942. min-width: 25% !important;
  943. }
  944. /deep/.u-radio__label{
  945. margin-left: 24rpx;
  946. font-size: 28rpx; ;
  947. }
  948. }
  949. }
  950. //各时段用电量
  951. .electricity-chart {
  952. margin: 24rpx 32rpx;
  953. padding: 40rpx 0rpx;
  954. background-color: #fff;
  955. border-radius: 8px;
  956. .title {
  957. display: flex;
  958. align-items: center;
  959. justify-content: space-between;
  960. padding: 0 32rpx;
  961. margin-bottom: 40rpx;
  962. .icon {
  963. width: 36rpx;
  964. height: 36rpx;
  965. background-color: rgba(22, 119, 255, 1);
  966. border: 6px solid rgba(182, 212, 255, 1);
  967. border-radius: 100px;
  968. }
  969. .text {
  970. display: flex;
  971. align-items: center;
  972. color: rgba(51, 51, 51, 1);
  973. font-size: 36rpx;
  974. margin-left: 16rpx;
  975. }
  976. .queryDayClass{
  977. border: 1px solid #999;
  978. border-radius: 3px;
  979. padding: 4rpx 8rpx;
  980. }
  981. }
  982. .chart {
  983. width: 100%;
  984. //height: 440rpx;
  985. .img {
  986. width: 100%;
  987. height: 440rpx;
  988. }
  989. }
  990. }
  991. // 设备信息弹窗
  992. .equipment-popup {
  993. .content {
  994. padding: 32rpx;
  995. .headline {
  996. color: rgba(16, 16, 16, 1);
  997. font-size: 36rpx;
  998. text-align: center;
  999. font-weight: bold;
  1000. margin-bottom: 24rpx;
  1001. }
  1002. .infos {
  1003. padding-bottom: 100rpx;
  1004. .item:last-of-type {
  1005. border: none;
  1006. }
  1007. .item {
  1008. display: flex;
  1009. align-items: center;
  1010. line-height: 48rpx;
  1011. padding: 24rpx 0;
  1012. border-bottom: 1px solid #cccccc;
  1013. .item-title {
  1014. color: rgba(51, 51, 51, 1);
  1015. width: 200rpx;
  1016. }
  1017. .item-value {
  1018. color: #666666;
  1019. flex: 1;
  1020. margin-left: 16rpx;
  1021. display: flex;
  1022. align-items: center;
  1023. justify-content: space-between;
  1024. .img{
  1025. width: 32rpx;
  1026. height: 32rpx;
  1027. transform: rotate(90deg);
  1028. margin-left: 96rpx;
  1029. }
  1030. }
  1031. }
  1032. }
  1033. .get {
  1034. height: 80rpx;
  1035. line-height: 80rpx;
  1036. border-radius: 4px;
  1037. background-color: rgba(22, 119, 255, 1);
  1038. color: rgba(255, 255, 255, 1);
  1039. font-size: 32rpx;
  1040. }
  1041. }
  1042. }
  1043. // 异常
  1044. .abnormal {
  1045. margin: 24rpx 32rpx;
  1046. padding: 40rpx 32rpx;
  1047. background-color: #fff;
  1048. border-radius: 8px;
  1049. .headline {
  1050. display: flex;
  1051. align-items: center;
  1052. justify-content: space-between;
  1053. }
  1054. .title {
  1055. display: flex;
  1056. align-items: center;
  1057. .icon {
  1058. width: 36rpx;
  1059. height: 36rpx;
  1060. background-color: rgba(22, 119, 255, 1);
  1061. border: 6px solid rgba(182, 212, 255, 1);
  1062. border-radius: 100px;
  1063. }
  1064. .text {
  1065. color: rgba(51, 51, 51, 1);
  1066. font-size: 36rpx;
  1067. margin-left: 16rpx;
  1068. }
  1069. }
  1070. .more {
  1071. color: #838383;
  1072. font-size: 24rpx
  1073. }
  1074. .details {
  1075. margin-top: 40rpx;
  1076. .item {
  1077. display: flex;
  1078. align-items: center;
  1079. justify-content: space-between;
  1080. margin-top: 32rpx;
  1081. .name {
  1082. color: rgba(51, 51, 51, 1);
  1083. }
  1084. .time {
  1085. color: rgba(119, 119, 119, 1);
  1086. font-size: 24rpx;
  1087. }
  1088. }
  1089. }
  1090. }
  1091. // 能源监测
  1092. .energy-inspection,.data-analysis {
  1093. margin: 24rpx 32rpx;
  1094. padding: 40rpx 32rpx;
  1095. background-color: #fff;
  1096. border-radius: 8px;
  1097. .title {
  1098. display: flex;
  1099. align-items: center;
  1100. .text {
  1101. color: rgba(51, 51, 51, 1);
  1102. font-size: 36rpx;
  1103. margin-left: 16rpx;
  1104. }
  1105. }
  1106. .grid {
  1107. .icon {
  1108. width: 128rpx;
  1109. height: 128rpx;
  1110. border-radius: 12px;
  1111. background-color: rgba(35, 186, 178, 1);
  1112. display: flex;
  1113. align-items: center;
  1114. justify-content: center;
  1115. margin-bottom: 16rpx;
  1116. .img {
  1117. width: 80rpx;
  1118. height: 80rpx;
  1119. }
  1120. }
  1121. .icon2{
  1122. background-color: rgba(42,186,72,1);
  1123. }
  1124. .icon3{
  1125. background-color: rgba(78,96,246,1);
  1126. }
  1127. .icon4{
  1128. background-color: rgba(22,119,255,1);
  1129. }
  1130. .icon5{
  1131. background-color: rgba(35,186,178,1);
  1132. }
  1133. .icon6{
  1134. background-color: rgba(42,186,72,1);
  1135. }
  1136. .icon7{
  1137. background-color: rgba(22,119,255,1);
  1138. }
  1139. .icon8{
  1140. background-color: rgba(35,186,178,1);
  1141. }
  1142. .grid-text {
  1143. color: #333333;
  1144. }
  1145. }
  1146. }
  1147. .icon-title{
  1148. width: 36rpx;
  1149. height: 36rpx;
  1150. background-color: rgba(182, 212, 255, 1);
  1151. border: 6px solid rgba(22, 119, 255, 1);
  1152. border-radius: 100px;
  1153. }
  1154. .equipment-information {
  1155. margin: 24rpx 32rpx;
  1156. padding: 40rpx 0rpx;
  1157. background-color: #fff;
  1158. border-radius: 8px;
  1159. .title {
  1160. display: flex;
  1161. align-items: center;
  1162. padding: 0 32rpx;
  1163. margin-bottom: 40rpx;
  1164. .text {
  1165. display: flex;
  1166. align-items: center;
  1167. color: rgba(51, 51, 51, 1);
  1168. font-size: 36rpx;
  1169. margin-left: 16rpx;
  1170. font-weight: bold;
  1171. }
  1172. .date {
  1173. margin-left: auto;
  1174. }
  1175. .more {
  1176. color: #838383;
  1177. font-size: 24rpx;
  1178. margin-left: auto;
  1179. }
  1180. }
  1181. .chart {
  1182. width: 100%;
  1183. height: 440rpx;
  1184. .img {
  1185. width: 100%;
  1186. height: 440rpx;
  1187. }
  1188. }
  1189. .infos {
  1190. padding: 0 32rpx;
  1191. display: flex;
  1192. justify-content: space-between;
  1193. text-align: center;
  1194. .border {
  1195. margin: auto 0;
  1196. height: 70rpx;
  1197. width: 2rpx;
  1198. background-color: rgba(204, 204, 204, 1);
  1199. ;
  1200. }
  1201. .item-title {
  1202. color: rgba(119, 119, 119, 1);
  1203. }
  1204. .item-value {
  1205. color: rgba(16, 16, 16, 1);
  1206. font-size: 32rpx;
  1207. margin-top: 16rpx;
  1208. }
  1209. }
  1210. }
  1211. // 远程控制电源开关
  1212. .control{
  1213. display: flex;
  1214. align-items: center;
  1215. justify-content: space-between;
  1216. margin: 24rpx 32rpx;
  1217. padding: 40rpx 32rpx;
  1218. background-color: #fff;
  1219. border-radius: 8px;
  1220. .text{
  1221. color: rgba(51,51,51,1);
  1222. font-size: 36rpx;
  1223. font-weight: bold;
  1224. }
  1225. .icon{
  1226. img{
  1227. width: 64rpx;
  1228. height: 64rpx;
  1229. }
  1230. }
  1231. }
  1232. </style>