statistics.vue 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537
  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="toEquipmentConditionMonitoring()">
  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. uni.showLoading({
  485. title: "加载中",
  486. mask: true,
  487. })
  488. API.deviceCompanyList().then((response) => {
  489. uni.hideLoading();
  490. var list = response.data.companyInfoList;
  491. var mList1 = [];
  492. var mList2 = [];
  493. mList1.push({
  494. id: '',
  495. name: '全部'
  496. });
  497. for (var i = 0; i < list.length; i++) {
  498. if (i >= 3) {
  499. mList2.push(list[i]);
  500. } else {
  501. mList1.push(list[i]);
  502. }
  503. }
  504. this.companyList = list;
  505. this.merchantList1 = mList1;
  506. this.merchantList2 = mList2;
  507. }).catch(error => {
  508. uni.showToast({
  509. title: error,
  510. icon: "none"
  511. })
  512. })
  513. },
  514. // 商户ID
  515. getfindByOpenId() {
  516. uni.showLoading({
  517. title: "加载中",
  518. mask: true,
  519. })
  520. API.findByOpenId({
  521. openId: this.carhelp.getOpenId()
  522. }).then((response) => {
  523. uni.hideLoading();
  524. this.codes = response.data.regUser.codes;
  525. }).catch(error => {
  526. uni.showToast({
  527. title: error,
  528. icon: "none"
  529. })
  530. })
  531. },
  532. // 设备数据监测
  533. getEquipmentDataMonitoring(pl) {
  534. this.pageIndexe = this.pageIndexe + pl;
  535. if (this.pageIndexe > this.totalPagee) {
  536. this.pageIndexe = 1;
  537. }
  538. uni.showLoading({
  539. title: "加载中",
  540. mask: true,
  541. })
  542. API.homePageDeviceData({
  543. pageIndex: this.pageIndexe,
  544. pageSize: 5,
  545. companyId: this.companyId
  546. }).then((response) => {
  547. uni.hideLoading();
  548. this.deviceList = response.data.data;
  549. this.totalPagee = response.data.totalPage;
  550. }).catch(error => {
  551. uni.showToast({
  552. title: error,
  553. icon: "none"
  554. })
  555. })
  556. },
  557. // 异常告警记录
  558. getAbnormalAlarmRecord() {
  559. uni.showLoading({
  560. title: "加载中",
  561. mask: true,
  562. })
  563. API.alarmRecord({
  564. queryDate: this.queryDate,
  565. configId: '',
  566. pageIndex: 1,
  567. pageSize: 3,
  568. companyId: this.companyId
  569. }).then((response) => {
  570. uni.hideLoading();
  571. this.abnormalRecordsList = response.data.data;
  572. }).catch(error => {
  573. uni.showToast({
  574. title: error,
  575. icon: "none"
  576. })
  577. })
  578. },
  579. // 用电量
  580. getPowerConsumption(pl, interval) {
  581. this.pageIndexp = this.pageIndexp + pl;
  582. if (this.pageIndexp > this.totalPagep) {
  583. this.pageIndexp = 1;
  584. }
  585. if (!interval) {
  586. // uni.showLoading({
  587. // title: "加载中",
  588. // mask: true,
  589. // })
  590. }
  591. API.homePageKwh({
  592. pageIndex: this.pageIndexp,
  593. pageSize: 5,
  594. companyId: this.companyId
  595. }).then((response) => {
  596. if (!interval) {
  597. // uni.hideLoading();
  598. }
  599. this.kWhList = response.data.data;
  600. this.totalPagep = response.data.totalPage;
  601. if (!interval) {
  602. this.startInterval(); // 组件挂载后开始间隔
  603. }
  604. }).catch(error => {
  605. uni.showToast({
  606. title: error,
  607. icon: "none"
  608. })
  609. })
  610. },
  611. // 累计工单
  612. getAccumulatedWorkOrders() {
  613. },
  614. // 累计报警
  615. getAccumulatedAlarms() {
  616. uni.showLoading({
  617. title: "加载中",
  618. mask: true,
  619. })
  620. API.deviceStatus({
  621. companyId: this.companyId
  622. }).then((response) => {
  623. uni.hideLoading();
  624. this.alarmsForm = response.data;
  625. if (this.alarmsForm.okNum != 0) {
  626. this.alarmsPercent = this.alarmsForm.okNum / (this.alarmsForm.okNum + this.alarmsForm.errorNum) * 100;
  627. }
  628. }).catch(error => {
  629. uni.showToast({
  630. title: error,
  631. icon: "none"
  632. })
  633. })
  634. },
  635. // 工单处理
  636. getLineCharts() {
  637. if (!this.myLineChart) {
  638. this.myLineChart = echarts.init(document.getElementById('lineEcharts'));
  639. }
  640. var option = {
  641. tooltip: {
  642. trigger: 'axis',
  643. axisPointer: {
  644. type: 'shadow'
  645. }
  646. },
  647. legend: {
  648. data: ['新增工单', '处理工单', '剩余工单']
  649. },
  650. grid: {
  651. left: '3%',
  652. right: '4%',
  653. bottom: '3%',
  654. containLabel: true
  655. },
  656. xAxis: {
  657. type: 'category',
  658. data: ['1日', '2日', '3日', '4日', '5日', '6日']
  659. },
  660. yAxis: {
  661. type: 'value'
  662. },
  663. series: [{
  664. name: '新增工单',
  665. type: 'line',
  666. data: [2, 1, 0, 1, 3, 0],
  667. itemStyle: {
  668. color: '#FF3D00'
  669. }
  670. },
  671. {
  672. name: '处理工单',
  673. type: 'line',
  674. data: [3, 1, 1, 0, 2, 1],
  675. itemStyle: {
  676. color: '#FF7B00'
  677. }
  678. },
  679. {
  680. name: '剩余工单',
  681. type: 'line',
  682. data: [5, 2, 1, 1, 5, 1],
  683. itemStyle: {
  684. color: '#58A55C'
  685. }
  686. }
  687. ]
  688. };
  689. this.myLineChart.setOption(option);
  690. },
  691. // 故障类型
  692. getBarCharts() {
  693. if (!this.myBarChart) {
  694. this.myBarChart = echarts.init(document.getElementById('barEcharts'));
  695. }
  696. var option = {
  697. tooltip: {
  698. trigger: 'axis',
  699. axisPointer: {
  700. type: 'shadow'
  701. }
  702. },
  703. legend: {},
  704. grid: {
  705. left: '3%',
  706. right: '4%',
  707. bottom: '3%',
  708. containLabel: true
  709. },
  710. xAxis: [{
  711. type: 'category',
  712. data: ['一月', '二月', '三月']
  713. }],
  714. yAxis: [{
  715. type: 'value'
  716. }],
  717. barGap: '0',
  718. series: [{
  719. name: '温度异常',
  720. type: 'bar',
  721. data: [100, 140, 230],
  722. itemStyle: {
  723. color: '#FF3D00'
  724. }
  725. },
  726. {
  727. name: '电压异常',
  728. type: 'bar',
  729. data: [150, 100, 200],
  730. itemStyle: {
  731. color: '#FF7B00'
  732. }
  733. },
  734. {
  735. name: '功率因素异常',
  736. type: 'bar',
  737. data: [50, 80, 100],
  738. itemStyle: {
  739. color: '#FFAE00'
  740. }
  741. }
  742. ]
  743. };
  744. this.myBarChart.setOption(option);
  745. },
  746. // 设备状态
  747. getHomePageDeviceStatus() {
  748. uni.showLoading({
  749. title: "加载中",
  750. mask: true,
  751. })
  752. API.homePageDeviceStatus({
  753. companyId: this.companyId
  754. }).then((response) => {
  755. uni.hideLoading();
  756. var list = response.data;
  757. this.getPieCharts(list);
  758. }).catch(error => {
  759. uni.showToast({
  760. title: error,
  761. icon: "none"
  762. })
  763. })
  764. },
  765. getPieCharts(list) {
  766. if (!this.myPieChart) {
  767. this.myPieChart = echarts.init(document.getElementById('pieEcharts'), null, {
  768. // width: uni.upx2px(700),
  769. height: uni.upx2px(620)
  770. });
  771. }
  772. this.myPieChart.clear();
  773. var data = [{
  774. value: 1,
  775. name: '温度异常',
  776. itemStyle: {
  777. color: '#FF4F3F'
  778. }
  779. },
  780. {
  781. value: 1,
  782. name: '烟感异常',
  783. itemStyle: {
  784. color: '#FF7B00'
  785. }
  786. },
  787. {
  788. value: 1,
  789. name: '正常运行',
  790. itemStyle: {
  791. color: '#1677FF'
  792. }
  793. },
  794. {
  795. value: 1,
  796. name: '设备异常',
  797. itemStyle: {
  798. color: '#F2BD42'
  799. }
  800. },
  801. {
  802. value: 1,
  803. name: '设备离线',
  804. itemStyle: {
  805. color: '#C2C2C2'
  806. }
  807. },
  808. ];
  809. var data2 = [];
  810. if (list) {
  811. data[0].value = list.errorTemperatureNum; //温度异常
  812. data[1].value = list.errorSmokeNum; //烟感异常
  813. data[2].value = list.okNum; //正常运行
  814. data[3].value = list.errorDeviceNum; //设备异常
  815. data[4].value = list.errorOnlineNum; //设备离线
  816. for (var i = 0; i < data.length; i++) {
  817. if (data[i].value != 0) {
  818. data2.push(data[i]);
  819. }
  820. }
  821. }
  822. var option = {
  823. tooltip: {
  824. trigger: 'item'
  825. },
  826. legend: {
  827. left: 'center'
  828. },
  829. series: [{
  830. type: 'pie',
  831. top: '6%',
  832. // left: '3%',
  833. // right: '8%',
  834. bottom: '8%',
  835. radius: ['45%', '60%'],
  836. label: {
  837. formatter: '{name|{b}}\n{value|{c}}',
  838. fontSize: 12,
  839. position: 'outer',
  840. bleedMargin: 5,
  841. rich: {
  842. name: {
  843. align: 'left'
  844. },
  845. value: {
  846. align: 'left'
  847. }
  848. }
  849. },
  850. emphasis: {
  851. label: {
  852. itemStyle: {
  853. shadowBlur: 10,
  854. shadowOffsetX: 0,
  855. shadowColor: 'rgba(0, 0, 0, 0.5)'
  856. }
  857. }
  858. },
  859. data: data2
  860. }]
  861. };
  862. this.myPieChart.setOption(option);
  863. },
  864. change(index) {
  865. this.current = index;
  866. this.companyId = this.merchantList1[index].id;
  867. this.getPowerConsumption(0);
  868. this.getEquipmentDataMonitoring(0);
  869. this.getAccumulatedAlarms();
  870. this.getHomePageDeviceStatus();
  871. this.getAbnormalAlarmRecord();
  872. },
  873. toDataMonitoringList() {
  874. uni.navigateTo({
  875. url: '/pages/equipmentDataMonitoring/dataMonitoring-list'
  876. })
  877. },
  878. toEquipmentConditionMonitoring() {
  879. uni.navigateTo({
  880. url: '/pages/equipmentConditionMonitoring/equipmentConditionMonitoring'
  881. })
  882. },
  883. toWorkOrderManagement() {
  884. return
  885. uni.navigateTo({
  886. url: '/pages/workOrderManagement/workOrderManagement'
  887. })
  888. },
  889. toEquipmentElectricity() {
  890. uni.navigateTo({
  891. url: '/pages/equipmentDataMonitoring/equipmentElectricity'
  892. })
  893. },
  894. toElectronicMonitoring(item) {
  895. uni.navigateTo({
  896. url: '/pages/equipmentDataMonitoring/electronicMonitoring?id=' + item.id + '&name=' + item.name +
  897. '&companyId=' + item.companyId
  898. })
  899. }
  900. }
  901. }
  902. </script>
  903. <style lang="scss" scoped>
  904. page {
  905. padding-bottom: 200rpx;
  906. }
  907. /deep/.u-drawer-content {
  908. margin-top: 88rpx;
  909. }
  910. .popup-tabs {
  911. background-color: #fff;
  912. display: flex;
  913. align-items: center;
  914. justify-content: space-between;
  915. padding-top: 32rpx;
  916. padding-right: 32rpx;
  917. color: rgba(51, 51, 51, 1);
  918. font-size: 32rpx;
  919. .tabs {
  920. width: 88%;
  921. }
  922. }
  923. /deep/.u-tab-item {
  924. width: 25% !important;
  925. flex: none !important;
  926. }
  927. .tabs-options {
  928. display: flex;
  929. padding: 24rpx 32rpx 0;
  930. flex-wrap: wrap;
  931. .item {
  932. width: 25%;
  933. margin-bottom: 40rpx;
  934. }
  935. }
  936. // 导航栏
  937. .navbar {
  938. background-color: rgba(22, 119, 255, 1);
  939. color: #fff;
  940. line-height: 88rpx;
  941. display: flex;
  942. justify-content: space-between;
  943. align-items: center;
  944. padding: 0 32rpx;
  945. color: rgba(255, 255, 255, 1);
  946. font-size: 36rpx;
  947. position: fixed;
  948. left: 0;
  949. right: 0;
  950. top: 0;
  951. z-index: 999999;
  952. .img {
  953. width: 48rpx;
  954. height: 48rpx;
  955. vertical-align: middle;
  956. }
  957. }
  958. // 标签
  959. .tabs-box {
  960. padding: 32rpx 0;
  961. margin-top: 88rpx;
  962. padding-right: 32rpx;
  963. background-color: rgba(22, 119, 255, 1);
  964. display: flex;
  965. align-items: center;
  966. justify-content: space-between;
  967. .tabs {
  968. width: 88%;
  969. }
  970. }
  971. .main {
  972. border-radius: 16px 16px 0px 0px;
  973. background: linear-gradient(180deg, rgba(242, 244, 246, 1) 61%, rgba(255, 255, 255, 0) 100%);
  974. margin-top: -24rpx;
  975. padding: 32rpx;
  976. .statistics {
  977. border-radius: 8px;
  978. background-color: rgba(255, 255, 255, 1);
  979. box-shadow: 0px 1px 6px 0px rgba(0, 59, 142, 0.05);
  980. margin-top: 24rpx;
  981. padding: 40rpx;
  982. .title {
  983. display: flex;
  984. align-items: center;
  985. margin-bottom: 20rpx;
  986. .img {
  987. width: 36rpx;
  988. height: 36rpx;
  989. vertical-align: middle;
  990. border-radius: 999px;
  991. }
  992. .change {
  993. display: flex;
  994. align-items: center;
  995. .change-img {
  996. width: 32rpx;
  997. height: 32rpx;
  998. vertical-align: middle;
  999. }
  1000. text {
  1001. margin-left: 8rpx;
  1002. }
  1003. }
  1004. .text {
  1005. color: rgba(16, 16, 16, 1);
  1006. font-size: 36rpx;
  1007. margin-left: 16rpx;
  1008. font-weight: bold;
  1009. }
  1010. .change {
  1011. margin-left: 16rpx;
  1012. font-size: 24rpx;
  1013. color: #838383;
  1014. }
  1015. .check-all {
  1016. margin-left: auto;
  1017. color: rgba(131, 131, 131, 1);
  1018. font-size: 24rpx;
  1019. }
  1020. }
  1021. }
  1022. // 用电量
  1023. .statistics-e {
  1024. padding: 40rpx;
  1025. .electricity {
  1026. background-color: #fff;
  1027. .item:last-of-type {
  1028. border: none;
  1029. }
  1030. .item {
  1031. padding: 16rpx 0;
  1032. display: flex;
  1033. align-items: center;
  1034. justify-content: space-between;
  1035. border-bottom: 1px solid rgba(245, 245, 245, 1);
  1036. .item-content {
  1037. width: 93%;
  1038. }
  1039. .equipment {
  1040. display: flex;
  1041. align-items: center;
  1042. .equipment1 {
  1043. color: rgba(51, 51, 51, 1);
  1044. font-size: 32rpx;
  1045. max-width: 40%;
  1046. font-weight: bold;
  1047. white-space: nowrap;
  1048. overflow: hidden;
  1049. text-overflow: ellipsis;
  1050. }
  1051. .equipment2 {
  1052. color: rgba(119, 119, 119, 1);
  1053. margin-left: 16rpx;
  1054. max-width: 40%;
  1055. white-space: nowrap;
  1056. overflow: hidden;
  1057. text-overflow: ellipsis;
  1058. }
  1059. }
  1060. // 状态
  1061. .state {
  1062. display: flex;
  1063. align-items: center;
  1064. color: rgba(255, 123, 0, 1);
  1065. margin-left: auto;
  1066. .dot {
  1067. margin-right: 8rpx;
  1068. width: 16rpx;
  1069. height: 16rpx;
  1070. background-color: rgba(255, 123, 0, 1);
  1071. border-radius: 999px;
  1072. margin-left: auto;
  1073. }
  1074. .off-line {
  1075. background-color: rgba(255, 123, 0, 1);
  1076. }
  1077. .on-line {
  1078. background-color: rgba(0, 185, 98, 1);
  1079. }
  1080. }
  1081. .state2 {
  1082. color: rgba(0, 185, 98, 1);
  1083. }
  1084. .electricity {
  1085. display: flex;
  1086. justify-content: space-between;
  1087. align-items: center;
  1088. margin-top: 8rpx;
  1089. text-align: center;
  1090. .electricity-item {
  1091. display: flex;
  1092. align-items: center;
  1093. width: 33.3%;
  1094. height: 40rpx;
  1095. line-height: 40rpx;
  1096. .number {
  1097. color: rgba(51, 51, 51, 1);
  1098. font-weight: bold;
  1099. font-size: 24rpx;
  1100. margin-left: 8rpx;
  1101. }
  1102. .date {
  1103. color: rgba(119, 119, 119, 1);
  1104. font-size: 24rpx;
  1105. }
  1106. }
  1107. }
  1108. }
  1109. }
  1110. }
  1111. // 统计1
  1112. .statistics-1 {
  1113. display: flex;
  1114. align-items: center;
  1115. justify-content: space-between;
  1116. .item {
  1117. width: 330rpx;
  1118. padding: 24rpx;
  1119. box-shadow: 0px 1px 6px 0px rgba(0, 59, 142, 0.05);
  1120. border-radius: 8px;
  1121. background-color: rgba(255, 255, 255, 1);
  1122. .item-top {
  1123. display: flex;
  1124. align-items: center;
  1125. .img {
  1126. width: 88rpx;
  1127. height: 88rpx;
  1128. margin-right: 24rpx;
  1129. vertical-align: middle;
  1130. }
  1131. .number {
  1132. color: rgba(51, 51, 51, 1);
  1133. font-size: 32rpx;
  1134. .normal {
  1135. margin-bottom: 12rpx;
  1136. }
  1137. }
  1138. }
  1139. .total {
  1140. margin-top: 28rpx;
  1141. text-align: center;
  1142. color: rgba(119, 119, 119, 1);
  1143. }
  1144. .total-number {
  1145. color: #EE3138;
  1146. margin: 0 8rpx;
  1147. }
  1148. }
  1149. }
  1150. // 统计2异常报警记录
  1151. .statistics-2 {
  1152. .abnormal-item {
  1153. display: flex;
  1154. justify-content: space-between;
  1155. align-items: center;
  1156. padding: 16rpx;
  1157. border-bottom: 1px solid rgba(245, 245, 245, 1);
  1158. .item-title {
  1159. color: rgba(51, 51, 51, 1);
  1160. .img {
  1161. width: 32rpx;
  1162. height: 32rpx;
  1163. margin-right: 8rpx;
  1164. }
  1165. .name {
  1166. color: rgba(51, 51, 51, 1);
  1167. }
  1168. .date {
  1169. color: rgba(119, 119, 119, 1);
  1170. font-size: 24rpx;
  1171. }
  1172. }
  1173. .item-value {
  1174. text-align: right;
  1175. display: flex;
  1176. align-items: center;
  1177. .more {
  1178. margin-left: 8rpx;
  1179. }
  1180. .value1 {
  1181. font-weight: bold;
  1182. color: rgba(51, 51, 51, 1);
  1183. }
  1184. .value2 {
  1185. color: rgba(119, 119, 119, 1);
  1186. font-size: 24rpx;
  1187. }
  1188. }
  1189. }
  1190. }
  1191. // 统计3设备实时监控
  1192. .statistics-3 {
  1193. .monitoring-item {
  1194. padding: 16rpx 0;
  1195. border-bottom: 1px solid rgba(245, 245, 245, 1);
  1196. .item-title {
  1197. display: flex;
  1198. align-items: center;
  1199. .text1 {
  1200. color: rgba(51, 51, 51, 1);
  1201. }
  1202. }
  1203. .company-name {
  1204. color: rgba(119, 119, 119, 1);
  1205. font-size: 24rpx;
  1206. display: flex;
  1207. align-items: center;
  1208. .state {
  1209. margin-left: 12rpx;
  1210. display: flex;
  1211. align-items: center;
  1212. color: rgba(255, 123, 0, 1);
  1213. text {
  1214. margin-right: 8rpx;
  1215. display: inline-block;
  1216. width: 16rpx;
  1217. height: 16rpx;
  1218. border-radius: 999px;
  1219. }
  1220. .off-line {
  1221. background-color: rgba(255, 123, 0, 1);
  1222. }
  1223. .on-line {
  1224. background-color: rgba(0, 185, 98, 1);
  1225. }
  1226. }
  1227. .state2 {
  1228. color: rgba(0, 185, 98, 1);
  1229. }
  1230. }
  1231. .state {
  1232. margin-left: auto;
  1233. display: flex;
  1234. .state1,
  1235. .state2 {
  1236. display: flex;
  1237. align-items: center;
  1238. margin-left: 24rpx;
  1239. }
  1240. .more {
  1241. margin-left: 8rpx;
  1242. }
  1243. .img {
  1244. width: 32rpx;
  1245. height: 32rpx;
  1246. vertical-align: middle;
  1247. margin-right: 8rpx;
  1248. }
  1249. }
  1250. // 监控信息
  1251. .infos {
  1252. margin-top: 8rpx;
  1253. display: flex;
  1254. align-items: center;
  1255. justify-content: space-between;
  1256. flex-wrap: wrap;
  1257. .infos-item {
  1258. width: 38%;
  1259. display: flex;
  1260. align-items: center;
  1261. color: rgba(51, 51, 51, 1);
  1262. font-size: 22rpx;
  1263. // margin-right: 16rpx;
  1264. margin-bottom: 8rpx;
  1265. .icon {}
  1266. }
  1267. .text {
  1268. font-weight: bold;
  1269. }
  1270. }
  1271. }
  1272. }
  1273. // 设备状态
  1274. .statistics-4 {
  1275. .chat-img {
  1276. width: 100%;
  1277. height: 620rpx;
  1278. }
  1279. }
  1280. // 故障类型
  1281. .statistics-5,
  1282. .statistics-6 {
  1283. .chat-img {
  1284. width: 100%;
  1285. height: 410rpx;
  1286. }
  1287. }
  1288. // 异常设备排名
  1289. .statistics-ranking {
  1290. .total {
  1291. color: rgba(16, 16, 16, 1);
  1292. text {
  1293. color: #1677FF;
  1294. padding: 0 8rpx;
  1295. }
  1296. }
  1297. .ranking-main {
  1298. margin-top: 48rpx;
  1299. border-radius: 16px;
  1300. background-color: #fff;
  1301. .item {
  1302. display: flex;
  1303. align-items: center;
  1304. margin-bottom: 32rpx;
  1305. .ranking {
  1306. color: rgba(16, 16, 16, 1);
  1307. font-weight: bold;
  1308. }
  1309. .icon {
  1310. width: 72rpx;
  1311. height: 72rpx;
  1312. border-radius: 4px;
  1313. background-color: rgba(219, 234, 255, 1);
  1314. display: flex;
  1315. align-items: center;
  1316. justify-content: center;
  1317. margin-left: 24rpx;
  1318. .img {
  1319. width: 48rpx;
  1320. height: 48rpx;
  1321. }
  1322. }
  1323. .name {
  1324. margin-left: 16rpx;
  1325. .name1 {
  1326. color: rgba(51, 51, 51, 1);
  1327. font-weight: bold;
  1328. }
  1329. .name2 {
  1330. color: rgba(119, 119, 119, 1);
  1331. font-size: 24rpx;
  1332. margin-top: 4rpx;
  1333. }
  1334. }
  1335. .time {
  1336. color: rgba(16, 16, 16, 1);
  1337. margin-left: auto;
  1338. font-weight: bold;
  1339. }
  1340. }
  1341. }
  1342. // 查看全部排名
  1343. .check-all {
  1344. text-align: center;
  1345. color: rgba(119, 119, 119, 1);
  1346. font-size: 12px;
  1347. }
  1348. }
  1349. }
  1350. /deep/.u-drawer {
  1351. z-index: 999 !important;
  1352. }
  1353. </style>