statistics.vue 35 KB

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