statistics.vue 30 KB

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