statistics.vue 32 KB

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