|
@@ -3,30 +3,30 @@
|
|
|
<div class="stationPowerControSeach">
|
|
|
<div class="seach_top">
|
|
|
<div class="exceed">
|
|
|
- <span class="exceedName">月份:</span>
|
|
|
- <el-date-picker v-model="pickerTime" @change="changeTime" format="YYYY-MM" type="month"
|
|
|
- placeholder="选择月份" />
|
|
|
+ <span class="exceedName">时间:</span>
|
|
|
+ <el-date-picker v-model="pickerTime" @change="changeTime" format="YYYY-MM-DD" type="date"
|
|
|
+ placeholder="选择时间" />
|
|
|
</div>
|
|
|
<el-button type="primary" @click="seachData">计 算</el-button>
|
|
|
<el-button @click="exportExcel">导 出</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="stationPowerControTable">
|
|
|
- <p class="tableTitle">{{titelMonth}}发电量预测(拟合)</p>
|
|
|
+ <p class="tableTitle">{{titelMonth}}场站中长期电量未来40天预测</p>
|
|
|
<span class="tableUnit">单位:m/s,万kwh</span>
|
|
|
<div :style="tableHeight">
|
|
|
<div class="tablestyle warn-table" style="margin-top: 10px">
|
|
|
<!-- :span-method="mergeSameCells" -->
|
|
|
- <el-table :data="tableData" border style="width: 100%" :max-height="tableMainHeight"
|
|
|
- ref="stationPowerTable" element-loading-background="rgba(0,0,0,.5)"
|
|
|
- :header-cell-style="{ 'text-align': 'center' }">
|
|
|
+ <el-table :data="tableData" v-loading="loading" border style="width: 100%"
|
|
|
+ :max-height="tableMainHeight" ref="stationPowerTable"
|
|
|
+ element-loading-background="rgba(0,0,0,.5)" :header-cell-style="{ 'text-align': 'center' }">
|
|
|
<el-table-column prop="name" label="名称" width="200" align="center" fixed>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="time" label="周期" width="73" align="center" fixed>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="日期" align="center">
|
|
|
- <el-table-column :prop="item.value" :label="index+1" align="center"
|
|
|
- v-for="(item, index) in 40" :key="index">
|
|
|
+ <el-table-column :prop="item.value" :label="item.label" align="center"
|
|
|
+ v-for="(item, index) in tableColumn" :key="index">
|
|
|
<template #default="scope">
|
|
|
{{scope.row[scope.row.nameEn+(index+1)]}}
|
|
|
</template>
|
|
@@ -41,7 +41,9 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import {} from "../../api/api";
|
|
|
+ import {
|
|
|
+ apiGetallStationPower
|
|
|
+ } from "../../api/api";
|
|
|
|
|
|
import jsonData from "./component/stationPowerControl.json";
|
|
|
import dayjs from "dayjs";
|
|
@@ -53,6 +55,7 @@
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ loading: false,
|
|
|
pickerTime: "",
|
|
|
titelMonth: "",
|
|
|
tableData: [],
|
|
@@ -72,9 +75,10 @@
|
|
|
},
|
|
|
},
|
|
|
created() {
|
|
|
- this.pickerTime = dayjs(new Date()).format("YYYY-MM")
|
|
|
- this.titelMonth = this.pickerTime.split("-")[0] + "年" + this.pickerTime.split("-")[1] + "月"
|
|
|
- this.getTableData();
|
|
|
+ this.pickerTime = dayjs(new Date()).format("YYYY-MM-DD")
|
|
|
+ this.titelMonth = this.pickerTime.split("-")[0] + "年" + this.pickerTime.split("-")[1] + "月" + this
|
|
|
+ .pickerTime.split("-")[2] + "日"
|
|
|
+ this.getStationData();
|
|
|
},
|
|
|
computed: {
|
|
|
tableHeight() {
|
|
@@ -90,12 +94,56 @@
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
+ getStationData() {
|
|
|
+ let that = this;
|
|
|
+ that.loading = true
|
|
|
+ let params = {
|
|
|
+ date: that.pickerTime
|
|
|
+ }
|
|
|
+ apiGetallStationPower(params).then(res => {
|
|
|
+ that.loading = false
|
|
|
+ if (res && res.data) {
|
|
|
+ // that.tableData = res.data.power
|
|
|
+ res.data.power.forEach(iv => {
|
|
|
+ let obj = {
|
|
|
+ name: iv.name,
|
|
|
+ nameEn: iv.nameEn,
|
|
|
+ time: iv.time
|
|
|
+ }
|
|
|
+ iv.power.forEach((ic, idx) => {
|
|
|
+ (obj[obj.nameEn + (idx + 1)]) = ic.toFixed(2)
|
|
|
+ })
|
|
|
+ that.tableData.push(obj)
|
|
|
+ })
|
|
|
+ console.log("table=====>>>>", that.tableData)
|
|
|
+ res.data.title.forEach((it, index) => {
|
|
|
+ let obj = {
|
|
|
+ label: it,
|
|
|
+ value: index
|
|
|
+ }
|
|
|
+ that.tableColumn.push(obj)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }).catch(e => {
|
|
|
+ that.loading = false
|
|
|
+ let tableColumn = [...Array(40).keys()].map(i => i + 1)
|
|
|
+ tableColumn.forEach((it, index) => {
|
|
|
+ let obj = {
|
|
|
+ label: it,
|
|
|
+ value: index
|
|
|
+ }
|
|
|
+ that.tableColumn.push(obj)
|
|
|
+ })
|
|
|
+ that.tableData = jsonData.data
|
|
|
+ })
|
|
|
+ },
|
|
|
changeTime(val) {
|
|
|
|
|
|
},
|
|
|
seachData() {
|
|
|
let str = dayjs(this.pickerTime).format("YYYY-MM")
|
|
|
this.titelMonth = str.split("-")[0] + "年" + str.split("-")[1] + "月"
|
|
|
+ this.getStationData()
|
|
|
},
|
|
|
exportExcel() {
|
|
|
let $e = this.$refs.stationPowerTable.$el
|
|
@@ -123,10 +171,6 @@
|
|
|
if (typeof console !== 'undefined') console.error(e)
|
|
|
}
|
|
|
},
|
|
|
- getTableData() {
|
|
|
- let that = this;
|
|
|
- this.tableData = jsonData.data
|
|
|
- },
|
|
|
mergeSameCells({
|
|
|
row,
|
|
|
column,
|