statistics.vue 33 KB

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