statistics.vue 32 KB

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