Info.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750
  1. <template>
  2. <div>
  3. <common @asynCallBack="asynCallBack"></common>
  4. <header class="mui-bar mui-bar-nav">
  5. <div class="barRight">
  6. <i class="mui-icon-extra mui-icon-extra-filter"></i>
  7. <a @click="openPopover" >过滤</a>
  8. </div>
  9. <h1 class="mui-title">能源中心</h1>
  10. <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
  11. </header>
  12. <div id="popover" class="mui-popover">
  13. <div class="popover-form">
  14. <div class="title">查询日期</div>
  15. <div class="selectBtn" @click="selectData2" >
  16. {{queryDate2}}
  17. <i class="mui-icon mui-icon-arrowdown" style=" float: right;"></i>
  18. </div>
  19. <div class="title">功率</div>
  20. <div class="returnCheckbox">
  21. <div class="mui-input-row mui-checkbox mui-left">
  22. <label>总功率</label>
  23. <input name="checkbox1" v-model="showlist1" value="总功率" type="checkbox" >
  24. </div>
  25. <div class="mui-input-row mui-checkbox mui-left">
  26. <label>A相功率</label>
  27. <input name="checkbox1" v-model="showlist1" value="A相功率" type="checkbox" >
  28. </div>
  29. <div class="mui-input-row mui-checkbox mui-left">
  30. <label>B相功率</label>
  31. <input name="checkbox1" v-model="showlist1" value="B相功率" type="checkbox" >
  32. </div>
  33. <div class="mui-input-row mui-checkbox mui-left">
  34. <label>C相功率</label>
  35. <input name="checkbox1" v-model="showlist1" value="C相功率" type="checkbox" >
  36. </div>
  37. </div>
  38. <div class="title">电流</div>
  39. <div class="returnCheckbox">
  40. <div class="mui-input-row mui-checkbox mui-left">
  41. <label>A相电流</label>
  42. <input name="checkbox2" v-model="showlist2" value="A相电流" type="checkbox" checked>
  43. </div>
  44. <div class="mui-input-row mui-checkbox mui-left">
  45. <label>B相电流</label>
  46. <input name="checkbox2" v-model="showlist2" value="B相电流" type="checkbox" checked>
  47. </div>
  48. <div class="mui-input-row mui-checkbox mui-left">
  49. <label>C相电流</label>
  50. <input name="checkbox2" v-model="showlist2" value="C相电流" type="checkbox" checked>
  51. </div>
  52. </div>
  53. <div class="title">电压</div>
  54. <div class="returnCheckbox">
  55. <div class="mui-input-row mui-checkbox mui-left">
  56. <label>A相电压</label>
  57. <input name="checkbox3" v-model="showlist3" value="A相电压" type="checkbox" checked>
  58. </div>
  59. <div class="mui-input-row mui-checkbox mui-left">
  60. <label>B相电压</label>
  61. <input name="checkbox3" v-model="showlist3" value="B相电压" type="checkbox" checked>
  62. </div>
  63. <div class="mui-input-row mui-checkbox mui-left">
  64. <label>C相电压</label>
  65. <input name="checkbox3" v-model="showlist3" value="C相电压" type="checkbox" checked>
  66. </div>
  67. </div>
  68. </div>
  69. <div class="popover-btn">
  70. <div class="popover-btn1" @click="init(true)">重置</div>
  71. <div class="popover-btn2" @click="submitBtn()">确定</div>
  72. </div>
  73. </div>
  74. <div class="mui-content">
  75. <div class="returnHead">
  76. <div class="returnUnit">
  77. <div class="returnUnit-item">百万</div>
  78. <div class="returnUnit-item">拾万</div>
  79. <div class="returnUnit-item">万</div>
  80. <div class="returnUnit-item">千</div>
  81. <div class="returnUnit-item">百</div>
  82. <div class="returnUnit-item">拾</div>
  83. <div class="returnUnit-item">1</div>
  84. <div class="returnUnit-item colorRed">0.1</div>
  85. <span style="min-width: 32px;">&nbsp;</span>
  86. </div>
  87. <div class="returnData">
  88. <div class="returnData-item" v-text="showTop[0]"></div>
  89. <div class="returnData-item" v-text="showTop[1]" ></div>
  90. <div class="returnData-item" v-text="showTop[2]" ></div>
  91. <div class="returnData-item" v-text="showTop[3]" ></div>
  92. <div class="returnData-item" v-text="showTop[4]" ></div>
  93. <div class="returnData-item" v-text="showTop[5]" ></div>
  94. <div class="returnData-item" v-text="showTop[6]" ></div>
  95. <div class="returnData-item bgRed" v-text="showTop[7]" ></div>
  96. <span>kW·h</span>
  97. </div>
  98. <div class="returnRadio">
  99. <div class="mui-input-row mui-radio mui-left">
  100. <label>总用电量</label>
  101. <input name="radio1" value="0" v-model="selectType" @click="ck(0)" type="radio">
  102. </div>
  103. <div class="mui-input-row mui-radio mui-left">
  104. <label>当月用电量</label>
  105. <input name="radio1" value="1" v-model="selectType" @click="ck(1)" type="radio">
  106. </div>
  107. <div class="mui-input-row mui-radio mui-left">
  108. <label>上月用电量</label>
  109. <input name="radio1" value="2" v-model="selectType" @click="ck(2)" type="radio">
  110. </div>
  111. <div class="mui-input-row mui-radio mui-left">
  112. <label>当年用电量</label>
  113. <input name="radio1" value="3" v-model="selectType" @click="ck(3)" type="radio">
  114. </div>
  115. <div class="mui-input-row mui-radio mui-left">
  116. <label>当日用电量</label>
  117. <input name="radio1" value="4" v-model="selectType" @click="ck(4)" type="radio">
  118. </div>
  119. <div class="mui-input-row mui-radio mui-left">
  120. <label>查询其他月份</label>
  121. <input name="radio1" value="9" v-model="selectType" @click="ck(9)" type="radio">
  122. </div>
  123. </div>
  124. </div>
  125. <div class="returnScreen">
  126. <i class="mui-icon-extra mui-icon-extra-arrowleftcricle active"
  127. @click="ckDate(0)"></i>
  128. <div class="returnTime" @click="selectData">
  129. <p>{{queryDate}}</p>
  130. <i class="mui-icon mui-icon-arrowdown"></i>
  131. </div>
  132. <i class="mui-icon-extra mui-icon-extra-arrowrightcricle"
  133. :class="{
  134. active:queryDate!=nowDate
  135. }"
  136. @click="ckDate(1)" ></i>
  137. </div>
  138. <dl class="returnChart returnChartBlue">
  139. <dt><span>功率监测(KW)</span></dt>
  140. <dd>
  141. <div id="kwPicture" style="width:100%;height: 300px;">
  142. </div>
  143. </dd>
  144. </dl>
  145. <dl class="returnChart">
  146. <dt><span>电流监测(A)</span></dt>
  147. <dd>
  148. <div id="aPicture" style="width:100%;height: 300px;">
  149. </div>
  150. </dd>
  151. </dl>
  152. <dl class="returnChart">
  153. <dt><span>电压监测(V)</span></dt>
  154. <dd>
  155. <div id="vPicture" style="width:100%;height: 300px;">
  156. </div>
  157. </dd>
  158. </dl>
  159. </div>
  160. <loading :visible="isLoading"></loading>
  161. </div>
  162. </template>
  163. <script>
  164. require('$project/assets/js/mui.picker.min.js');
  165. import * as API from '@/apis/Other/energy'
  166. import Common from '$project/components/Common.vue'
  167. import Loading from '$project/components/Loading.vue'
  168. import {
  169. mapGetters,
  170. mapMutations
  171. } from 'vuex'
  172. import * as echarts from 'echarts'
  173. import 'echarts/lib/chart/line'
  174. import {
  175. currentTimeStamp,
  176. parseUnixTime,
  177. beforeTimeStamp
  178. } from '$project/utils'
  179. export default {
  180. name: 'MasterHealthArchives',
  181. components: {
  182. Common,
  183. Loading,
  184. },
  185. data() {
  186. return {
  187. isLoading: false,
  188. showTop:[0,0,0,0,0,0,0,0],
  189. nowDate:"",
  190. timeList:[],
  191. queryDate:"",
  192. queryDate2:"",
  193. selectType:"0",
  194. energyCenterElectricityObj:{},
  195. energyCenterMapObj:{},
  196. showlist1:[],
  197. showlist2:[],
  198. showlist3:[],
  199. }
  200. },
  201. mounted() {
  202. },
  203. created() {
  204. this.init()
  205. },
  206. methods: {
  207. openPopover(){
  208. mui('#popover').popover('toggle');
  209. mui(".mui-scroll-wrapper").scroll()
  210. this.queryDate2=this.queryDate;
  211. },
  212. submitBtn(){
  213. this.queryDate=this.queryDate2;
  214. this.getEnergyCenterMap();
  215. this.getEnergyCenterElectricity();
  216. mui('#popover').popover('toggle');
  217. mui(".mui-scroll-wrapper").scroll()
  218. },
  219. init(bl){
  220. this.nowDate=parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}');
  221. this.queryDate=parseUnixTime(beforeTimeStamp(0), '{y}-{m}-{d}');
  222. this.queryDate2=parseUnixTime(beforeTimeStamp(0), '{y}-{m}-{d}');
  223. this.showlist1=['总功率','A相功率','B相功率','C相功率'];
  224. this.showlist2=['A相电流','B相电流','C相电流'];
  225. this.showlist3=['A相电压','B相电压','C相电压'];
  226. if(bl){
  227. mui('#popover').popover('toggle');
  228. mui(".mui-scroll-wrapper").scroll()
  229. }
  230. this.getEnergyCenterMap();
  231. this.getEnergyCenterElectricity();
  232. },
  233. //选择日期
  234. selectData() {
  235. var _this = this;
  236. var picker = new mui.DtPicker({
  237. "type": "date",
  238. "beginYear": 2020,
  239. "endYear": 2040,
  240. "endDate": new Date(),
  241. "value": _this.queryDate
  242. });
  243. picker.show(function(rs) {
  244. _this.queryDate = rs.text;
  245. _this.getEnergyCenterMap()
  246. picker.dispose();
  247. });
  248. },
  249. //选择日期
  250. selectData2() {
  251. mui('#popover').popover('toggle');
  252. mui(".mui-scroll-wrapper").scroll()
  253. var _this = this;
  254. var picker = new mui.DtPicker({
  255. "type": "date",
  256. "beginYear": 2020,
  257. "endYear": 2040,
  258. "endDate": new Date(),
  259. "value": _this.queryDate2
  260. });
  261. picker.show(function(rs) {
  262. _this.queryDate2 = rs.text;
  263. mui('#popover').popover('toggle');
  264. mui(".mui-scroll-wrapper").scroll()
  265. picker.dispose();
  266. });
  267. },
  268. ckDate(bl){
  269. if(bl&&this.queryDate==this.nowDate){
  270. return
  271. }
  272. let dd = new Date(this.queryDate)
  273. if(bl){
  274. dd.setDate(dd.getDate() + 1)
  275. }else{
  276. dd.setDate(dd.getDate() - 1)
  277. }
  278. let time = dd.getTime()
  279. this.queryDate=parseUnixTime(time, '{y}-{m}-{d}');
  280. this.getEnergyCenterMap()
  281. },
  282. ck(val){
  283. if(val!=this.selectType){
  284. this.selectType=val;
  285. this.getEnergyCenterElectricity()
  286. }
  287. },
  288. //获取详情
  289. getEnergyCenterMap() {
  290. this.isLoading = true;
  291. API.energyCenterMap({
  292. queryDate:this.queryDate
  293. }).then(response => {
  294. this.isLoading = false;
  295. this.energyCenterMapObj = response;
  296. this.setMap();
  297. }).catch(error => {
  298. this.isLoading = false;
  299. mui.toast(error);
  300. })
  301. },
  302. setMap(bl){
  303. this.timeList=[];
  304. for(var i in this.energyCenterMapObj){
  305. this.timeList.push(i)
  306. }
  307. var list1=[];
  308. var list2=[];
  309. var list3=[];
  310. var sz1=['总功率','A相功率','B相功率','C相功率'];
  311. var sz2=['A相电流','B相电流','C相电流'];
  312. var sz3=['A相电压','B相电压','C相电压'];
  313. this.setSz(sz1,['allp','ap','bp','cp'],list1,this.energyCenterMapObj,this.showlist1)
  314. this.setSz(sz2,['aa','ba','ca'],list2,this.energyCenterMapObj,this.showlist2)
  315. this.setSz(sz3,['av','bv','cv'],list3,this.energyCenterMapObj,this.showlist3)
  316. console.log(this.list1)
  317. //获取图表数据
  318. this.echarts('kwPicture',1,this.showlist1,list1);
  319. //获取图表数据
  320. this.echarts('aPicture',0,this.showlist2,list2);
  321. //获取图表数据
  322. this.echarts('vPicture',0,this.showlist3,list3);
  323. },
  324. setSz(sz1,sz2,list,energyCenterMapObj,showList){
  325. for(var j in sz1){
  326. var k =showList.indexOf(sz1[j]);
  327. if(k==-1){
  328. continue
  329. }
  330. var ap={
  331. name: sz1[j],
  332. type: 'line',
  333. symbol: 'none',
  334. sampling: 'lttb',
  335. // stack: 'Total',
  336. data:[]
  337. }
  338. list.push(ap)
  339. for(var i in energyCenterMapObj){
  340. var obj=energyCenterMapObj[i][sz2[j]];
  341. if(obj){
  342. ap.data.push(obj);
  343. }
  344. }
  345. }
  346. console.log(list)
  347. },
  348. //获取详情
  349. getEnergyCenterElectricity() {
  350. //this.isLoading = true;
  351. API.energyCenterElectricity({
  352. queryDate:this.queryDate,
  353. type:this.selectType
  354. }).then(response => {
  355. //this.isLoading = false;
  356. this.showTop=[0,0,0,0,0,0,0,0]
  357. this.energyCenterElectricityObj = response;
  358. var electricity=this.energyCenterElectricityObj.electricity;
  359. if(electricity){
  360. var sz= electricity.split(".")
  361. var str1=sz[0];
  362. var str2=[];
  363. if(sz.length>1){
  364. str2=sz[1];
  365. this.showTop[7]=str2[0];
  366. }
  367. var j=0;
  368. for(var i in str1){
  369. if(i!=undefined){
  370. this.showTop[6-str1.length+j+1]=str1[i]
  371. }
  372. j++;
  373. }
  374. this.$forceUpdate()
  375. }
  376. //showTop
  377. }).catch(error => {
  378. this.isLoading = false;
  379. mui.toast(error);
  380. })
  381. },
  382. asynCallBack(){},
  383. echarts(className,color,legenddata,seriesdata){
  384. var colorName=""
  385. if(color=='1'){
  386. colorName="#ECEDF0"
  387. }else{
  388. colorName="#333"
  389. }
  390. var myChart = echarts.init(document.getElementById(className), 'light');
  391. myChart.clear()
  392. var option = {
  393. tooltip: {
  394. trigger: 'axis',
  395. borderColor:"#F0F0F0",
  396. borderWidth:1,
  397. backgroundColor:"#ffffff",
  398. textStyle:{
  399. color:"#333"
  400. }
  401. },
  402. legend: {
  403. data: legenddata,
  404. textStyle: {
  405. color: colorName
  406. }
  407. },
  408. grid: {
  409. left: '3%',
  410. right: '4%',
  411. bottom: '15%',
  412. containLabel: true
  413. },
  414. xAxis: {
  415. type: 'category',
  416. boundaryGap: false,
  417. data: this.timeList,
  418. axisLabel:{
  419. textStyle:{
  420. color:colorName
  421. }
  422. },
  423. axisLine:{
  424. show:true,
  425. lineStyle:{
  426. color:colorName
  427. }
  428. },
  429. },
  430. yAxis: {
  431. type: 'value',
  432. axisLabel:{
  433. textStyle:{
  434. color:colorName
  435. }
  436. }, axisLine:{
  437. show:true,
  438. lineStyle:{
  439. color:colorName
  440. }
  441. },
  442. },
  443. dataZoom: [
  444. {
  445. type: 'inside',
  446. start: 0,
  447. end: 100
  448. },
  449. {
  450. start: 0,
  451. end: 100
  452. }
  453. ],
  454. series: seriesdata
  455. };
  456. myChart.setOption(option);
  457. }
  458. }
  459. }
  460. </script>
  461. <style scoped >
  462. .selectBtn{
  463. background-color: #f2f5fa;
  464. line-height: 20px;
  465. font-size: 16px;
  466. padding: 5px 5px 5px 15px;
  467. color: #333333;
  468. }
  469. .popover-form{
  470. padding: 20px;
  471. }
  472. .popover-btn{
  473. display: flex;
  474. height: 48px;
  475. }
  476. .popover-btn1{
  477. width: 100px;
  478. border: 1px solid #eee;
  479. text-align: center;
  480. line-height: 50px;
  481. }
  482. .popover-btn2{
  483. flex: 1;
  484. background-color: #1677FF ;
  485. text-align: center;
  486. line-height: 50px;
  487. color:#fff;
  488. }
  489. .select select{
  490. background-color: #eee;
  491. margin-top: 6px;
  492. }
  493. .mui-popover .title{
  494. margin-top: 12px ;
  495. }
  496. .returnCheckbox {
  497. display: flex;
  498. flex-wrap: wrap;
  499. }
  500. .returnCheckbox .mui-input-row {
  501. width:33%;
  502. }
  503. .mui-checkbox.mui-left input[type=checkbox]{
  504. left: 0;
  505. }
  506. .mui-checkbox.mui-left label {
  507. padding-left:24px;
  508. }
  509. .mui-checkbox input[type=checkbox]:before{
  510. content: '\e413';
  511. }
  512. .mui-checkbox input[type=checkbox]:checked:before{
  513. content: '\e443';
  514. }
  515. .mui-checkbox input[type=checkbox]:before, .mui-radio input[type=radio]:before{
  516. font-size: 20px;
  517. }
  518. .mui-checkbox input[type=checkbox], .mui-radio input[type=radio]{
  519. top:11px;
  520. }
  521. .mui-popover {
  522. position: fixed;
  523. background-color: #fff;
  524. z-index: 999;
  525. left: 0 !important;
  526. right: 0 !important;
  527. top: 44px !important;
  528. border-top: 1px solid #eee;
  529. border-radius: 0;
  530. width: 100%;
  531. box-shadow: none;
  532. }
  533. .mui-backdrop {
  534. top: 44px;
  535. }
  536. .barRight {
  537. float: right;
  538. display: flex;
  539. align-items: center;
  540. height: 44px;
  541. }
  542. .barRight a {
  543. margin-left: 3px;
  544. }
  545. .barRight i {
  546. font-size: 16px;
  547. }
  548. .returnScreen {
  549. margin-top: 14px;
  550. background-color: #fff;
  551. display: flex;
  552. justify-content: space-between;
  553. padding: 12px;
  554. }
  555. .returnScreen i {
  556. color: #D4D6D9;
  557. }
  558. .returnScreen .active {
  559. color: #1677FF;
  560. }
  561. .returnTime {
  562. display: flex;
  563. align-items: center;
  564. }
  565. .returnTime p {
  566. font-size: 18px;
  567. margin-right: 6px;
  568. }
  569. .returnChart {
  570. /* //padding: 0 16px; */
  571. background-color: #fff;
  572. }
  573. .returnChart dt {
  574. padding: 16px 16px;
  575. }
  576. .returnChart dt span {
  577. position: relative;
  578. padding-left: 15px;
  579. font-size: 18px;
  580. }
  581. .returnChart dt span:before {
  582. content: '';
  583. position: absolute;
  584. width: 4px;
  585. height: 14px;
  586. background-color: #1677FF;
  587. border-radius: 2px;
  588. left: 0;
  589. top: 2px;
  590. }
  591. .returnChart dd {
  592. padding-bottom: 16px;
  593. margin: 0;
  594. }
  595. .returnHead {
  596. padding: 20px;
  597. background-color: #fff;
  598. }
  599. .returnUnit {
  600. display: flex;
  601. align-items: center;
  602. }
  603. .returnData {
  604. display: flex;
  605. align-items: center;
  606. }
  607. .returnUnit .returnUnit-item {
  608. width: 36px;
  609. text-align: center;
  610. line-height: 48px;
  611. margin-right: 1px;
  612. }
  613. .returnData .returnData-item {
  614. height: 48px;
  615. width: 36px;
  616. background-color: #101010;
  617. text-align: center;
  618. line-height: 48px;
  619. color: #fff;
  620. font-size: 36px;
  621. margin-right: 1px;
  622. }
  623. .returnData span {
  624. margin-left: 5px;
  625. }
  626. .colorRed {
  627. color: #900005;
  628. }
  629. .bgRed {
  630. background-color: #900005 !important;
  631. }
  632. .returnRadio {
  633. display: flex;
  634. flex-wrap: wrap;
  635. margin-top: 12px;
  636. }
  637. .returnRadio .mui-input-row {
  638. width: 50%;
  639. }
  640. .mui-radio.mui-left input[type=radio] {
  641. left: 0;
  642. }
  643. .mui-radio.mui-left label {
  644. padding-left: 24px;
  645. }
  646. .returnChartBlue {
  647. background-image: linear-gradient(0deg, #034373, #007BD3);
  648. margin-top: 0;
  649. }
  650. .returnChartBlue dt span {
  651. color: #fff;
  652. }
  653. .returnChartBlue dt span:before {
  654. content: '';
  655. position: absolute;
  656. width: 4px;
  657. height: 14px;
  658. background-color: #fff;
  659. border-radius: 2px;
  660. left: 0;
  661. top: 2px;
  662. }
  663. </style>
  664. <style src="$project/assets/css/mui.picker.min.css"></style>