statistics.vue 29 KB

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