statistics.vue 34 KB

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