123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726 |
- <template>
- <div>
- <common @asynCallBack="asynCallBack"></common>
-
- <header class="mui-bar mui-bar-nav">
- <div class="barRight">
- <i class="mui-icon-extra mui-icon-extra-filter"></i>
- <a @click="openPopover" >过滤</a>
- </div>
- <h1 class="mui-title">能源中心</h1>
- <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
- </header>
- <div id="popover" class="mui-popover">
- <div class="popover-form">
- <div class="title">查询日期</div>
- <div class="selectBtn" @click="selectData2" >
- {{queryDate2}}
- <i class="mui-icon mui-icon-arrowdown" style=" float: right;"></i>
- </div>
-
- <div class="title">功率</div>
- <div class="returnCheckbox">
- <div class="mui-input-row mui-checkbox mui-left">
- <label>总功率</label>
- <input name="checkbox1" v-model="showlist1" value="总功率" type="checkbox" >
- </div>
- <div class="mui-input-row mui-checkbox mui-left">
- <label>A相功率</label>
- <input name="checkbox1" v-model="showlist1" value="A相功率" type="checkbox" >
- </div>
- <div class="mui-input-row mui-checkbox mui-left">
- <label>B相功率</label>
- <input name="checkbox1" v-model="showlist1" value="B相功率" type="checkbox" >
- </div>
- <div class="mui-input-row mui-checkbox mui-left">
- <label>C相功率</label>
- <input name="checkbox1" v-model="showlist1" value="C相功率" type="checkbox" >
- </div>
- </div>
- <div class="title">电流</div>
- <div class="returnCheckbox">
- <div class="mui-input-row mui-checkbox mui-left">
- <label>A相电流</label>
- <input name="checkbox2" v-model="showlist2" value="A相电流" type="checkbox" checked>
- </div>
- <div class="mui-input-row mui-checkbox mui-left">
- <label>B相电流</label>
- <input name="checkbox2" v-model="showlist2" value="B相电流" type="checkbox" checked>
- </div>
- <div class="mui-input-row mui-checkbox mui-left">
- <label>C相电流</label>
- <input name="checkbox2" v-model="showlist2" value="C相电流" type="checkbox" checked>
- </div>
- </div>
- <div class="title">电压</div>
- <div class="returnCheckbox">
- <div class="mui-input-row mui-checkbox mui-left">
- <label>A相电压</label>
- <input name="checkbox3" v-model="showlist3" value="A相电压" type="checkbox" checked>
- </div>
- <div class="mui-input-row mui-checkbox mui-left">
- <label>B相电压</label>
- <input name="checkbox3" v-model="showlist3" value="B相电压" type="checkbox" checked>
- </div>
- <div class="mui-input-row mui-checkbox mui-left">
- <label>C相电压</label>
- <input name="checkbox3" v-model="showlist3" value="C相电压" type="checkbox" checked>
- </div>
- </div>
- </div>
- <div class="popover-btn">
- <div class="popover-btn1" @click="init(true)">重置</div>
- <div class="popover-btn2" @click="submitBtn()">确定</div>
- </div>
- </div>
- <div class="mui-content">
- <div class="returnHead">
- <div class="returnUnit">
- <div class="returnUnit-item">百万</div>
- <div class="returnUnit-item">拾万</div>
- <div class="returnUnit-item">万</div>
- <div class="returnUnit-item">千</div>
- <div class="returnUnit-item">百</div>
- <div class="returnUnit-item">拾</div>
- <div class="returnUnit-item">1</div>
- <div class="returnUnit-item colorRed">0.1</div>
- <span style="min-width: 32px;"> </span>
- </div>
- <div class="returnData">
- <div class="returnData-item" v-text="showTop[0]"></div>
-
- <div class="returnData-item" v-text="showTop[1]" ></div>
- <div class="returnData-item" v-text="showTop[2]" ></div>
- <div class="returnData-item" v-text="showTop[3]" ></div>
- <div class="returnData-item" v-text="showTop[4]" ></div>
- <div class="returnData-item" v-text="showTop[5]" ></div>
- <div class="returnData-item" v-text="showTop[6]" ></div>
- <div class="returnData-item bgRed" v-text="showTop[7]" ></div>
- <span>kW·h</span>
- </div>
- <div class="returnRadio">
- <div class="mui-input-row mui-radio mui-left">
- <label>总用电量</label>
- <input name="radio1" value="0" v-model="selectType" @click="ck(0)" type="radio">
- </div>
- <div class="mui-input-row mui-radio mui-left">
- <label>当月用电量</label>
- <input name="radio1" value="1" v-model="selectType" @click="ck(1)" type="radio">
- </div>
- <div class="mui-input-row mui-radio mui-left">
- <label>上月用电量</label>
- <input name="radio1" value="2" v-model="selectType" @click="ck(2)" type="radio">
- </div>
- <div class="mui-input-row mui-radio mui-left">
- <label>当年用电量</label>
- <input name="radio1" value="3" v-model="selectType" @click="ck(3)" type="radio">
- </div>
- <div class="mui-input-row mui-radio mui-left">
- <label>当日用电量</label>
- <input name="radio1" value="4" v-model="selectType" @click="ck(4)" type="radio">
- </div>
- <div class="mui-input-row mui-radio mui-left">
- <label>查询其他月份</label>
- <input name="radio1" value="9" v-model="selectType" @click="ck(9)" type="radio">
- </div>
- </div>
- </div>
- <div class="returnScreen">
- <i class="mui-icon-extra mui-icon-extra-arrowleftcricle active"
-
- @click="ckDate(0)"></i>
- <div class="returnTime" @click="selectData">
- <p>{{queryDate}}</p>
- <i class="mui-icon mui-icon-arrowdown"></i>
- </div>
- <i class="mui-icon-extra mui-icon-extra-arrowrightcricle"
- :class="{
- active:queryDate!=nowDate
- }"
- @click="ckDate(1)" ></i>
- </div>
- <dl class="returnChart returnChartBlue">
- <dt><span>功率监测(kW)</span></dt>
- <dd>
- <div id="kwPicture" style="width:100%;height: 300px;">
-
- </div>
-
- </dd>
- </dl>
- <dl class="returnChart">
- <dt><span>电压监测(A)</span></dt>
- <dd>
- <div id="aPicture" style="width:100%;height: 300px;">
-
- </div>
- </dd>
- </dl>
- <dl class="returnChart">
- <dt><span>电压监测(V)</span></dt>
- <dd>
- <div id="vPicture" style="width:100%;height: 300px;">
-
- </div>
- </dd>
- </dl>
- </div>
- <loading :visible="isLoading"></loading>
-
- </div>
- </template>
- <script>
- require('$project/assets/js/mui.picker.min.js');
-
- import * as API from '@/apis/Other/energy'
- import Common from '$project/components/Common.vue'
- import Loading from '$project/components/Loading.vue'
- import {
- mapGetters,
- mapMutations
- } from 'vuex'
- import echarts from 'echarts'
-
- import 'echarts/lib/chart/line'
- import {
- currentTimeStamp,
- parseUnixTime,
- beforeTimeStamp
- } from '$project/utils'
- export default {
- name: 'MasterHealthArchives',
- components: {
- Common,
- Loading,
-
- },
- data() {
- return {
- isLoading: false,
- showTop:[0,0,0,0,0,0,0,0],
- nowDate:"",
-
- queryDate:"",
- queryDate2:"",
- selectType:"0",
- energyCenterElectricityObj:{},
- energyCenterMapObj:{},
-
- showlist1:[],
- showlist2:[],
- showlist3:[],
- }
- },
- mounted() {
-
-
- },
- created() {
-
- this.init()
- //this.queryDate='2022-06-08'
-
- },
- methods: {
- openPopover(){
- mui('#popover').popover('toggle');
- mui(".mui-scroll-wrapper").scroll()
- this.queryDate2=this.queryDate;
-
- },
- submitBtn(){
- this.queryDate=this.queryDate2;
-
- this.getEnergyCenterMap();
- this.getEnergyCenterElectricity();
-
- mui('#popover').popover('toggle');
- mui(".mui-scroll-wrapper").scroll()
- },
- init(bl){
- this.nowDate=parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}');
- this.queryDate=parseUnixTime(beforeTimeStamp(0), '{y}-{m}-{d}');
- this.queryDate2=parseUnixTime(beforeTimeStamp(0), '{y}-{m}-{d}');
-
- this.showlist1=['总功率','A相功率','B相功率','C相功率'];
-
- this.showlist2=['A相电流','B相电流','C相电流'];
- this.showlist3=['A相电压','B相电压','C相电压'];
- if(bl){
- mui('#popover').popover('toggle');
- mui(".mui-scroll-wrapper").scroll()
- }
- this.getEnergyCenterMap();
- this.getEnergyCenterElectricity();
- },
- //选择日期
- selectData() {
- var _this = this;
- var picker = new mui.DtPicker({
- "type": "date",
- "beginYear": 2020,
- "endYear": 2040,
- "endDate": new Date(),
- "value": _this.queryDate
- });
- picker.show(function(rs) {
- _this.queryDate = rs.text;
- _this.getEnergyCenterMap()
- picker.dispose();
- });
- },
- //选择日期
- selectData2() {
- mui('#popover').popover('toggle');
- mui(".mui-scroll-wrapper").scroll()
- var _this = this;
- var picker = new mui.DtPicker({
- "type": "date",
- "beginYear": 2020,
- "endYear": 2040,
- "endDate": new Date(),
- "value": _this.queryDate2
- });
- picker.show(function(rs) {
- _this.queryDate2 = rs.text;
-
- mui('#popover').popover('toggle');
- mui(".mui-scroll-wrapper").scroll()
- picker.dispose();
- });
- },
- ckDate(bl){
-
- if(bl&&this.queryDate==this.nowDate){
- return
- }
- let dd = new Date(this.queryDate)
- if(bl){
- dd.setDate(dd.getDate() + 1)
- }else{
- dd.setDate(dd.getDate() - 1)
- }
- let time = dd.getTime()
-
- this.queryDate=parseUnixTime(time, '{y}-{m}-{d}');
- this.getEnergyCenterMap()
- },
- ck(val){
- if(val!=this.selectType){
- this.selectType=val;
- this.getEnergyCenterElectricity()
- }
- },
- //获取详情
- getEnergyCenterMap() {
- this.isLoading = true;
- API.energyCenterMap({
- queryDate:this.queryDate
- }).then(response => {
- this.isLoading = false;
-
- this.energyCenterMapObj = response;
-
- this.setMap();
-
- }).catch(error => {
- this.isLoading = false;
- mui.toast(error);
- })
- },
- setMap(bl){
-
- var list1=[];
- var list2=[];
- var list3=[];
- var sz1=['总功率','A相功率','B相功率','C相功率'];
- var sz2=['A相电流','B相电流','C相电流'];
- var sz3=['A相电压','B相电压','C相电压'];
- this.setSz(sz1,['allp','ap','bp','cp'],list1,this.energyCenterMapObj,this.showlist1)
- this.setSz(sz2,['aa','ba','ca'],list2,this.energyCenterMapObj,this.showlist2)
- this.setSz(sz3,['av','bv','cv'],list3,this.energyCenterMapObj,this.showlist3)
- console.log(this.list1)
- //获取图表数据
- this.echarts('kwPicture',1,this.showlist1,list1);
-
- //获取图表数据
- this.echarts('aPicture',0,this.showlist2,list2);
- //获取图表数据
- this.echarts('vPicture',0,this.showlist3,list3);
-
-
- },
- setSz(sz1,sz2,list,energyCenterMapObj,showList){
-
- for(var j in sz1){
- var k =showList.indexOf(sz1[j]);
- if(k==-1){
- continue
- }
- var ap={
- name: sz1[j],
- type: 'line',
- stack: 'Total',
- data:[]
- }
- list.push(ap)
- for(var i in energyCenterMapObj){
- var obj=energyCenterMapObj[i][sz2[j]];
- if(obj){
- ap.data.push(obj);
- }
-
- }
- }
- console.log(list)
-
-
- },
- //获取详情
- getEnergyCenterElectricity() {
-
- this.isLoading = true;
- API.energyCenterElectricity({
- queryDate:this.queryDate,
- type:this.selectType
- }).then(response => {
- this.isLoading = false;
- this.showTop=[0,0,0,0,0,0,0,0]
- this.energyCenterElectricityObj = response;
-
- var electricity=this.energyCenterElectricityObj.electricity;
- if(electricity){
- var sz= electricity.split(".")
- var str1=sz[0];
- var str2=[];
- if(sz.length>1){
- str2=sz[1];
- this.showTop[7]=str2[0];
- }
- var j=0;
- for(var i in str1){
- if(i!=undefined){
- this.showTop[6-str1.length+j+1]=str1[i]
- }
- j++;
- }
- this.$forceUpdate()
- }
-
- //showTop
- }).catch(error => {
- this.isLoading = false;
- mui.toast(error);
- })
- },
- asynCallBack(){},
- echarts(className,color,legenddata,seriesdata){
- var colorName=""
- if(color=='1'){
- colorName="#ECEDF0"
- }else{
- colorName="#333"
- }
-
- var myChart = echarts.init(document.getElementById(className), 'light');
- myChart.clear()
- var option = {
-
- tooltip: {
- trigger: 'axis',
- borderColor:"#F0F0F0",
- borderWidth:1,
- backgroundColor:"#ffffff",
- textStyle:{
- color:"#333"
- }
- },
- legend: {
- data: legenddata,
- textStyle: {
- color: colorName
- }
- },
- grid: {
- left: '3%',
- right: '4%',
- bottom: '3%',
- containLabel: true
- },
-
- xAxis: {
- type: 'category',
- boundaryGap: false,
- 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'],
- axisLabel:{
- textStyle:{
- color:colorName
- }
- },
- axisLine:{
- show:true,
- lineStyle:{
- color:colorName
- }
- },
- },
- yAxis: {
- type: 'value',
- axisLabel:{
- textStyle:{
- color:colorName
- }
- }, axisLine:{
- show:true,
- lineStyle:{
- color:colorName
- }
- },
- },
- series: seriesdata
- };
- myChart.setOption(option);
- }
- }
- }
- </script>
- <style scoped >
- .selectBtn{
- background-color: #f2f5fa;
- line-height: 20px;
- font-size: 16px;
- padding: 5px 5px 5px 15px;
- color: #333333;
- }
- .popover-form{
- padding: 20px;
- }
- .popover-btn{
- display: flex;
- height: 48px;
-
- }
- .popover-btn1{
- width: 100px;
- border: 1px solid #eee;
- text-align: center;
- line-height: 50px;
- }
- .popover-btn2{
- flex: 1;
- background-color: #1677FF ;
- text-align: center;
- line-height: 50px;
- color:#fff;
- }
- .select select{
- background-color: #eee;
- margin-top: 6px;
- }
- .mui-popover .title{
- margin-top: 12px ;
- }
- .returnCheckbox {
- display: flex;
- flex-wrap: wrap;
- }
-
- .returnCheckbox .mui-input-row {
- width:33%;
- }
-
- .mui-checkbox.mui-left input[type=checkbox]{
- left: 0;
- }
- .mui-checkbox.mui-left label {
- padding-left:24px;
- }
- .mui-checkbox input[type=checkbox]:checked:before{
- content: '\e443';
- }
- .mui-checkbox input[type=checkbox]:before, .mui-radio input[type=radio]:before{
- font-size: 20px;
- }
- .mui-checkbox input[type=checkbox], .mui-radio input[type=radio]{
- top:11px;
- }
- .mui-popover {
- position: fixed;
- background-color: #fff;
- z-index: 999;
- left: 0 !important;
- right: 0 !important;
- top: 44px !important;
- border-top: 1px solid #eee;
- border-radius: 0;
- width: 100%;
- box-shadow: none;
- }
- .mui-backdrop {
- top: 44px;
- }
- .barRight {
- float: right;
- display: flex;
- align-items: center;
- height: 44px;
- }
- .barRight a {
- margin-left: 3px;
- }
- .barRight i {
- font-size: 16px;
- }
- .returnScreen {
- margin-top: 14px;
- background-color: #fff;
- display: flex;
- justify-content: space-between;
- padding: 12px;
- }
- .returnScreen i {
- color: #D4D6D9;
- }
- .returnScreen .active {
- color: #1677FF;
- }
- .returnTime {
- display: flex;
- align-items: center;
- }
- .returnTime p {
- font-size: 18px;
- margin-right: 6px;
- }
- .returnChart {
- /* //padding: 0 16px; */
- background-color: #fff;
- }
- .returnChart dt {
- padding: 16px 16px;
- }
- .returnChart dt span {
- position: relative;
- padding-left: 15px;
- font-size: 18px;
- }
- .returnChart dt span:before {
- content: '';
- position: absolute;
- width: 4px;
- height: 14px;
- background-color: #1677FF;
- border-radius: 2px;
- left: 0;
- top: 2px;
- }
- .returnChart dd {
- padding-bottom: 16px;
- margin: 0;
- }
- .returnHead {
- padding: 20px;
- background-color: #fff;
- }
- .returnUnit {
- display: flex;
- align-items: center;
- }
- .returnData {
- display: flex;
- align-items: center;
- }
- .returnUnit .returnUnit-item {
- width: 36px;
- text-align: center;
- line-height: 48px;
- margin-right: 1px;
- }
- .returnData .returnData-item {
- height: 48px;
- width: 36px;
- background-color: #101010;
- text-align: center;
- line-height: 48px;
- color: #fff;
- font-size: 36px;
- margin-right: 1px;
- }
- .returnData span {
- margin-left: 5px;
- }
- .colorRed {
- color: #900005;
- }
- .bgRed {
- background-color: #900005 !important;
- }
- .returnRadio {
- display: flex;
- flex-wrap: wrap;
- margin-top: 12px;
- }
- .returnRadio .mui-input-row {
- width: 50%;
- }
- .mui-radio.mui-left input[type=radio] {
- left: 0;
- }
- .mui-radio.mui-left label {
- padding-left: 24px;
- }
- .returnChartBlue {
- background-image: linear-gradient(0deg, #034373, #007BD3);
- margin-top: 0;
- }
- .returnChartBlue dt span {
- color: #fff;
- }
- .returnChartBlue dt span:before {
- content: '';
- position: absolute;
- width: 4px;
- height: 14px;
- background-color: #fff;
- border-radius: 2px;
- left: 0;
- top: 2px;
- }
-
- </style>
- <style src="$project/assets/css/mui.picker.min.css"></style>
|