statistics.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362
  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. })
  829. }
  830. }
  831. }
  832. </script>
  833. <style lang="scss" scoped>
  834. page {
  835. padding-bottom: 200rpx;
  836. }
  837. /deep/.u-drawer-content {
  838. margin-top: 88rpx;
  839. }
  840. .popup-tabs {
  841. background-color: #fff;
  842. display: flex;
  843. align-items: center;
  844. justify-content: space-between;
  845. padding-top: 32rpx;
  846. padding-right: 32rpx;
  847. color: rgba(51, 51, 51, 1);
  848. font-size: 32rpx;
  849. .tabs {
  850. width: 88%;
  851. }
  852. }
  853. /deep/.u-tab-item {
  854. width: 25% !important;
  855. flex: none !important;
  856. }
  857. .tabs-options {
  858. display: flex;
  859. padding: 24rpx 32rpx 0;
  860. flex-wrap: wrap;
  861. .item {
  862. width: 25%;
  863. margin-bottom: 40rpx;
  864. }
  865. }
  866. // 导航栏
  867. .navbar {
  868. background-color: rgba(22, 119, 255, 1);
  869. color: #fff;
  870. line-height: 88rpx;
  871. display: flex;
  872. justify-content: space-between;
  873. align-items: center;
  874. padding: 0 32rpx;
  875. color: rgba(255, 255, 255, 1);
  876. font-size: 36rpx;
  877. position: fixed;
  878. left: 0;
  879. right: 0;
  880. top: 0;
  881. z-index: 999999;
  882. .img {
  883. width: 48rpx;
  884. height: 48rpx;
  885. vertical-align: middle;
  886. }
  887. }
  888. // 标签
  889. .tabs-box {
  890. padding: 32rpx 0;
  891. margin-top: 88rpx;
  892. padding-right: 32rpx;
  893. background-color: rgba(22, 119, 255, 1);
  894. display: flex;
  895. align-items: center;
  896. justify-content: space-between;
  897. .tabs {
  898. width: 88%;
  899. }
  900. }
  901. .main {
  902. border-radius: 16px 16px 0px 0px;
  903. background: linear-gradient(180deg, rgba(242, 244, 246, 1) 61%, rgba(255, 255, 255, 0) 100%);
  904. margin-top: -24rpx;
  905. padding: 32rpx;
  906. .statistics {
  907. border-radius: 8px;
  908. background-color: rgba(255, 255, 255, 1);
  909. box-shadow: 0px 1px 6px 0px rgba(0, 59, 142, 0.05);
  910. margin-top: 24rpx;
  911. padding: 40rpx;
  912. .title {
  913. display: flex;
  914. align-items: center;
  915. margin-bottom: 20rpx;
  916. .img {
  917. width: 36rpx;
  918. height: 36rpx;
  919. vertical-align: middle;
  920. border-radius: 999px;
  921. }
  922. .change {
  923. display: flex;
  924. align-items: center;
  925. .change-img {
  926. width: 32rpx;
  927. height: 32rpx;
  928. vertical-align: middle;
  929. }
  930. text {
  931. margin-left: 8rpx;
  932. }
  933. }
  934. .text {
  935. color: rgba(16, 16, 16, 1);
  936. font-size: 36rpx;
  937. margin-left: 16rpx;
  938. font-weight: bold;
  939. }
  940. .change {
  941. margin-left: 16rpx;
  942. font-size: 24rpx;
  943. color: #838383;
  944. }
  945. .check-all {
  946. margin-left: auto;
  947. color: rgba(131, 131, 131, 1);
  948. font-size: 24rpx;
  949. }
  950. }
  951. }
  952. // 用电量
  953. .statistics-e {
  954. .electricity {
  955. background-color: #fff;
  956. .item {
  957. padding: 16rpx 0;
  958. display: flex;
  959. align-items: center;
  960. border-bottom: 1px solid rgba(245, 245, 245, 1);
  961. .equipment {
  962. width: 40%;
  963. // .equipment-text-overflow {
  964. // display: -webkit-box;
  965. // -webkit-box-orient: vertical;
  966. // -webkit-line-clamp: 1;
  967. // overflow: hidden;
  968. // }
  969. .equipment1 {
  970. color: rgba(51, 51, 51, 1);
  971. font-size: 32rpx;
  972. font-weight: bold;
  973. }
  974. .equipment2 {
  975. color: rgba(119, 119, 119, 1);
  976. display: flex;
  977. .companyName {
  978. width: 60%;
  979. // white-space: nowrap;
  980. //overflow: hidden;
  981. // text-overflow: ellipsis;
  982. }
  983. .state {
  984. margin-left: 12rpx;
  985. display: flex;
  986. align-items: center;
  987. color: rgba(255, 123, 0, 1);
  988. text {
  989. margin-right: 8rpx;
  990. display: inline-block;
  991. width: 16rpx;
  992. height: 16rpx;
  993. border-radius: 999px;
  994. }
  995. .off-line {
  996. background-color: rgba(255, 123, 0, 1);
  997. }
  998. .on-line {
  999. background-color: rgba(0, 185, 98, 1);
  1000. }
  1001. }
  1002. .state2 {
  1003. color: rgba(0, 185, 98, 1);
  1004. }
  1005. }
  1006. }
  1007. .electricity {
  1008. display: flex;
  1009. justify-content: space-between;
  1010. flex: 1;
  1011. margin-left: 48rpx;
  1012. text-align: center;
  1013. .electricity-item {
  1014. width: 33.3%;
  1015. .number {
  1016. color: rgba(51, 51, 51, 1);
  1017. font-size: 32rpx;
  1018. font-weight: bold;
  1019. height: 40rpx;
  1020. line-height: 40rpx;
  1021. }
  1022. .date {
  1023. color: rgba(119, 119, 119, 1);
  1024. margin-top: 4rpx;
  1025. }
  1026. }
  1027. }
  1028. }
  1029. }
  1030. }
  1031. // 统计1
  1032. .statistics-1 {
  1033. display: flex;
  1034. align-items: center;
  1035. justify-content: space-between;
  1036. .item {
  1037. width: 330rpx;
  1038. padding: 24rpx;
  1039. box-shadow: 0px 1px 6px 0px rgba(0, 59, 142, 0.05);
  1040. border-radius: 8px;
  1041. background-color: rgba(255, 255, 255, 1);
  1042. .item-top {
  1043. display: flex;
  1044. align-items: center;
  1045. .img {
  1046. width: 88rpx;
  1047. height: 88rpx;
  1048. margin-right: 24rpx;
  1049. vertical-align: middle;
  1050. }
  1051. .number {
  1052. color: rgba(51, 51, 51, 1);
  1053. font-size: 32rpx;
  1054. .normal {
  1055. margin-bottom: 12rpx;
  1056. }
  1057. }
  1058. }
  1059. .total {
  1060. margin-top: 28rpx;
  1061. text-align: center;
  1062. color: rgba(119, 119, 119, 1);
  1063. }
  1064. .total-number {
  1065. color: #EE3138;
  1066. margin: 0 8rpx;
  1067. }
  1068. }
  1069. }
  1070. // 统计2异常报警记录
  1071. .statistics-2 {
  1072. .abnormal-item {
  1073. display: flex;
  1074. justify-content: space-between;
  1075. align-items: center;
  1076. padding: 16rpx;
  1077. border-bottom: 1px solid rgba(245, 245, 245, 1);
  1078. .item-title {
  1079. color: rgba(51, 51, 51, 1);
  1080. .img {
  1081. width: 32rpx;
  1082. height: 32rpx;
  1083. margin-right: 8rpx;
  1084. }
  1085. .name {
  1086. color: rgba(51, 51, 51, 1);
  1087. }
  1088. .date {
  1089. color: rgba(119, 119, 119, 1);
  1090. font-size: 24rpx;
  1091. }
  1092. }
  1093. .item-value {
  1094. text-align: right;
  1095. .value1 {
  1096. font-weight: bold;
  1097. color: rgba(51, 51, 51, 1);
  1098. }
  1099. .value2 {
  1100. color: rgba(119, 119, 119, 1);
  1101. font-size: 24rpx;
  1102. }
  1103. }
  1104. }
  1105. }
  1106. // 统计3设备实时监控
  1107. .statistics-3 {
  1108. .monitoring-item {
  1109. padding: 16rpx 0;
  1110. border-bottom: 1px solid rgba(245, 245, 245, 1);
  1111. .item-title {
  1112. display: flex;
  1113. align-items: center;
  1114. .text1 {
  1115. color: rgba(51, 51, 51, 1);
  1116. }
  1117. .text2 {
  1118. color: rgba(119, 119, 119, 1);
  1119. font-size: 24rpx;
  1120. margin-left: 8rpx;
  1121. }
  1122. }
  1123. .state {
  1124. margin-left: auto;
  1125. display: flex;
  1126. .state1,
  1127. .state2 {
  1128. display: flex;
  1129. align-items: center;
  1130. margin-left: 24rpx;
  1131. }
  1132. .img {
  1133. width: 32rpx;
  1134. height: 32rpx;
  1135. vertical-align: middle;
  1136. margin-right: 8rpx;
  1137. }
  1138. }
  1139. // 监控信息
  1140. .infos {
  1141. margin-top: 8rpx;
  1142. display: flex;
  1143. align-items: center;
  1144. justify-content: space-between;
  1145. flex-wrap: wrap;
  1146. .infos-item {
  1147. display: flex;
  1148. align-items: center;
  1149. }
  1150. .text {
  1151. margin-left: 4rpx;
  1152. }
  1153. }
  1154. }
  1155. }
  1156. // 设备状态
  1157. .statistics-4 {
  1158. .chat-img {
  1159. width: 100%;
  1160. height: 620rpx;
  1161. }
  1162. }
  1163. // 故障类型
  1164. .statistics-5,
  1165. .statistics-6 {
  1166. .chat-img {
  1167. width: 100%;
  1168. height: 410rpx;
  1169. }
  1170. }
  1171. // 异常设备排名
  1172. .statistics-ranking {
  1173. .total {
  1174. color: rgba(16, 16, 16, 1);
  1175. text {
  1176. color: #1677FF;
  1177. padding: 0 8rpx;
  1178. }
  1179. }
  1180. .ranking-main {
  1181. margin-top: 48rpx;
  1182. border-radius: 16px;
  1183. background-color: #fff;
  1184. .item {
  1185. display: flex;
  1186. align-items: center;
  1187. margin-bottom: 32rpx;
  1188. .ranking {
  1189. color: rgba(16, 16, 16, 1);
  1190. font-weight: bold;
  1191. }
  1192. .icon {
  1193. width: 72rpx;
  1194. height: 72rpx;
  1195. border-radius: 4px;
  1196. background-color: rgba(219, 234, 255, 1);
  1197. display: flex;
  1198. align-items: center;
  1199. justify-content: center;
  1200. margin-left: 24rpx;
  1201. .img {
  1202. width: 48rpx;
  1203. height: 48rpx;
  1204. }
  1205. }
  1206. .name {
  1207. margin-left: 16rpx;
  1208. .name1 {
  1209. color: rgba(51, 51, 51, 1);
  1210. font-weight: bold;
  1211. }
  1212. .name2 {
  1213. color: rgba(119, 119, 119, 1);
  1214. font-size: 24rpx;
  1215. margin-top: 4rpx;
  1216. }
  1217. }
  1218. .time {
  1219. color: rgba(16, 16, 16, 1);
  1220. margin-left: auto;
  1221. font-weight: bold;
  1222. }
  1223. }
  1224. }
  1225. // 查看全部排名
  1226. .check-all {
  1227. text-align: center;
  1228. color: rgba(119, 119, 119, 1);
  1229. font-size: 12px;
  1230. }
  1231. }
  1232. }
  1233. /deep/.u-drawer {
  1234. z-index: 999 !important;
  1235. }
  1236. </style>