|
|
|
|
@ -11,7 +11,7 @@ |
|
|
|
|
<div class="tit-r"> |
|
|
|
|
<span style="color: #fff;">选择时间:</span> |
|
|
|
|
<el-date-picker size="mini" v-model="selectMonth" type="month" placeholder="选择月" @change="changeMonth" |
|
|
|
|
style="width: 1.2rem;margin-right: 0.26rem;" format="yyyy-MM" value-format="yyyy-MM"> |
|
|
|
|
:clearable="false" style="width: 1.2rem;margin-right: 0.26rem;" format="yyyy-MM" value-format="yyyy-MM"> |
|
|
|
|
</el-date-picker> |
|
|
|
|
单位:kw·h |
|
|
|
|
</div> |
|
|
|
|
@ -84,7 +84,7 @@ |
|
|
|
|
<script> |
|
|
|
|
import tit from "./tit.vue"; |
|
|
|
|
import { mapGetters } from "vuex"; |
|
|
|
|
import {getTotalElectricity,getMonthElectricity} from "@/api/energySources/energySources" |
|
|
|
|
import { getTotalElectricity, getMonthElectricity } from "@/api/energySources/energySources" |
|
|
|
|
export default { |
|
|
|
|
props: { |
|
|
|
|
deptName: { |
|
|
|
|
@ -95,13 +95,13 @@ export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
num: 0, |
|
|
|
|
yearNum:0, |
|
|
|
|
monthNum:0, |
|
|
|
|
yesterdayNum:0, |
|
|
|
|
todayNum:0, |
|
|
|
|
selectMonth:'', |
|
|
|
|
currentMonthData:[120, 200, 150, 80, 70, 110, 130], |
|
|
|
|
lastMonthData:[150, 120, 180, 60, 40, 130, 150], |
|
|
|
|
yearNum: 0, |
|
|
|
|
monthNum: 0, |
|
|
|
|
yesterdayNum: 0, |
|
|
|
|
todayNum: 0, |
|
|
|
|
selectMonth: '', |
|
|
|
|
currentMonthData: [120, 200, 150, 80, 70, 110, 130], |
|
|
|
|
lastMonthData: [150, 120, 180, 60, 40, 130, 150], |
|
|
|
|
timeFun: null |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
@ -110,7 +110,7 @@ export default { |
|
|
|
|
}, |
|
|
|
|
created() { |
|
|
|
|
this.selectMonth = this.$moment().format('YYYY-MM') |
|
|
|
|
if(this.deptName){ |
|
|
|
|
if (this.deptName) { |
|
|
|
|
this.getTotal() |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
this.getTrend() |
|
|
|
|
@ -120,15 +120,15 @@ export default { |
|
|
|
|
}, 300000) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
beforeDestroyed() { |
|
|
|
|
beforeDestroy() { |
|
|
|
|
clearInterval(this.timeFun) |
|
|
|
|
}, |
|
|
|
|
computed:{ |
|
|
|
|
computed: { |
|
|
|
|
...mapGetters(["userInfo", "permission"]), |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
getTotal(){ |
|
|
|
|
getTotalElectricity({manufacturerBrand:this.deptName}).then(res =>{ |
|
|
|
|
getTotal() { |
|
|
|
|
getTotalElectricity({ manufacturerBrand: this.deptName }).then(res => { |
|
|
|
|
let data = res.data.data |
|
|
|
|
this.yearNum = data.currentYear.toString().split('') |
|
|
|
|
this.monthNum = data.currentMonth.toString().split('') |
|
|
|
|
@ -136,10 +136,10 @@ export default { |
|
|
|
|
this.todayNum = data.today.toString().split('') |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
getTrend(){ |
|
|
|
|
getTrend() { |
|
|
|
|
this.currentMonthData = []; |
|
|
|
|
this.lastMonthData = [] |
|
|
|
|
getMonthElectricity({manufacturerBrand:this.deptName,currentMonth:this.selectMonth}).then(res =>{ |
|
|
|
|
getMonthElectricity({ manufacturerBrand: this.deptName, currentMonth: this.selectMonth }).then(res => { |
|
|
|
|
let currData = res.data.data.currentMonth |
|
|
|
|
let lastData = res.data.data.lastMonth |
|
|
|
|
Object.keys(currData).forEach((key) => { |
|
|
|
|
@ -148,12 +148,12 @@ export default { |
|
|
|
|
Object.keys(lastData).forEach((key) => { |
|
|
|
|
this.lastMonthData.push(lastData[key]) |
|
|
|
|
}); |
|
|
|
|
this.$nextTick(() =>{ |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
this.echartsInit() |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
changeMonth(){ |
|
|
|
|
changeMonth() { |
|
|
|
|
this.getTrend() |
|
|
|
|
}, |
|
|
|
|
echartsInit() { |
|
|
|
|
|