equipmentElectricity.vue 26 KB

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