electronicMonitoring.vue 33 KB

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