electronicMonitoring.vue 28 KB

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