statistics.vue 31 KB

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