statistics.vue 33 KB

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