equipmentElectricity.vue 27 KB

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