statistics.vue 32 KB

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