statistics.vue 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508
  1. <template>
  2. <view>
  3. <!-- 导航栏 -->
  4. <view class="navbar">
  5. <view class="title">
  6. 能源中心
  7. </view>
  8. <view class="icon" @click="toDataMonitoringList" v-if="codes.indexOf('detector') != -1">
  9. <image class="img" src="@/assets/img/riLine-equalizer-line.svg" mode=""></image>
  10. </view>
  11. </view>
  12. <!-- 标签 -->
  13. <view class="tabs-box">
  14. <view class="tabs" :style="{width: companyList.length>4 ? '' : '100%'}">
  15. <u-tabs :list="merchantList1" :is-scroll="false" active-color="#fff" inactive-color="#CCE2FF" bg-color="#1677FF"
  16. :current="current" @change="change"></u-tabs>
  17. </view>
  18. <view class="more" @click="popShow=true" v-if="companyList.length > 4">
  19. <u-icon name="arrow-down" color="#fff" size="40"></u-icon>
  20. </view>
  21. </view>
  22. <!-- 标签弹出层 -->
  23. <u-popup v-model="popShow" duration="10" mode="top" :negative-top="88" border-radius="16">
  24. <view class="popup-tabs">
  25. <view class="tabs">
  26. <u-tabs :list="merchantList1" :is-scroll="false" :current="current" @change="change"></u-tabs>
  27. </view>
  28. <view class="more">
  29. <u-icon name="arrow-up" color="#777777" size="40" @click="popShow=false"></u-icon>
  30. </view>
  31. </view>
  32. <view class="tabs-options">
  33. <view class="item" v-for="(item, index) in merchantList2" :key="index" @click="merchantChange(item,index)">
  34. {{item.name}}
  35. </view>
  36. </view>
  37. </u-popup>
  38. <view class="main">
  39. <!-- 统计1 -->
  40. <view class="statistics-1">
  41. <view class="item" @click="toDataMonitoringList">
  42. <view class="item-top">
  43. <view class="img-box">
  44. <u-circle-progress active-color="#2979ff" :percent="alarmsPercent" width="88">
  45. </u-circle-progress>
  46. </view>
  47. <view class="number">
  48. <view class="normal">
  49. 正常:{{alarmsForm.okNum}}台
  50. </view>
  51. <view class="abnormal">
  52. 异常:{{alarmsForm.errorNum}}台
  53. </view>
  54. </view>
  55. </view>
  56. <!-- 累计 -->
  57. <view class="total">
  58. 本月累计报警 <text class="total-number">{{alarmsForm.errorMonthNum}}</text> 次
  59. </view>
  60. </view>
  61. <view class="item" @click="toWorkOrderManagement()">
  62. <view class="item-top">
  63. <view class="img-box">
  64. <u-circle-progress active-color="#2979ff" :percent="0" width="88">
  65. </u-circle-progress>
  66. </view>
  67. <view class="number">
  68. <view class="normal">
  69. 未处理:0
  70. </view>
  71. <view class="abnormal">
  72. 已处理:0
  73. </view>
  74. </view>
  75. </view>
  76. <!-- 累计 -->
  77. <view class="total">
  78. 本月累计工单 <text class="total-number">0</text> 条
  79. </view>
  80. </view>
  81. </view>
  82. <!-- 用电量 -->
  83. <view class="statistics-e statistics" v-if="codes.indexOf('reading') != -1 && kWhList.length != 0">
  84. <view class="title">
  85. <view class="icon">
  86. <image class="img" src="@/assets/img/circleCopy1@1x.png" mode=""></image>
  87. </view>
  88. <view class="text">
  89. 用电量 (度)
  90. </view>
  91. <view class="change" @click="getPowerConsumption(1)">
  92. <image class="change-img" src="@/assets/img/refresh-line.svg" mode=""></image>
  93. <text>换一批</text>
  94. </view>
  95. <view class="check-all" @click="toEquipmentElectricity">
  96. 查看全部<u-icon name="arrow-right" size="24" color="#838383"></u-icon>
  97. </view>
  98. </view>
  99. <view class="electricity">
  100. <view class="item" v-for="(item, index) in kWhList" :key="index" @click="toElectronicMonitoring(item)">
  101. <view class="equipment">
  102. <view class="equipment1 equipment-text-overflow">
  103. {{item.name}}
  104. </view>
  105. <view class="equipment2 equipment-text-overflow">
  106. <view class="companyName">
  107. {{item.installationAddressSimple}}
  108. </view>
  109. </view>
  110. <!-- 离线 -->
  111. <view class="state" v-if="!item.online">
  112. <view class="dot off-line"></view>
  113. <view class="text">离线</view>
  114. </view>
  115. <!-- 在线 -->
  116. <view class="state state2" v-else>
  117. <view class="dot on-line"></view>
  118. <view class="text">在线</view>
  119. </view>
  120. </view>
  121. <view class="electricity">
  122. <view class="electricity-item electricity-item-day">
  123. <view class="number">
  124. {{item.thisDayKwh}}
  125. </view>
  126. <view class="date">
  127. 今日
  128. </view>
  129. </view>
  130. <view class="electricity-item">
  131. <view class="number">
  132. {{item.thisMonthKwh}}
  133. </view>
  134. <view class="date">
  135. 本月
  136. </view>
  137. </view>
  138. <view class="electricity-item">
  139. <view class="number">
  140. {{item.lastMonthKwh}}
  141. </view>
  142. <view class="date">
  143. 上月
  144. </view>
  145. </view>
  146. <!-- 箭头 -->
  147. <view class="more">
  148. <u-icon name="arrow-right" color="#d4d4d4" size="24"></u-icon>
  149. </view>
  150. </view>
  151. </view>
  152. </view>
  153. </view>
  154. <!-- 统计2 异常告警记录 -->
  155. <view class="statistics-2 statistics" v-if="abnormalRecordsList.length != 0">
  156. <view class="title">
  157. <view class="icon">
  158. <image class="img" src="@/assets/img/circleCopy1@1x.png" mode=""></image>
  159. </view>
  160. <view class="text">
  161. 异常告警记录
  162. </view>
  163. <view class="check-all" @click="gotoUrl('/pages/abnormal/abnormalAlarmRecord?id='+companyId)">
  164. 查看全部<u-icon name="arrow-right" size="24" color="#838383"></u-icon>
  165. </view>
  166. </view>
  167. <!-- 异常 -->
  168. <view class="abnormal-item" v-for="(item, index) in abnormalRecordsList" :key="index"
  169. @click="gotoUrl('/pages/abnormal/abnormalAlarmDetails?id='+item.id)">
  170. <view class="item-title">
  171. <!-- <image class="img" src="@/assets/img/riFill-error-warning-fill 1.svg"></image> -->
  172. <view class="name">
  173. {{item.configName}}
  174. </view>
  175. <view class="date">
  176. {{item.createTime}}
  177. </view>
  178. </view>
  179. <view class="item-value">
  180. <view class="value-content">
  181. <view class="value1">
  182. {{item.meterName}}
  183. </view>
  184. <view class="value2">
  185. {{item.installationAddressSimple}}
  186. </view>
  187. </view>
  188. <!-- 箭头 -->
  189. <view class="more">
  190. <u-icon name="arrow-right" color="#d4d4d4" size="24"></u-icon>
  191. </view>
  192. </view>
  193. </view>
  194. </view>
  195. <!-- 统计3 设备数据监测-->
  196. <view class="statistics-3 statistics" v-if="codes.indexOf('detector')!=-1 && deviceList.length!=0">
  197. <view class="title">
  198. <view class="icon">
  199. <image class="img" src="@/assets/img/circleCopy1@1x.png" mode=""></image>
  200. </view>
  201. <view class="text">
  202. 设备数据监测
  203. </view>
  204. <view class="change" @click="getEquipmentDataMonitoring(1)">
  205. <image class="change-img" src="@/assets/img/refresh-line.svg" mode=""></image>
  206. <text>换一批</text>
  207. </view>
  208. <view class="check-all" @click="toDataMonitoringList">
  209. 查看全部<u-icon name="arrow-right" size="24" color="#838383"></u-icon>
  210. </view>
  211. </view>
  212. <view class="monitoring-item" v-for="(item, index) in deviceList" :key="index"
  213. @click="toElectronicMonitoring(item)">
  214. <view class="item-title">
  215. <view class="text1">
  216. {{item.name}}
  217. </view>
  218. <view class="state">
  219. <view class="state1">
  220. <view class="icon">
  221. <image class="img" src="@/assets/img/antFill-alert.svg" mode=""></image>
  222. </view>
  223. {{item.temperatureStatus=='1' ? '正常' : '异常'}}
  224. </view>
  225. <view class="state2">
  226. <view class="icon">
  227. <image class="img" src="@/assets/img/smoke.svg" mode=""></image>
  228. </view>
  229. {{item.smokeStatus=='1' ? '正常' : '异常'}}
  230. </view>
  231. <!-- 箭头 -->
  232. <view class="more">
  233. <u-icon name="arrow-right" color="#d4d4d4" size="24"></u-icon>
  234. </view>
  235. </view>
  236. </view>
  237. <view class="company-name">
  238. {{item.installationAddressSimple}}
  239. <!-- 离线 -->
  240. <view class="state" v-if="!item.online">
  241. <text class="off-line"></text>离线
  242. </view>
  243. <!-- 在线 -->
  244. <view class="state state2" v-else>
  245. <text class="on-line"></text>在线
  246. </view>
  247. </view>
  248. <!-- 监控信息 -->
  249. <view class="infos" v-if="item.remoteMonitorRecord != null">
  250. <view class="infos-item">
  251. <view class="icon">
  252. 当前电流:
  253. <!-- <img src="../../assets/img/iconPark-electric-wave 1.svg" alt="" /> -->
  254. </view>
  255. <view class="text">
  256. {{item.remoteMonitorRecord.dcaTotal.toFixed(2)}}A
  257. </view>
  258. </view>
  259. <view class="infos-item">
  260. <view class="icon">
  261. 当前电压:
  262. <!-- <img src="../../assets/img/voltage.svg" alt="" /> -->
  263. </view>
  264. <view class="text">
  265. {{item.remoteMonitorRecord.dcvTop.toFixed(2)}}V
  266. </view>
  267. </view>
  268. <view class="infos-item">
  269. <view class="icon">
  270. 当前温度:
  271. <!-- <img src="../../assets/img/iconPark-thermometer.svg" alt="" /> -->
  272. </view>
  273. <view class="text">
  274. {{item.remoteMonitorRecord.temperatureTop}}℃
  275. </view>
  276. </view>
  277. <view class="infos-item">
  278. <view class="icon">
  279. 当前功率:
  280. <!-- <img src="../../assets/img/power.svg" alt="" /> -->
  281. </view>
  282. <view class="text">
  283. {{(item.remoteMonitorRecord.totalPower).toFixed(2)}}kW
  284. </view>
  285. </view>
  286. <view class="infos-item">
  287. <view class="icon">
  288. 当前功率因数:
  289. <!-- <img src="../../assets/img/powerFactor.svg" alt="" /> -->
  290. </view>
  291. <view class="text">
  292. {{item.remoteMonitorRecord.dcfTop.toFixed(2)}}
  293. </view>
  294. </view>
  295. <view class="infos-item">
  296. <view class="icon">
  297. 平均功率因数:
  298. </view>
  299. <view class="text">
  300. {{item.remoteMonitorRecord.averPowerFactor.toFixed(2)}}
  301. </view>
  302. </view>
  303. </view>
  304. </view>
  305. </view>
  306. <!--设备状态-->
  307. <view class="statistics-4 statistics">
  308. <view class="title">
  309. <view class="icon">
  310. <image class="img" src="@/assets/img/circleCopy1@1x.png" mode=""></image>
  311. </view>
  312. <view class="text">
  313. 设备状态
  314. </view>
  315. </view>
  316. <view class="chat">
  317. <view id="pieEcharts" style="min-height:620rpx;">
  318. </view>
  319. </view>
  320. </view>
  321. <!-- 故障类型 -->
  322. <view class="statistics-5 statistics" v-if="false">
  323. <view class="title">
  324. <view class="icon">
  325. <image class="img" src="@/assets/img/circleCopy1@1x.png" mode=""></image>
  326. </view>
  327. <view class="text">
  328. 故障类型
  329. </view>
  330. </view>
  331. <view class="chat">
  332. <view id="barEcharts" style="min-height:410rpx;">
  333. </view>
  334. </view>
  335. </view>
  336. <!-- 工单处理 -->
  337. <view class="statistics-6 statistics" v-if="false">
  338. <view class="title">
  339. <view class="icon">
  340. <image class="img" src="@/assets/img/circleCopy1@1x.png" mode=""></image>
  341. </view>
  342. <view class="text">
  343. 工单处理
  344. </view>
  345. </view>
  346. <view class="chat">
  347. <view id="lineEcharts" style="min-height:410rpx;">
  348. </view>
  349. </view>
  350. </view>
  351. <!-- 异常设备排名 -->
  352. <view class="statistics statistics-ranking" v-if="false">
  353. <view class="title">
  354. <view class="icon">
  355. <image class="img" src="@/assets/img/circleCopy1@1x.png" mode=""></image>
  356. </view>
  357. <view class="text">
  358. 异常设备排名
  359. </view>
  360. </view>
  361. <!-- 合计 -->
  362. <view class="total">
  363. 本年度共有<text> 42</text>次设备异常告警
  364. </view>
  365. <view class="ranking-main">
  366. <view class="item" @click="gotoUrl('/pages/equipmentDataMonitoring/electronicMonitoring?id='+'&name=')">
  367. <view class="ranking">
  368. 1
  369. </view>
  370. <view class="icon">
  371. <image class="img" src="@/assets/img/transformer1.svg" mode=""></image>
  372. </view>
  373. <view class="name">
  374. <view class="name1">
  375. 荆鹏软件园01
  376. </view>
  377. <view class="name2">
  378. 荆鹏集团
  379. </view>
  380. </view>
  381. <view class="time">
  382. 5次
  383. </view>
  384. </view>
  385. </view>
  386. <!-- 查看全部排名 -->
  387. <view class="check-all" @click="gotoUrl('/pages/abnormal/abnormalDeviceRanking')">
  388. 查看全部排名 <u-icon name="arrow-down" size="24" color="rgba(119,119,119,1)"></u-icon>
  389. </view>
  390. </view>
  391. </view>
  392. <energyCenterTabbar :current="0"></energyCenterTabbar>
  393. </view>
  394. </template>
  395. <script>
  396. import energyCenterTabbar from '@/components/energyCenterTabbar.vue'
  397. import * as echarts from 'echarts';
  398. import * as API from '@/apis/pagejs/index.js'
  399. export default {
  400. components: {
  401. energyCenterTabbar
  402. },
  403. data() {
  404. return {
  405. abnormalRecordsList: [], // 异常告警记录
  406. queryDate: '',
  407. alarmsPercent: 0,
  408. alarmsForm: {
  409. okNum: 0,
  410. errorNum: 0,
  411. errorMonthNum: 0
  412. }, // 累计报警
  413. companyId: '', // 商户ID
  414. pageIndexe: 1, // 设备数据检测
  415. totalPagee: 1,
  416. deviceList: [],
  417. pageIndexp: 1, // 用电量
  418. totalPagep: 1,
  419. kWhList: [],
  420. codes: '', // 判断:reading用电量 detector设备数据检测
  421. merchantList1: [], // 商户
  422. merchantList2: [],
  423. companyList: [],
  424. popShow: false,
  425. current: 0,
  426. myLineChart: null, // 图表
  427. myBarChart: null,
  428. myPieChart: null,
  429. intervalId: null, // 用于存储间隔ID
  430. intervalReady: true, // 用于存储间隔ID
  431. }
  432. },
  433. onLoad() {
  434. var date = new Date();
  435. var year = date.getFullYear();
  436. var month = date.getMonth() + 1 >= 10 ? date.getMonth() + 1 : '0' + (date.getMonth() + 1);
  437. this.queryDate = year + '-' + month;
  438. this.getPowerConsumption(0);
  439. this.getEquipmentDataMonitoring(0);
  440. this.getCompanyInfoList();
  441. this.getAccumulatedAlarms();
  442. this.getAbnormalAlarmRecord();
  443. },
  444. onReady() {
  445. this.getfindByOpenId();
  446. this.getHomePageDeviceStatus();
  447. // this.getBarCharts();
  448. // this.getLineCharts();
  449. },
  450. beforeDestroy() {
  451. this.clearTimer(); // 组件销毁前清除定时器
  452. this.intervalReady = false;
  453. console.log("组件销毁前清除定时器")
  454. },
  455. methods: {
  456. clearTimer() {
  457. if (this.intervalId) {
  458. clearInterval(this.intervalId); // 清除定时器
  459. this.intervalId = null; // 重置定时器ID
  460. }
  461. },
  462. startInterval() {
  463. this.clearTimer(); // 组件销毁前清除定时器
  464. this.intervalId = setInterval(() => {
  465. // 每隔5秒运行的代码
  466. // console.log('这段代码每隔5秒运行一次');
  467. this.getPowerConsumption(0, true)
  468. }, 60000);
  469. },
  470. merchantChange(item, index) {
  471. var m = item;
  472. var n = this.merchantList1[this.current];
  473. this.merchantList1[this.current] = m;
  474. this.merchantList2[index] = n;
  475. this.companyId = item.id;
  476. this.getPowerConsumption(0);
  477. this.getEquipmentDataMonitoring(0);
  478. this.getAccumulatedAlarms();
  479. this.getHomePageDeviceStatus();
  480. this.getAbnormalAlarmRecord();
  481. this.popShow = false;
  482. },
  483. // 单位
  484. getCompanyInfoList() {
  485. this.merchantList1 = [];
  486. this.merchantList2 = [];
  487. uni.showLoading({
  488. title: "加载中",
  489. mask: true,
  490. })
  491. API.deviceCompanyList().then((response) => {
  492. uni.hideLoading();
  493. this.companyList = response.data.companyInfoList;
  494. var list = response.data.companyInfoList;
  495. // for (var i = 0; i < list.length; i++) {
  496. // list[i].name = list[i].fullName;
  497. // }
  498. if (list.length > 3) {
  499. this.merchantList1.push(list.slice(0, 3));
  500. this.merchantList2.push(list.slice(3));
  501. } else {
  502. this.merchantList1 = list;
  503. }
  504. if (list.length > 1) {
  505. this.merchantList1.unshift({
  506. id: '',
  507. name: '全部'
  508. });
  509. }
  510. }).catch(error => {
  511. uni.showToast({
  512. title: error,
  513. icon: "none"
  514. })
  515. })
  516. },
  517. // 商户ID
  518. getfindByOpenId() {
  519. uni.showLoading({
  520. title: "加载中",
  521. mask: true,
  522. })
  523. API.findByOpenId({
  524. openId: this.carhelp.getOpenId()
  525. }).then((response) => {
  526. uni.hideLoading();
  527. this.codes = response.data.regUser.codes;
  528. }).catch(error => {
  529. uni.showToast({
  530. title: error,
  531. icon: "none"
  532. })
  533. })
  534. },
  535. // 设备数据监测
  536. getEquipmentDataMonitoring(pl) {
  537. this.pageIndexe = this.pageIndexe + pl;
  538. if (this.pageIndexe > this.totalPagee) {
  539. this.pageIndexe = 1;
  540. }
  541. uni.showLoading({
  542. title: "加载中",
  543. mask: true,
  544. })
  545. API.homePageDeviceData({
  546. pageIndex: this.pageIndexe,
  547. pageSize: 5,
  548. companyId: this.companyId
  549. }).then((response) => {
  550. uni.hideLoading();
  551. this.deviceList = response.data.data;
  552. this.totalPagee = response.data.totalPage;
  553. }).catch(error => {
  554. uni.showToast({
  555. title: error,
  556. icon: "none"
  557. })
  558. })
  559. },
  560. // 异常告警记录
  561. getAbnormalAlarmRecord() {
  562. uni.showLoading({
  563. title: "加载中",
  564. mask: true,
  565. })
  566. API.alarmRecord({
  567. queryDate: this.queryDate,
  568. configId: '',
  569. pageIndex: 1,
  570. pageSize: 3,
  571. companyId: this.companyId
  572. }).then((response) => {
  573. uni.hideLoading();
  574. this.abnormalRecordsList = response.data.data;
  575. }).catch(error => {
  576. uni.showToast({
  577. title: error,
  578. icon: "none"
  579. })
  580. })
  581. },
  582. // 用电量
  583. getPowerConsumption(pl, interval) {
  584. this.pageIndexp = this.pageIndexp + pl;
  585. if (this.pageIndexp > this.totalPagep) {
  586. this.pageIndexp = 1;
  587. }
  588. if (!interval) {
  589. uni.showLoading({
  590. title: "加载中",
  591. mask: true,
  592. })
  593. }
  594. API.homePageKwh({
  595. pageIndex: this.pageIndexp,
  596. pageSize: 5,
  597. companyId: this.companyId
  598. }).then((response) => {
  599. if (!interval) {
  600. uni.hideLoading();
  601. }
  602. this.kWhList = response.data.data;
  603. this.totalPagep = response.data.totalPage;
  604. if (!interval) {
  605. this.startInterval(); // 组件挂载后开始间隔
  606. }
  607. }).catch(error => {
  608. uni.showToast({
  609. title: error,
  610. icon: "none"
  611. })
  612. })
  613. },
  614. // 累计工单
  615. getAccumulatedWorkOrders() {
  616. },
  617. // 累计报警
  618. getAccumulatedAlarms() {
  619. uni.showLoading({
  620. title: "加载中",
  621. mask: true,
  622. })
  623. API.deviceStatus({
  624. companyId: this.companyId
  625. }).then((response) => {
  626. uni.hideLoading();
  627. this.alarmsForm = response.data;
  628. if (this.alarmsForm.okNum != 0) {
  629. this.alarmsPercent = this.alarmsForm.okNum / (this.alarmsForm.okNum + this.alarmsForm.errorNum) * 100;
  630. }
  631. }).catch(error => {
  632. uni.showToast({
  633. title: error,
  634. icon: "none"
  635. })
  636. })
  637. },
  638. // 工单处理
  639. getLineCharts() {
  640. if (!this.myLineChart) {
  641. this.myLineChart = echarts.init(document.getElementById('lineEcharts'));
  642. }
  643. var option = {
  644. tooltip: {
  645. trigger: 'axis',
  646. axisPointer: {
  647. type: 'shadow'
  648. }
  649. },
  650. legend: {
  651. data: ['新增工单', '处理工单', '剩余工单']
  652. },
  653. grid: {
  654. left: '3%',
  655. right: '4%',
  656. bottom: '3%',
  657. containLabel: true
  658. },
  659. xAxis: {
  660. type: 'category',
  661. data: ['1日', '2日', '3日', '4日', '5日', '6日']
  662. },
  663. yAxis: {
  664. type: 'value'
  665. },
  666. series: [{
  667. name: '新增工单',
  668. type: 'line',
  669. data: [2, 1, 0, 1, 3, 0],
  670. itemStyle: {
  671. color: '#FF3D00'
  672. }
  673. },
  674. {
  675. name: '处理工单',
  676. type: 'line',
  677. data: [3, 1, 1, 0, 2, 1],
  678. itemStyle: {
  679. color: '#FF7B00'
  680. }
  681. },
  682. {
  683. name: '剩余工单',
  684. type: 'line',
  685. data: [5, 2, 1, 1, 5, 1],
  686. itemStyle: {
  687. color: '#58A55C'
  688. }
  689. }
  690. ]
  691. };
  692. this.myLineChart.setOption(option);
  693. },
  694. // 故障类型
  695. getBarCharts() {
  696. if (!this.myBarChart) {
  697. this.myBarChart = echarts.init(document.getElementById('barEcharts'));
  698. }
  699. var option = {
  700. tooltip: {
  701. trigger: 'axis',
  702. axisPointer: {
  703. type: 'shadow'
  704. }
  705. },
  706. legend: {},
  707. grid: {
  708. left: '3%',
  709. right: '4%',
  710. bottom: '3%',
  711. containLabel: true
  712. },
  713. xAxis: [{
  714. type: 'category',
  715. data: ['一月', '二月', '三月']
  716. }],
  717. yAxis: [{
  718. type: 'value'
  719. }],
  720. barGap: '0',
  721. series: [{
  722. name: '温度异常',
  723. type: 'bar',
  724. data: [100, 140, 230],
  725. itemStyle: {
  726. color: '#FF3D00'
  727. }
  728. },
  729. {
  730. name: '电压异常',
  731. type: 'bar',
  732. data: [150, 100, 200],
  733. itemStyle: {
  734. color: '#FF7B00'
  735. }
  736. },
  737. {
  738. name: '功率因素异常',
  739. type: 'bar',
  740. data: [50, 80, 100],
  741. itemStyle: {
  742. color: '#FFAE00'
  743. }
  744. }
  745. ]
  746. };
  747. this.myBarChart.setOption(option);
  748. },
  749. // 设备状态
  750. getHomePageDeviceStatus() {
  751. uni.showLoading({
  752. title: "加载中",
  753. mask: true,
  754. })
  755. API.homePageDeviceStatus({
  756. companyId: this.companyId
  757. }).then((response) => {
  758. uni.hideLoading();
  759. var list = response.data;
  760. this.getPieCharts(list);
  761. }).catch(error => {
  762. uni.showToast({
  763. title: error,
  764. icon: "none"
  765. })
  766. })
  767. },
  768. getPieCharts(list) {
  769. if (!this.myPieChart) {
  770. this.myPieChart = echarts.init(document.getElementById('pieEcharts'), null, {
  771. width: uni.upx2px(700),
  772. height: uni.upx2px(620)
  773. });
  774. }
  775. this.myPieChart.clear();
  776. var data = [{
  777. value: 1,
  778. name: '温度异常',
  779. itemStyle: {
  780. color: '#FF4F3F'
  781. }
  782. },
  783. {
  784. value: 1,
  785. name: '烟感异常',
  786. itemStyle: {
  787. color: '#FF7B00'
  788. }
  789. },
  790. {
  791. value: 1,
  792. name: '正常运行',
  793. itemStyle: {
  794. color: '#1677FF'
  795. }
  796. },
  797. {
  798. value: 1,
  799. name: '设备异常',
  800. itemStyle: {
  801. color: '#F2BD42'
  802. }
  803. },
  804. {
  805. value: 1,
  806. name: '设备离线',
  807. itemStyle: {
  808. color: '#C2C2C2'
  809. }
  810. },
  811. ];
  812. var data2 = [];
  813. if (list) {
  814. data[0].value = list.errorTemperatureNum; //温度异常
  815. data[1].value = list.errorSmokeNum; //烟感异常
  816. data[2].value = list.okNum; //正常运行
  817. data[3].value = list.errorDeviceNum; //设备异常
  818. data[4].value = list.errorOnlineNum; //设备离线
  819. for (var i = 0; i < data.length; i++) {
  820. if (data[i].value != 0) {
  821. data2.push(data[i]);
  822. }
  823. }
  824. }
  825. var option = {
  826. tooltip: {
  827. trigger: 'item'
  828. },
  829. legend: {
  830. left: 'center'
  831. },
  832. series: [{
  833. type: 'pie',
  834. top: '6%',
  835. left: '3%',
  836. right: '8%',
  837. bottom: '8%',
  838. radius: ['45%', '60%'],
  839. label: {
  840. formatter: '{name|{b}}\n{value|{c}}',
  841. fontSize: 12,
  842. position: 'outer',
  843. bleedMargin: 5,
  844. rich: {
  845. name: {
  846. align: 'left'
  847. },
  848. value: {
  849. align: 'left'
  850. }
  851. }
  852. },
  853. emphasis: {
  854. label: {
  855. itemStyle: {
  856. shadowBlur: 10,
  857. shadowOffsetX: 0,
  858. shadowColor: 'rgba(0, 0, 0, 0.5)'
  859. }
  860. }
  861. },
  862. data: data2
  863. }]
  864. };
  865. this.myPieChart.setOption(option);
  866. },
  867. change(index) {
  868. this.current = index;
  869. this.companyId = this.merchantList1[index].id;
  870. this.getPowerConsumption(0);
  871. this.getEquipmentDataMonitoring(0);
  872. this.getAccumulatedAlarms();
  873. this.getHomePageDeviceStatus();
  874. this.getAbnormalAlarmRecord();
  875. },
  876. toDataMonitoringList() {
  877. uni.navigateTo({
  878. url: '/pages/equipmentDataMonitoring/dataMonitoring-list'
  879. })
  880. },
  881. toWorkOrderManagement() {
  882. return
  883. uni.navigateTo({
  884. url: '/pages/workOrderManagement/workOrderManagement'
  885. })
  886. },
  887. toEquipmentElectricity() {
  888. uni.navigateTo({
  889. url: '/pages/equipmentDataMonitoring/equipmentElectricity'
  890. })
  891. },
  892. toElectronicMonitoring(item) {
  893. uni.navigateTo({
  894. url: '/pages/equipmentDataMonitoring/electronicMonitoring?id=' + item.id + '&name=' + item.name +
  895. '&companyId=' + item.companyId
  896. })
  897. }
  898. }
  899. }
  900. </script>
  901. <style lang="scss" scoped>
  902. page {
  903. padding-bottom: 200rpx;
  904. }
  905. /deep/.u-drawer-content {
  906. margin-top: 88rpx;
  907. }
  908. .popup-tabs {
  909. background-color: #fff;
  910. display: flex;
  911. align-items: center;
  912. justify-content: space-between;
  913. padding-top: 32rpx;
  914. padding-right: 32rpx;
  915. color: rgba(51, 51, 51, 1);
  916. font-size: 32rpx;
  917. .tabs {
  918. width: 88%;
  919. }
  920. }
  921. /deep/.u-tab-item {
  922. width: 25% !important;
  923. flex: none !important;
  924. }
  925. .tabs-options {
  926. display: flex;
  927. padding: 24rpx 32rpx 0;
  928. flex-wrap: wrap;
  929. .item {
  930. width: 25%;
  931. margin-bottom: 40rpx;
  932. }
  933. }
  934. // 导航栏
  935. .navbar {
  936. background-color: rgba(22, 119, 255, 1);
  937. color: #fff;
  938. line-height: 88rpx;
  939. display: flex;
  940. justify-content: space-between;
  941. align-items: center;
  942. padding: 0 32rpx;
  943. color: rgba(255, 255, 255, 1);
  944. font-size: 36rpx;
  945. position: fixed;
  946. left: 0;
  947. right: 0;
  948. top: 0;
  949. z-index: 999999;
  950. .img {
  951. width: 48rpx;
  952. height: 48rpx;
  953. vertical-align: middle;
  954. }
  955. }
  956. // 标签
  957. .tabs-box {
  958. padding: 32rpx 0;
  959. margin-top: 88rpx;
  960. padding-right: 32rpx;
  961. background-color: rgba(22, 119, 255, 1);
  962. display: flex;
  963. align-items: center;
  964. justify-content: space-between;
  965. .tabs {
  966. width: 88%;
  967. }
  968. }
  969. .main {
  970. border-radius: 16px 16px 0px 0px;
  971. background: linear-gradient(180deg, rgba(242, 244, 246, 1) 61%, rgba(255, 255, 255, 0) 100%);
  972. margin-top: -24rpx;
  973. padding: 32rpx;
  974. .statistics {
  975. border-radius: 8px;
  976. background-color: rgba(255, 255, 255, 1);
  977. box-shadow: 0px 1px 6px 0px rgba(0, 59, 142, 0.05);
  978. margin-top: 24rpx;
  979. padding: 40rpx;
  980. .title {
  981. display: flex;
  982. align-items: center;
  983. margin-bottom: 20rpx;
  984. .img {
  985. width: 36rpx;
  986. height: 36rpx;
  987. vertical-align: middle;
  988. border-radius: 999px;
  989. }
  990. .change {
  991. display: flex;
  992. align-items: center;
  993. .change-img {
  994. width: 32rpx;
  995. height: 32rpx;
  996. vertical-align: middle;
  997. }
  998. text {
  999. margin-left: 8rpx;
  1000. }
  1001. }
  1002. .text {
  1003. color: rgba(16, 16, 16, 1);
  1004. font-size: 36rpx;
  1005. margin-left: 16rpx;
  1006. font-weight: bold;
  1007. }
  1008. .change {
  1009. margin-left: 16rpx;
  1010. font-size: 24rpx;
  1011. color: #838383;
  1012. }
  1013. .check-all {
  1014. margin-left: auto;
  1015. color: rgba(131, 131, 131, 1);
  1016. font-size: 24rpx;
  1017. }
  1018. }
  1019. }
  1020. // 用电量
  1021. .statistics-e {
  1022. padding:40rpx 20rpx;
  1023. .title{
  1024. padding:0 20rpx;
  1025. }
  1026. .electricity {
  1027. background-color: #fff;
  1028. .item {
  1029. padding: 16rpx 0;
  1030. display: flex;
  1031. align-items: center;
  1032. border-bottom: 1px solid rgba(245, 245, 245, 1);
  1033. .equipment {
  1034. width: 40%;
  1035. // .equipment-text-overflow {
  1036. // display: -webkit-box;
  1037. // -webkit-box-orient: vertical;
  1038. // -webkit-line-clamp: 1;
  1039. // overflow: hidden;
  1040. // }
  1041. .equipment1 {
  1042. color: rgba(51, 51, 51, 1);
  1043. font-size: 32rpx;
  1044. font-weight: bold;
  1045. white-space: nowrap;
  1046. overflow: hidden;
  1047. text-overflow: ellipsis;
  1048. }
  1049. .equipment2 {
  1050. color: rgba(119, 119, 119, 1);
  1051. display: flex;
  1052. .companyName {
  1053. width: 100%;
  1054. white-space: nowrap;
  1055. overflow: hidden;
  1056. text-overflow: ellipsis;
  1057. }
  1058. }
  1059. }
  1060. .state {
  1061. width: 100%;
  1062. padding-right: 32rpx;
  1063. display: flex;
  1064. align-items: center;
  1065. color: rgba(255, 123, 0, 1);
  1066. text-align: right;
  1067. .dot {
  1068. margin-right: 8rpx;
  1069. width: 16rpx;
  1070. height: 16rpx;
  1071. background-color: rgba(255, 123, 0, 1);
  1072. border-radius: 999px;
  1073. margin-left: auto;
  1074. }
  1075. .off-line {
  1076. background-color: rgba(255, 123, 0, 1);
  1077. }
  1078. .on-line {
  1079. background-color: rgba(0, 185, 98, 1);
  1080. }
  1081. }
  1082. .state2 {
  1083. color: rgba(0, 185, 98, 1);
  1084. }
  1085. .electricity {
  1086. display: flex;
  1087. justify-content: space-between;
  1088. align-items: center;
  1089. flex: 1;
  1090. margin-left: 4rpx;
  1091. text-align: center;
  1092. .electricity-item {
  1093. width: 37.5%;
  1094. .number {
  1095. color: rgba(51, 51, 51, 1);
  1096. font-size: 32rpx;
  1097. font-weight: bold;
  1098. height: 40rpx;
  1099. line-height: 40rpx;
  1100. }
  1101. .date {
  1102. color: rgba(119, 119, 119, 1);
  1103. margin-top: 4rpx;
  1104. }
  1105. }
  1106. .electricity-item-day{
  1107. width: 25%;
  1108. }
  1109. }
  1110. }
  1111. }
  1112. }
  1113. // 统计1
  1114. .statistics-1 {
  1115. display: flex;
  1116. align-items: center;
  1117. justify-content: space-between;
  1118. .item {
  1119. width: 330rpx;
  1120. padding: 24rpx;
  1121. box-shadow: 0px 1px 6px 0px rgba(0, 59, 142, 0.05);
  1122. border-radius: 8px;
  1123. background-color: rgba(255, 255, 255, 1);
  1124. .item-top {
  1125. display: flex;
  1126. align-items: center;
  1127. .img {
  1128. width: 88rpx;
  1129. height: 88rpx;
  1130. margin-right: 24rpx;
  1131. vertical-align: middle;
  1132. }
  1133. .number {
  1134. color: rgba(51, 51, 51, 1);
  1135. font-size: 32rpx;
  1136. .normal {
  1137. margin-bottom: 12rpx;
  1138. }
  1139. }
  1140. }
  1141. .total {
  1142. margin-top: 28rpx;
  1143. text-align: center;
  1144. color: rgba(119, 119, 119, 1);
  1145. }
  1146. .total-number {
  1147. color: #EE3138;
  1148. margin: 0 8rpx;
  1149. }
  1150. }
  1151. }
  1152. // 统计2异常报警记录
  1153. .statistics-2 {
  1154. .abnormal-item {
  1155. display: flex;
  1156. justify-content: space-between;
  1157. align-items: center;
  1158. padding: 16rpx;
  1159. border-bottom: 1px solid rgba(245, 245, 245, 1);
  1160. .item-title {
  1161. color: rgba(51, 51, 51, 1);
  1162. .img {
  1163. width: 32rpx;
  1164. height: 32rpx;
  1165. margin-right: 8rpx;
  1166. }
  1167. .name {
  1168. color: rgba(51, 51, 51, 1);
  1169. }
  1170. .date {
  1171. color: rgba(119, 119, 119, 1);
  1172. font-size: 24rpx;
  1173. }
  1174. }
  1175. .item-value {
  1176. text-align: right;
  1177. display: flex;
  1178. align-items: center;
  1179. .more {
  1180. margin-left: 8rpx;
  1181. }
  1182. .value1 {
  1183. font-weight: bold;
  1184. color: rgba(51, 51, 51, 1);
  1185. }
  1186. .value2 {
  1187. color: rgba(119, 119, 119, 1);
  1188. font-size: 24rpx;
  1189. }
  1190. }
  1191. }
  1192. }
  1193. // 统计3设备实时监控
  1194. .statistics-3 {
  1195. .monitoring-item {
  1196. padding: 16rpx 0;
  1197. border-bottom: 1px solid rgba(245, 245, 245, 1);
  1198. .item-title {
  1199. display: flex;
  1200. align-items: center;
  1201. .text1 {
  1202. color: rgba(51, 51, 51, 1);
  1203. }
  1204. }
  1205. .company-name {
  1206. color: rgba(119, 119, 119, 1);
  1207. font-size: 24rpx;
  1208. display: flex;
  1209. align-items: center;
  1210. .state {
  1211. margin-left: 12rpx;
  1212. display: flex;
  1213. align-items: center;
  1214. color: rgba(255, 123, 0, 1);
  1215. text {
  1216. margin-right: 8rpx;
  1217. display: inline-block;
  1218. width: 16rpx;
  1219. height: 16rpx;
  1220. border-radius: 999px;
  1221. }
  1222. .off-line {
  1223. background-color: rgba(255, 123, 0, 1);
  1224. }
  1225. .on-line {
  1226. background-color: rgba(0, 185, 98, 1);
  1227. }
  1228. }
  1229. .state2 {
  1230. color: rgba(0, 185, 98, 1);
  1231. }
  1232. }
  1233. .state {
  1234. margin-left: auto;
  1235. display: flex;
  1236. .state1,
  1237. .state2 {
  1238. display: flex;
  1239. align-items: center;
  1240. margin-left: 24rpx;
  1241. }
  1242. .more {
  1243. margin-left: 8rpx;
  1244. }
  1245. .img {
  1246. width: 32rpx;
  1247. height: 32rpx;
  1248. vertical-align: middle;
  1249. margin-right: 8rpx;
  1250. }
  1251. }
  1252. // 监控信息
  1253. .infos {
  1254. margin-top: 8rpx;
  1255. display: flex;
  1256. align-items: center;
  1257. justify-content: space-between;
  1258. flex-wrap: wrap;
  1259. .infos-item {
  1260. width: 38%;
  1261. display: flex;
  1262. align-items: center;
  1263. color: rgba(51, 51, 51, 1);
  1264. font-size: 22rpx;
  1265. // margin-right: 16rpx;
  1266. margin-bottom: 8rpx;
  1267. .icon {}
  1268. }
  1269. .text {
  1270. font-weight: bold;
  1271. }
  1272. }
  1273. }
  1274. }
  1275. // 设备状态
  1276. .statistics-4 {
  1277. .chat-img {
  1278. width: 100%;
  1279. height: 620rpx;
  1280. }
  1281. }
  1282. // 故障类型
  1283. .statistics-5,
  1284. .statistics-6 {
  1285. .chat-img {
  1286. width: 100%;
  1287. height: 410rpx;
  1288. }
  1289. }
  1290. // 异常设备排名
  1291. .statistics-ranking {
  1292. .total {
  1293. color: rgba(16, 16, 16, 1);
  1294. text {
  1295. color: #1677FF;
  1296. padding: 0 8rpx;
  1297. }
  1298. }
  1299. .ranking-main {
  1300. margin-top: 48rpx;
  1301. border-radius: 16px;
  1302. background-color: #fff;
  1303. .item {
  1304. display: flex;
  1305. align-items: center;
  1306. margin-bottom: 32rpx;
  1307. .ranking {
  1308. color: rgba(16, 16, 16, 1);
  1309. font-weight: bold;
  1310. }
  1311. .icon {
  1312. width: 72rpx;
  1313. height: 72rpx;
  1314. border-radius: 4px;
  1315. background-color: rgba(219, 234, 255, 1);
  1316. display: flex;
  1317. align-items: center;
  1318. justify-content: center;
  1319. margin-left: 24rpx;
  1320. .img {
  1321. width: 48rpx;
  1322. height: 48rpx;
  1323. }
  1324. }
  1325. .name {
  1326. margin-left: 16rpx;
  1327. .name1 {
  1328. color: rgba(51, 51, 51, 1);
  1329. font-weight: bold;
  1330. }
  1331. .name2 {
  1332. color: rgba(119, 119, 119, 1);
  1333. font-size: 24rpx;
  1334. margin-top: 4rpx;
  1335. }
  1336. }
  1337. .time {
  1338. color: rgba(16, 16, 16, 1);
  1339. margin-left: auto;
  1340. font-weight: bold;
  1341. }
  1342. }
  1343. }
  1344. // 查看全部排名
  1345. .check-all {
  1346. text-align: center;
  1347. color: rgba(119, 119, 119, 1);
  1348. font-size: 12px;
  1349. }
  1350. }
  1351. }
  1352. /deep/.u-drawer {
  1353. z-index: 999 !important;
  1354. }
  1355. </style>