statistics.vue 32 KB

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