Info.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726
  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 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. queryDate:"",
  191. queryDate2:"",
  192. selectType:"0",
  193. energyCenterElectricityObj:{},
  194. energyCenterMapObj:{},
  195. showlist1:[],
  196. showlist2:[],
  197. showlist3:[],
  198. }
  199. },
  200. mounted() {
  201. },
  202. created() {
  203. this.init()
  204. //this.queryDate='2022-06-08'
  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. var list1=[];
  304. var list2=[];
  305. var list3=[];
  306. var sz1=['总功率','A相功率','B相功率','C相功率'];
  307. var sz2=['A相电流','B相电流','C相电流'];
  308. var sz3=['A相电压','B相电压','C相电压'];
  309. this.setSz(sz1,['allp','ap','bp','cp'],list1,this.energyCenterMapObj,this.showlist1)
  310. this.setSz(sz2,['aa','ba','ca'],list2,this.energyCenterMapObj,this.showlist2)
  311. this.setSz(sz3,['av','bv','cv'],list3,this.energyCenterMapObj,this.showlist3)
  312. console.log(this.list1)
  313. //获取图表数据
  314. this.echarts('kwPicture',1,this.showlist1,list1);
  315. //获取图表数据
  316. this.echarts('aPicture',0,this.showlist2,list2);
  317. //获取图表数据
  318. this.echarts('vPicture',0,this.showlist3,list3);
  319. },
  320. setSz(sz1,sz2,list,energyCenterMapObj,showList){
  321. for(var j in sz1){
  322. var k =showList.indexOf(sz1[j]);
  323. if(k==-1){
  324. continue
  325. }
  326. var ap={
  327. name: sz1[j],
  328. type: 'line',
  329. stack: 'Total',
  330. data:[]
  331. }
  332. list.push(ap)
  333. for(var i in energyCenterMapObj){
  334. var obj=energyCenterMapObj[i][sz2[j]];
  335. if(obj){
  336. ap.data.push(obj);
  337. }
  338. }
  339. }
  340. console.log(list)
  341. },
  342. //获取详情
  343. getEnergyCenterElectricity() {
  344. this.isLoading = true;
  345. API.energyCenterElectricity({
  346. queryDate:this.queryDate,
  347. type:this.selectType
  348. }).then(response => {
  349. this.isLoading = false;
  350. this.showTop=[0,0,0,0,0,0,0,0]
  351. this.energyCenterElectricityObj = response;
  352. var electricity=this.energyCenterElectricityObj.electricity;
  353. if(electricity){
  354. var sz= electricity.split(".")
  355. var str1=sz[0];
  356. var str2=[];
  357. if(sz.length>1){
  358. str2=sz[1];
  359. this.showTop[7]=str2[0];
  360. }
  361. var j=0;
  362. for(var i in str1){
  363. if(i!=undefined){
  364. this.showTop[6-str1.length+j+1]=str1[i]
  365. }
  366. j++;
  367. }
  368. this.$forceUpdate()
  369. }
  370. //showTop
  371. }).catch(error => {
  372. this.isLoading = false;
  373. mui.toast(error);
  374. })
  375. },
  376. asynCallBack(){},
  377. echarts(className,color,legenddata,seriesdata){
  378. var colorName=""
  379. if(color=='1'){
  380. colorName="#ECEDF0"
  381. }else{
  382. colorName="#333"
  383. }
  384. var myChart = echarts.init(document.getElementById(className), 'light');
  385. myChart.clear()
  386. var option = {
  387. tooltip: {
  388. trigger: 'axis',
  389. borderColor:"#F0F0F0",
  390. borderWidth:1,
  391. backgroundColor:"#ffffff",
  392. textStyle:{
  393. color:"#333"
  394. }
  395. },
  396. legend: {
  397. data: legenddata,
  398. textStyle: {
  399. color: colorName
  400. }
  401. },
  402. grid: {
  403. left: '3%',
  404. right: '4%',
  405. bottom: '3%',
  406. containLabel: true
  407. },
  408. xAxis: {
  409. type: 'category',
  410. boundaryGap: false,
  411. data: ['01', '02', '03', '04', '05', '06', '07','08', '09', '10', '11', '12', '13', '14','15', '16', '17', '18', '19', '20', '21', '22', '23','24'],
  412. axisLabel:{
  413. textStyle:{
  414. color:colorName
  415. }
  416. },
  417. axisLine:{
  418. show:true,
  419. lineStyle:{
  420. color:colorName
  421. }
  422. },
  423. },
  424. yAxis: {
  425. type: 'value',
  426. axisLabel:{
  427. textStyle:{
  428. color:colorName
  429. }
  430. }, axisLine:{
  431. show:true,
  432. lineStyle:{
  433. color:colorName
  434. }
  435. },
  436. },
  437. series: seriesdata
  438. };
  439. myChart.setOption(option);
  440. }
  441. }
  442. }
  443. </script>
  444. <style scoped >
  445. .selectBtn{
  446. background-color: #f2f5fa;
  447. line-height: 20px;
  448. font-size: 16px;
  449. padding: 5px 5px 5px 15px;
  450. color: #333333;
  451. }
  452. .popover-form{
  453. padding: 20px;
  454. }
  455. .popover-btn{
  456. display: flex;
  457. height: 48px;
  458. }
  459. .popover-btn1{
  460. width: 100px;
  461. border: 1px solid #eee;
  462. text-align: center;
  463. line-height: 50px;
  464. }
  465. .popover-btn2{
  466. flex: 1;
  467. background-color: #1677FF ;
  468. text-align: center;
  469. line-height: 50px;
  470. color:#fff;
  471. }
  472. .select select{
  473. background-color: #eee;
  474. margin-top: 6px;
  475. }
  476. .mui-popover .title{
  477. margin-top: 12px ;
  478. }
  479. .returnCheckbox {
  480. display: flex;
  481. flex-wrap: wrap;
  482. }
  483. .returnCheckbox .mui-input-row {
  484. width:33%;
  485. }
  486. .mui-checkbox.mui-left input[type=checkbox]{
  487. left: 0;
  488. }
  489. .mui-checkbox.mui-left label {
  490. padding-left:24px;
  491. }
  492. .mui-checkbox input[type=checkbox]:checked:before{
  493. content: '\e443';
  494. }
  495. .mui-checkbox input[type=checkbox]:before, .mui-radio input[type=radio]:before{
  496. font-size: 20px;
  497. }
  498. .mui-checkbox input[type=checkbox], .mui-radio input[type=radio]{
  499. top:11px;
  500. }
  501. .mui-popover {
  502. position: fixed;
  503. background-color: #fff;
  504. z-index: 999;
  505. left: 0 !important;
  506. right: 0 !important;
  507. top: 44px !important;
  508. border-top: 1px solid #eee;
  509. border-radius: 0;
  510. width: 100%;
  511. box-shadow: none;
  512. }
  513. .mui-backdrop {
  514. top: 44px;
  515. }
  516. .barRight {
  517. float: right;
  518. display: flex;
  519. align-items: center;
  520. height: 44px;
  521. }
  522. .barRight a {
  523. margin-left: 3px;
  524. }
  525. .barRight i {
  526. font-size: 16px;
  527. }
  528. .returnScreen {
  529. margin-top: 14px;
  530. background-color: #fff;
  531. display: flex;
  532. justify-content: space-between;
  533. padding: 12px;
  534. }
  535. .returnScreen i {
  536. color: #D4D6D9;
  537. }
  538. .returnScreen .active {
  539. color: #1677FF;
  540. }
  541. .returnTime {
  542. display: flex;
  543. align-items: center;
  544. }
  545. .returnTime p {
  546. font-size: 18px;
  547. margin-right: 6px;
  548. }
  549. .returnChart {
  550. /* //padding: 0 16px; */
  551. background-color: #fff;
  552. }
  553. .returnChart dt {
  554. padding: 16px 16px;
  555. }
  556. .returnChart dt span {
  557. position: relative;
  558. padding-left: 15px;
  559. font-size: 18px;
  560. }
  561. .returnChart dt span:before {
  562. content: '';
  563. position: absolute;
  564. width: 4px;
  565. height: 14px;
  566. background-color: #1677FF;
  567. border-radius: 2px;
  568. left: 0;
  569. top: 2px;
  570. }
  571. .returnChart dd {
  572. padding-bottom: 16px;
  573. margin: 0;
  574. }
  575. .returnHead {
  576. padding: 20px;
  577. background-color: #fff;
  578. }
  579. .returnUnit {
  580. display: flex;
  581. align-items: center;
  582. }
  583. .returnData {
  584. display: flex;
  585. align-items: center;
  586. }
  587. .returnUnit .returnUnit-item {
  588. width: 36px;
  589. text-align: center;
  590. line-height: 48px;
  591. margin-right: 1px;
  592. }
  593. .returnData .returnData-item {
  594. height: 48px;
  595. width: 36px;
  596. background-color: #101010;
  597. text-align: center;
  598. line-height: 48px;
  599. color: #fff;
  600. font-size: 36px;
  601. margin-right: 1px;
  602. }
  603. .returnData span {
  604. margin-left: 5px;
  605. }
  606. .colorRed {
  607. color: #900005;
  608. }
  609. .bgRed {
  610. background-color: #900005 !important;
  611. }
  612. .returnRadio {
  613. display: flex;
  614. flex-wrap: wrap;
  615. margin-top: 12px;
  616. }
  617. .returnRadio .mui-input-row {
  618. width: 50%;
  619. }
  620. .mui-radio.mui-left input[type=radio] {
  621. left: 0;
  622. }
  623. .mui-radio.mui-left label {
  624. padding-left: 24px;
  625. }
  626. .returnChartBlue {
  627. background-image: linear-gradient(0deg, #034373, #007BD3);
  628. margin-top: 0;
  629. }
  630. .returnChartBlue dt span {
  631. color: #fff;
  632. }
  633. .returnChartBlue dt span:before {
  634. content: '';
  635. position: absolute;
  636. width: 4px;
  637. height: 14px;
  638. background-color: #fff;
  639. border-radius: 2px;
  640. left: 0;
  641. top: 2px;
  642. }
  643. </style>
  644. <style src="$project/assets/css/mui.picker.min.css"></style>