Info.vue 16 KB

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