electronicMonitoring.vue 32 KB

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