equipmentElectricity.vue 25 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211
  1. <template>
  2. <view>
  3. <view class="navbar-c">
  4. <view class="back" @click="backStatistics">
  5. <u-icon name="arrow-left" color="#101010" size="36"></u-icon>
  6. </view>
  7. <view class="title">
  8. 用电量(度)
  9. <image class="img" src="@/assets/img/refresh-line.svg" @click="getList(true)"></image>
  10. </view>
  11. </view>
  12. <u-picker-select title="日期选择" v-model="tabsFrom.show2" :defaultTime="tabsFrom.show2Index" :endYear="endYear"
  13. mode="time" :params="params" :noselect="false" @confirm="selector2confirm" @cancel="selector2cancel"
  14. @reset="selector2reset"></u-picker-select>
  15. <!-- 标签 -->
  16. <view class="tabs-box" >
  17. <view class="tabs" :style="{width: companyList.length>4 ? '' : '100%'}">
  18. <u-tabs :list="merchantList1" :is-scroll="false" inactive-color="#999999" active-color="#666666"
  19. :current="current" @change="change"></u-tabs>
  20. </view>
  21. <view class="icon" @click="popShow=true" v-if="companyList.length >= 4">
  22. <u-icon name="arrow-down" color="#999999"></u-icon>
  23. </view>
  24. </view>
  25. <!-- 标签弹出层 -->
  26. <u-popup v-model="popShow" duration="10" mode="top" :negative-top="88" border-radius="16">
  27. <view class="popup-tabs">
  28. <view class="tabs">
  29. <u-tabs :list="merchantList1" :is-scroll="false" :current="current" @change="change"></u-tabs>
  30. </view>
  31. <view class="more">
  32. <u-icon name="arrow-up" color="#777777" size="40" @click="popShow=false"></u-icon>
  33. </view>
  34. </view>
  35. <view class="tabs-options">
  36. <view class="item" v-for="(item, index) in merchantList2" :key="index"
  37. @click="merchantChange(item,index)">
  38. {{item.name}}
  39. </view>
  40. </view>
  41. </u-popup>
  42. <!-- 全部标签 -->
  43. <view class="main" v-show="current==0" >
  44. <view class="item" v-for="(item, index) in kWhList" :key="item.index" v-if="current==0"
  45. @click="toElectronicMonitoring(item)">
  46. <view class="item-content">
  47. <view class="equipment">
  48. <view class="equipment1 ">
  49. {{item.name}}
  50. </view>
  51. <view class="equipment2">
  52. {{item.installationAddressSimple}}
  53. </view>
  54. <view class="state" v-if="!item.online">
  55. <view class="dot off-line"></view>
  56. <view class="text">离线</view>
  57. </view>
  58. <view class="state state2" v-else>
  59. <view class="dot on-line"></view>
  60. <view class="text">在线</view>
  61. </view>
  62. </view>
  63. <view class="electricity">
  64. <view class="electricity-item electricity-item-day">
  65. <view class="date">
  66. 今日
  67. </view>
  68. <view class="number">
  69. {{item.thisDayKwh}}
  70. </view>
  71. </view>
  72. <view class="electricity-item">
  73. <view class="date">
  74. 本月
  75. </view>
  76. <view class="number">
  77. {{item.thisMonthKwh}}
  78. </view>
  79. </view>
  80. <view class="electricity-item">
  81. <view class="date">
  82. 上月
  83. </view>
  84. <view class="number">
  85. {{item.lastMonthKwh}}
  86. </view>
  87. </view>
  88. </view>
  89. </view>
  90. <view class="more">
  91. <u-icon name="arrow-right" color="#d4d4d4" size="24"></u-icon>
  92. </view>
  93. </view>
  94. </view>
  95. <u-divider v-show="current==0" :isnone="kWhList.length==0" nonetext="暂无数据" border-color="#CFD2D5">已经到底了</u-divider>
  96. <!-- 子项标签 -->
  97. <view class="statistics-manage" v-if="current==1" >
  98. <!-- 图表 -->
  99. <view class="chart">
  100. <view class="u-subsection">
  101. <u-subsection :list="list" :current="homePageManageType" @change="sectionChange" font-size="24"></u-subsection>
  102. </view>
  103. <view class="chat-box" id="barEcharts">
  104. </view>
  105. </view>
  106. <view class="search" v-if="0">
  107. <view class="switch">
  108. <u-switch v-model="checked" size="40"></u-switch><text>只看离线表</text>
  109. </view>
  110. <view class="search-box" >
  111. <input type="text" placeholder="请输入电表查询" />
  112. <view class="icon">
  113. <img src="@/assets/img/riLine-search-line 1.svg" alt="" />
  114. </view>
  115. </view>
  116. </view>
  117. <!-- 电表统计 -->
  118. <Tree-Body :meterList="meterList" ref="mytree"
  119. @query="getHomePageManageChildMeter"
  120. v-if="getHomePageManageReady"
  121. :role="codes.indexOf('switch')!=-1"
  122. @switchBtn="switchBtnApi"
  123. ></Tree-Body>
  124. <!-- 电表统计 -->
  125. <view class="meter-statistic" v-if="false">
  126. <!-- 总计 -->
  127. <view v-for="(item,i) in meterList" :key="i">
  128. <view class="sum meter-statistic-main">
  129. <view class="icon" @click="showBtn(item)" v-if="item.childMeterList&&item.childMeterList.length" >
  130. <u-icon name="arrow-up" color="#d4d4d4" v-show="ifBtnShow(item)" size="24"></u-icon>
  131. <u-icon name="arrow-down" color="#d4d4d4" v-show="!ifBtnShow(item)" size="24"></u-icon>
  132. </view>
  133. <view class="meter-name" >
  134. {{item.name}}
  135. </view>
  136. <view class="meter-state" v-if="item.online">
  137. 在线
  138. </view>
  139. <view class="meter-state meter-state2" v-else>
  140. 离线
  141. </view>
  142. <view class="meter-number" @click="toElectronicMonitoring(item)">
  143. {{item.kwh}}度<u-icon name="arrow-right" color="#d4d4d4" size="24"></u-icon>
  144. </view>
  145. </view>
  146. <view class="sum2">
  147. <view class="title">
  148. {{item.name}}用电(未扣除)
  149. </view>
  150. <view class="value">
  151. {{item.childKwh}}度
  152. </view>
  153. </view>
  154. <!-- 一级表 -->
  155. <view class="sum first-level" v-if="item.childMeterList&&item.childMeterList.length"
  156. v-show="ifBtnShow(item)" v-for="(item2,j) in item.childMeterList" :key="j" >
  157. <view class="first-level-list">
  158. <view class="icon" @click="showBtn(item2)" v-if="item2.childMeterList&&item2.childMeterList.length" >
  159. <u-icon name="arrow-up" color="#d4d4d4" v-show="ifBtnShow(item2)" size="24"></u-icon>
  160. <u-icon name="arrow-down" color="#d4d4d4" v-show="!ifBtnShow(item2)" size="24"></u-icon>
  161. </view>
  162. <view class="icon">
  163. <img src="@/assets/img/switchIcon.png" alt="" />
  164. </view>
  165. <view class="meter-name" >
  166. {{item2.name}}
  167. </view>
  168. <view class="meter-state" v-if="item2.online">
  169. 在线
  170. </view>
  171. <view class="meter-state meter-state2" v-else>
  172. 离线
  173. </view>
  174. <view class="meter-number" @click="toElectronicMonitoring(item2)" >
  175. {{item2.kwh}}度<u-icon name="arrow-right" color="#d4d4d4" size="24"></u-icon>
  176. </view>
  177. </view>
  178. <!-- 二级表 -->
  179. <view class="sum second-level" v-if="item2.childMeterList&&item2.childMeterList.length"
  180. v-show="ifBtnShow(item2)" v-for="(item3,k) in item2.childMeterList" :key="k"
  181. >
  182. <view class="first-level-list">
  183. <view class="icon" @click="showBtn(item3)" v-if="item3.childMeterList&&item3.childMeterList.length" >
  184. <u-icon name="arrow-up" color="#d4d4d4" v-show="ifBtnShow(item3)" size="24"></u-icon>
  185. <u-icon name="arrow-down" color="#d4d4d4" v-show="!ifBtnShow(item3)" size="24"></u-icon>
  186. </view>
  187. <view class="icon">
  188. <img src="@/assets/img/switchIcon.png" alt="" />
  189. </view>
  190. <view class="meter-name">
  191. {{item3.name}}
  192. </view>
  193. <view class="meter-state" v-if="item3.online">
  194. 在线
  195. </view>
  196. <view class=" meter-state meter-state2" v-else>
  197. 离线
  198. </view>
  199. <view class="meter-number" @click="toElectronicMonitoring(item3)">
  200. {{item3.kwh}}度<u-icon name="arrow-right" color="#d4d4d4" size="24"></u-icon>
  201. </view>
  202. </view>
  203. <!-- 开关 -->
  204. <view class="else-switch " v-if="item3.childMeterList&&item3.childMeterList.length"
  205. v-show="ifBtnShow(item3)" v-for="(item4,h) in item3.childMeterList" :key="h" >
  206. <view class="sum item first-level-list">
  207. <view class="icon">
  208. <img src="@/assets/img/switchIcon.png" alt="" />
  209. <!-- switchClose -->
  210. </view>
  211. <view class="meter-name">
  212. {{item4.name}}
  213. </view>
  214. <view class="meter-state" v-if="item4.online">
  215. 在线
  216. </view>
  217. <view class=" meter-state meter-state2" v-else>
  218. 离线
  219. </view>
  220. <view class="meter-number" @click="toElectronicMonitoring(item4)" >
  221. {{item4.kwh}}度<u-icon name="arrow-right" color="#d4d4d4" size="24"></u-icon>
  222. </view>
  223. </view>
  224. </view>
  225. </view>
  226. </view>
  227. </view>
  228. </view>
  229. </view>
  230. </view>
  231. </template>
  232. <script>
  233. import * as API from '@/apis/pagejs/index.js'
  234. import * as API2 from '@/apis/pagejs/energyManage.js'
  235. import * as echarts from 'echarts';
  236. import {
  237. parseUnixTime,
  238. beforeTimeStamp,
  239. getWeek
  240. } from '@/apis/utils'
  241. import TreeBody from '@/components/tree/tree-body.vue';
  242. export default {
  243. components: {
  244. TreeBody
  245. },
  246. data() {
  247. return {
  248. codes:"",
  249. getHomePageManageReady:false,
  250. companyList: [], // 商户
  251. merchantList1: [],
  252. merchantList2: [],
  253. myLineChart: null, // 图表
  254. myBarChart: null,
  255. myPieChart: null,
  256. homePageManageType: 0,
  257. homePageManageObj: {
  258. childKwh: 0,
  259. differenceKwh: 0,
  260. parkKwh: 0
  261. },
  262. meterList: [],
  263. meterListShow:{},
  264. queryDate: '',
  265. kWhList: [], //设备
  266. companyId: '',
  267. popShow: false,
  268. current: 0,
  269. allKWhList: [],
  270. companyKwhList: [],
  271. pageIndex: 1,
  272. recordsTotal: 0,
  273. windowHeight: '',
  274. checked:false,
  275. list: [{
  276. name: '上月',
  277. value: "2"
  278. },
  279. {
  280. name: '当月',
  281. value: "1"
  282. },
  283. {
  284. name: '当日',
  285. value: "4"
  286. }, {
  287. name: '当年',
  288. value: "3"
  289. }, {
  290. name: '合计',
  291. value: "0"
  292. },
  293. {
  294. name: '指定月份',
  295. value: "10"
  296. }
  297. ],
  298. endYear: '',
  299. params: {
  300. year: true,
  301. month: true,
  302. day: true,
  303. hour: false,
  304. minute: false,
  305. second: false
  306. },
  307. value: '2',
  308. clickType: -1,
  309. tabsFrom: {
  310. show1: false,
  311. show1Index: 0,
  312. show2Index: '',
  313. show2: false,
  314. show1Text: "全部类型",
  315. show2Text: "全部时间",
  316. },
  317. }
  318. },
  319. onReady() {
  320. this.endYear = new Date().getFullYear();
  321. this.queryDate = parseUnixTime(new Date(), '{y}-{m}-{d}');
  322. this.getCompanyInfoList();
  323. },
  324. onReachBottom() {
  325. if (this.kWhList.length < this.recordsTotal) {
  326. this.myLoadmore();
  327. }
  328. },
  329. methods: {
  330. switchBtnApiMethod(node,key){
  331. uni.showLoading({
  332. title: "加载中",
  333. mask: true,
  334. })
  335. API2.remoteSwitch({
  336. meterId:node.id,
  337. enabled:key
  338. }).then((res) => {
  339. uni.hideLoading();
  340. node.switchStatus=key
  341. }).catch(error => {
  342. uni.showToast({
  343. title: error,
  344. icon: "none"
  345. })
  346. })
  347. },
  348. switchBtnApi(node,key){
  349. uni.showModal({
  350. confirmColor:`${key?'#3CC51F':'red'}`,
  351. confirmText:`${key?'开启':'关闭'}`,
  352. content: `确认是否要"${key?'开启':'关闭'}"${node.name}`,
  353. title: "提示",
  354. success:res=> {
  355. if(res.confirm){
  356. this.switchBtnApiMethod(node,key);
  357. }
  358. }
  359. })
  360. console.log(node,key)
  361. },
  362. refreshList() {
  363. if (this.current != 0) {
  364. this.getList(true);
  365. } else {
  366. this.getCompanyInfoList();
  367. }
  368. },
  369. companyChange(item, index) {
  370. this.current = index + 1;
  371. this.companyId = item.id;
  372. this.getList(true);
  373. },
  374. getCompanyInfoList() {
  375. this.companyKwhList = [];
  376. API.deviceCompanyList().then((response) => {
  377. var list = response.data.companyInfoList;
  378. this.companyList = list;
  379. var mList1 = [];
  380. var mList2 = [];
  381. mList1.push({
  382. id: '',
  383. name: '全部'
  384. });
  385. for (var i = 0; i < list.length; i++) {
  386. if (i >= 3) {
  387. mList2.push(list[i]);
  388. } else {
  389. mList1.push(list[i]);
  390. }
  391. }
  392. this.merchantList1 = mList1;
  393. this.merchantList2 = mList2;
  394. this.companyId = mList1[0].id;
  395. this.getList();
  396. }).catch(error => {
  397. uni.showToast({
  398. title: error,
  399. icon: "none"
  400. })
  401. })
  402. },
  403. myLoadmore() {
  404. this.pageIndex += 1;
  405. this.getList();
  406. },
  407. getList(bl) {
  408. uni.showLoading({
  409. title: "加载中",
  410. mask: true,
  411. })
  412. if (bl) {
  413. this.kWhList = [];
  414. this.pageIndex = 1;
  415. }
  416. var data = {
  417. pageIndex: this.pageIndex,
  418. pageSize: 20,
  419. companyId: this.companyId
  420. };
  421. API.homePageKwh(data).then((res) => {
  422. uni.hideLoading();
  423. this.kWhList = [
  424. ...this.kWhList,
  425. ...res.data.data
  426. ];
  427. this.recordsTotal = res.data.recordsTotal;
  428. }).catch(error => {
  429. uni.showToast({
  430. title: error,
  431. icon: "none"
  432. })
  433. })
  434. },
  435. merchantChange(item, index) {
  436. var m = item;
  437. var n = this.merchantList1[this.current];
  438. this.merchantList1[this.current] = m;
  439. this.merchantList2[index] = n;
  440. this.companyId = item.id;
  441. this.popShow = false;
  442. //this.getList(true);
  443. this.merchantChangeApi()
  444. },
  445. // 设备数据监测
  446. getHomePageManageChildMeter(item,bl) {
  447. // if(!bl){
  448. // uni.showLoading({
  449. // title: "加载中",
  450. // mask: true,
  451. // })
  452. // }
  453. API2.homePageManageChildMeter({
  454. parentMeterId:item.id,
  455. queryDate:this.queryDate,
  456. companyId: this.companyId,
  457. type: this.list[this.homePageManageType].value
  458. }).then((response) => {
  459. // if(!bl){
  460. // uni.hideLoading();
  461. // }
  462. // this.meterList = response.data.meterList;
  463. // if(!this.meterListShow.id){
  464. // this.meterListShow.id=1
  465. // this.recursionList(this.meterList)
  466. // }
  467. var childMeterList=response.data.childMeterList
  468. item.childMeterList=childMeterList
  469. if(!bl){
  470. for(var i in childMeterList){
  471. var obj=childMeterList[i]
  472. this.getHomePageManageChildMeter(obj,true)
  473. }
  474. }
  475. }).catch(error => {
  476. uni.showToast({
  477. title: error,
  478. icon: "none"
  479. })
  480. })
  481. },
  482. // 设备数据监测
  483. getHomePageManage() {
  484. this.getHomePageManageReady=false
  485. uni.showLoading({
  486. title: "加载中",
  487. mask: true,
  488. })
  489. API2.homePageManage({
  490. queryDate:this.queryDate,
  491. companyId: this.companyId,
  492. type: this.list[this.homePageManageType].value
  493. }).then((response) => {
  494. uni.hideLoading();
  495. this.getHomePageManageReady=true
  496. this.codes =this.carhelp.getPersonInfo().codes;
  497. this.meterList = response.data.meterList;
  498. // this.$nextTick(()=>{
  499. // this.$refs.mytree.toggle()
  500. // })
  501. this.homePageManageObj = response.data;
  502. this.getBarCharts()
  503. }).catch(error => {
  504. uni.showToast({
  505. title: error,
  506. icon: "none"
  507. })
  508. })
  509. },
  510. sectionChange(index) {
  511. this.clickType = index;
  512. this.homePageManageType = index;
  513. if (index == 5) {
  514. this.tabsFrom.show2 = true;
  515. this.params.day = false;
  516. } else {
  517. this.list[5].name = '指定月份'
  518. this.getHomePageManage()
  519. }
  520. },
  521. recursionList(list){
  522. if(list){
  523. for(var i in list){
  524. var obj=list[i]
  525. this.meterListShow[obj.id]=false
  526. this.recursionList(obj.childMeterList)
  527. }
  528. }
  529. },
  530. ifBtnShow(item){
  531. return this.meterListShow[item.id]
  532. },
  533. showBtn(item){
  534. var key=this.meterListShow[item.id];
  535. this.$set(this.meterListShow,item.id,!key)
  536. console.log("showBtn,",key)
  537. this.getHomePageManageChildMeter(item);
  538. this.$forceUpdate()
  539. },
  540. selector2reset(e) {
  541. console.log(e)
  542. this.tabsFrom.show2Text = '全部时间'
  543. this.tabsFrom.show2Index = '';
  544. if (e.day) {
  545. this.queryDate = parseUnixTime(new Date(), '{y}-{m}-{d}');
  546. this.getHomePageManage();
  547. } else {
  548. this.homePageManageType = this.clickType;
  549. if (this.homePageManageType != 5) {
  550. this.list[5].name = '指定月份';
  551. }
  552. this.getHomePageManage();
  553. }
  554. },
  555. selector2cancel() {
  556. if(this.clickType != -1) {
  557. this.homePageManageType = this.clickType;
  558. }
  559. },
  560. selector2confirm(e) {
  561. this.tabsFrom.show2Text = e.year + "年" + e.month + "月"
  562. this.tabsFrom.show2Index = e.year + "-" + e.month
  563. if (e.day) {
  564. this.tabsFrom.show2Text += e.day + "日"
  565. this.tabsFrom.show2Index += '-' + e.day
  566. this.queryDateMethod(this.tabsFrom.show2Index, true)
  567. } else {
  568. this.queryDateMethod(this.tabsFrom.show2Index, false)
  569. }
  570. },
  571. queryDateMethod(queryTime, day) {
  572. if (day) {
  573. this.queryDate = queryTime;
  574. //this.FormData2.type =day?"9":"10"
  575. //this.value="-1"
  576. //this.getHomePageManage();
  577. } else {
  578. this.queryDate = queryTime + "-01";
  579. this.homePageManageType = "5";
  580. this.list[5].name = queryTime;
  581. this.getHomePageManage();
  582. }
  583. },
  584. getBarCharts() {
  585. if (!this.myBarChart) {
  586. this.myBarChart = echarts.init(document.getElementById('barEcharts'),null,{
  587. width:uni.upx2px(690),height:uni.upx2px(480)
  588. });
  589. }
  590. var thismax=Math.max(this.homePageManageObj.parkKwh,this.homePageManageObj.differenceKwh,this.homePageManageObj.childKwh)
  591. var option = {
  592. polar: {
  593. center:['35%','50%'],
  594. radius:[20, '70%']
  595. },
  596. angleAxis: {
  597. max: parseInt(thismax+thismax/10)+3 ,
  598. startAngle: 75
  599. },
  600. legend: {
  601. x:"65%",
  602. y: '0',
  603. data: ['园区电量', '表计电量', '电损量'],
  604. orient :'vertical'
  605. },
  606. radiusAxis: {
  607. type: 'category',
  608. data: ['']
  609. },
  610. tooltip: {},
  611. series: [
  612. {
  613. name:'园区电量',
  614. type: 'bar',
  615. data: [
  616. this.homePageManageObj.parkKwh,
  617. ],
  618. coordinateSystem: 'polar',
  619. label: {
  620. show: true,
  621. position: 'middle',
  622. formatter: '{c}度'
  623. }
  624. },
  625. {
  626. name:'表计电量',
  627. type: 'bar',
  628. data: [
  629. this.homePageManageObj.childKwh
  630. ],
  631. coordinateSystem: 'polar',
  632. label: {
  633. show: true,
  634. position: 'middle',
  635. formatter: '{c}度'
  636. }
  637. },
  638. {
  639. name:'电损量',
  640. type: 'bar',
  641. data: [
  642. this.homePageManageObj.differenceKwh
  643. ],
  644. coordinateSystem: 'polar',
  645. label: {
  646. show: true,
  647. position: 'middle',
  648. formatter: '{c}度'
  649. }
  650. }
  651. ]
  652. };
  653. console.log(option)
  654. this.myBarChart.setOption(option);
  655. },
  656. merchantChangeApi() {
  657. if (this.companyId) {
  658. this.getHomePageManage();
  659. }
  660. },
  661. change(index) {
  662. this.current = index;
  663. this.companyId = this.merchantList1[index].id;
  664. this.merchantChangeApi()
  665. },
  666. backStatistics() {
  667. uni.navigateBack()
  668. },
  669. toElectronicMonitoring(item) {
  670. uni.navigateTo({
  671. url: '/pages/equipmentDataMonitoring/electronicMonitoring?id=' + item.id + '&name=' + item
  672. .name +
  673. '&companyId=' + item.companyId
  674. })
  675. }
  676. }
  677. }
  678. </script>
  679. <style lang="scss" scoped>
  680. page {
  681. padding-bottom: 100rpx;
  682. }
  683. .back {
  684. z-index: 999;
  685. width: 200rpx;
  686. }
  687. /deep/.u-drawer-content {
  688. margin-top: 88rpx;
  689. }
  690. // /deep/.u-tab-item {
  691. // width: 25% !important;
  692. // flex: none !important;
  693. // }
  694. .tabs-box {
  695. background-color: #fff;
  696. display: flex;
  697. align-items: center;
  698. padding-right: 32rpx;
  699. justify-content: space-between;
  700. border-bottom: 1px solid rgba(232, 232, 232, 1);
  701. .tabs {
  702. width: 88%;
  703. }
  704. .icon {
  705. margin-left: auto;
  706. margin-right: 24rpx;
  707. }
  708. }
  709. .popup-tabs {
  710. background-color: #fff;
  711. display: flex;
  712. align-items: center;
  713. justify-content: space-between;
  714. padding-right: 32rpx;
  715. color: rgba(51, 51, 51, 1);
  716. font-size: 32rpx;
  717. padding-top: 32rpx;
  718. .tabs {
  719. width: 88%;
  720. }
  721. }
  722. .tabs-options {
  723. display: flex;
  724. padding: 64rpx 32rpx 0;
  725. flex-wrap: wrap;
  726. .item {
  727. width: 25%;
  728. margin-bottom: 40rpx;
  729. }
  730. }
  731. // 用电量合计
  732. .total {
  733. padding: 24rpx 32rpx;
  734. background: linear-gradient(90deg, rgba(49, 110, 207, 1) 2%, rgba(37, 138, 255, 1) 100%);
  735. .company {
  736. display: flex;
  737. align-items: center;
  738. justify-content: space-between;
  739. .name {
  740. color: rgba(255, 255, 255, 1);
  741. font-size: 36rpx;
  742. font-weight: bold;
  743. }
  744. .amount {
  745. color: #f2f4f6;
  746. margin-top: 4rpx;
  747. }
  748. }
  749. .infos {
  750. display: flex;
  751. justify-content: space-between;
  752. align-items: center;
  753. margin-top: 4rpx;
  754. width: 93%;
  755. .infos-item {
  756. display: flex;
  757. width: 33.3%;
  758. .number {
  759. color: rgba(255, 255, 255, 1);
  760. font-size: 32rpx;
  761. font-weight: bold;
  762. margin-left: 8rpx;
  763. }
  764. .time {
  765. color: #f2f4f6;
  766. }
  767. }
  768. }
  769. }
  770. // 用电量
  771. .main {
  772. background-color: #fff;
  773. padding: 26rpx 32rpx;
  774. .item:last-of-type {
  775. border: none;
  776. }
  777. .item {
  778. padding: 16rpx 0;
  779. display: flex;
  780. align-items: center;
  781. justify-content: space-between;
  782. border-bottom: 1px solid rgba(245, 245, 245, 1);
  783. .item-content {
  784. width: 93%;
  785. }
  786. .equipment {
  787. display: flex;
  788. align-items: center;
  789. .equipment1 {
  790. color: rgba(51, 51, 51, 1);
  791. font-size: 32rpx;
  792. max-width: 40%;
  793. font-weight: bold;
  794. white-space: nowrap;
  795. overflow: hidden;
  796. text-overflow: ellipsis;
  797. }
  798. .equipment2 {
  799. color: rgba(119, 119, 119, 1);
  800. margin-left: 16rpx;
  801. max-width: 40%;
  802. white-space: nowrap;
  803. overflow: hidden;
  804. text-overflow: ellipsis;
  805. }
  806. }
  807. // 状态
  808. .state {
  809. display: flex;
  810. align-items: center;
  811. color: rgba(255, 123, 0, 1);
  812. margin-left: auto;
  813. .dot {
  814. margin-right: 8rpx;
  815. width: 16rpx;
  816. height: 16rpx;
  817. background-color: rgba(255, 123, 0, 1);
  818. border-radius: 999px;
  819. margin-left: auto;
  820. }
  821. .off-line {
  822. background-color: rgba(255, 123, 0, 1);
  823. }
  824. .on-line {
  825. background-color: rgba(0, 185, 98, 1);
  826. }
  827. }
  828. .state2 {
  829. color: rgba(0, 185, 98, 1);
  830. }
  831. .electricity {
  832. display: flex;
  833. justify-content: space-between;
  834. align-items: center;
  835. margin-top: 8rpx;
  836. text-align: center;
  837. .electricity-item {
  838. display: flex;
  839. align-items: center;
  840. width: 33.3%;
  841. .number {
  842. color: rgba(51, 51, 51, 1);
  843. font-weight: bold;
  844. font-size: 32rpx;
  845. margin-left: 8rpx;
  846. }
  847. .date {
  848. color: rgba(119, 119, 119, 1);
  849. }
  850. }
  851. }
  852. }
  853. }
  854. .statistics-manage {
  855. border-radius: 8px;
  856. background-color: rgba(255, 255, 255, 1);
  857. box-shadow: 0px 1px 6px 0px rgba(0, 59, 142, 0.05);
  858. margin: 32rpx;
  859. padding: 40rpx 0;
  860. .title,
  861. .chart,
  862. .search,
  863. .meter-statistic {
  864. padding: 0 32rpx;
  865. }
  866. // 图表
  867. .chart {
  868. /deep/.u-subsection {
  869. padding: 2px;
  870. }
  871. /deep/.u-item {
  872. padding: 0;
  873. font-size: 24rpx
  874. }
  875. .chat-box {
  876. margin-top: 24rpx;
  877. width: 100%;
  878. height: 480rpx;
  879. img {
  880. width: 100%;
  881. height: 100%;
  882. }
  883. }
  884. }
  885. .search {
  886. border-top: 1px solid rgba(242, 242, 242, 1);
  887. border-bottom: 1px solid rgba(242, 242, 242, 1);
  888. display: flex;
  889. align-items: center;
  890. justify-content: space-between;
  891. padding: 40rpx 32rpx;
  892. .switch {
  893. display: flex;
  894. align-items: center;
  895. text {
  896. margin-left: 8rpx;
  897. color: rgba(51, 51, 51, 1);
  898. }
  899. }
  900. .search-box {
  901. border-radius: 50px;
  902. background-color: rgba(242, 244, 246, 1);
  903. color: rgba(136, 136, 136, 1);
  904. height: 56rpx;
  905. line-height: 56rpx;
  906. padding-left: 16rpx;
  907. padding-right: 8rpx;
  908. flex: 1;
  909. margin-left: 28rpx;
  910. display: flex;
  911. align-items: center;
  912. justify-content: space-between;
  913. uni-input {
  914. height: 56rpx;
  915. line-height: 56rpx !important;
  916. font-size: 28rpx;
  917. width: 75%;
  918. }
  919. .icon {
  920. display: flex;
  921. align-items: center;
  922. justify-content: center;
  923. width: 64rpx;
  924. height: 40rpx;
  925. border-radius: 50px;
  926. background-color: rgba(22, 119, 255, 1);
  927. }
  928. }
  929. }
  930. }
  931. .meter-statistic {
  932. margin-top: 32rpx;
  933. .meter-statistic-main{
  934. display: flex;
  935. align-items: center;
  936. }
  937. .sum {
  938. .meter-name {
  939. color: rgba(51, 51, 51, 1);
  940. font-size: 32rpx;
  941. margin-left: 8rpx;
  942. font-weight: bold;
  943. }
  944. .icon {
  945. margin-right: 8rpx;
  946. img {
  947. width: 40rpx;
  948. height: 40rpx;
  949. vertical-align: middle;
  950. }
  951. }
  952. .meter-state {
  953. margin-left: 8rpx;
  954. width: 64rpx;
  955. height: 36rpx;
  956. line-height: 36rpx;
  957. border-radius: 4px;
  958. background-color: rgba(255, 255, 255, 1);
  959. color: rgba(0, 185, 98, 1);
  960. font-size: 22rpx;
  961. text-align: center;
  962. border: 1px solid rgba(0, 185, 98, 1);
  963. }
  964. .meter-state2 {
  965. border: 1px solid rgba(255, 123, 0, 1);
  966. color: rgba(255, 123, 0, 1);
  967. }
  968. .meter-number {
  969. margin-left: auto;
  970. color: rgba(51, 51, 51, 1);
  971. font-size: 32rpx;
  972. /deep/.u-icon--right {
  973. margin-left: 8rpx;
  974. }
  975. }
  976. }
  977. .sum2 {
  978. padding: 0 32rpx;
  979. margin-top: 8rpx;
  980. display: flex;
  981. align-items: center;
  982. justify-content: space-between;
  983. .title {
  984. color: rgba(119, 119, 119, 1);
  985. }
  986. .value {
  987. color: rgba(119, 119, 119, 1);
  988. }
  989. }
  990. .first-level-list{
  991. width: 100%;
  992. display: flex;
  993. align-items: center;
  994. }
  995. // 一级表
  996. .first-level {
  997. padding-left: 32rpx;
  998. margin-top: 20rpx;
  999. .meter-name {
  1000. font-size: 28rpx
  1001. }
  1002. }
  1003. // 二级表
  1004. .second-level {
  1005. padding-left: 64rpx;
  1006. margin-top: 20rpx;
  1007. .meter-name {
  1008. font-size: 24rpx
  1009. }
  1010. }
  1011. .else-switch {
  1012. padding-left: 144rpx;
  1013. .meter-name {
  1014. font-size: 24rpx
  1015. }
  1016. .item {
  1017. margin-top: 24rpx;
  1018. }
  1019. }
  1020. }
  1021. </style>