| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> |
| | | <el-form |
| | | :model="queryParams" |
| | | ref="queryForm" |
| | | :inline="true" |
| | | label-width="68px" |
| | | > |
| | | <el-form-item label="报表类型"> |
| | | <el-radio-group v-model="queryParams.timeType"> |
| | | <el-radio v-for="dict in dateTypeOptions" :key="dict.dictValue" :label="dict.dictValue" @change="handleTime(dict.dictValue)">{{dict.dictLabel}}</el-radio> |
| | | <el-radio |
| | | v-for="dict in dateTypeOptions" |
| | | :key="dict.dictValue" |
| | | :label="dict.dictValue" |
| | | @change="handleTime(dict.dictValue)" |
| | | >{{ dict.dictLabel }}</el-radio |
| | | > |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-date-picker clearable size="small" style="width: 200px" |
| | | <el-date-picker |
| | | clearable |
| | | size="small" |
| | | style="width: 200px" |
| | | v-model="queryParams.dataTime" |
| | | :type="dateTypes" |
| | | :value-format="valueFormat" |
| | | placeholder="选择日期"> |
| | | placeholder="选择日期" |
| | | > |
| | | </el-date-picker> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> |
| | | <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> |
| | | <el-button |
| | | type="primary" |
| | | icon="el-icon-search" |
| | | size="mini" |
| | | @click="handleQuery" |
| | | >搜索</el-button |
| | | > |
| | | <el-button icon="el-icon-refresh" size="mini" @click="resetQuery" |
| | | >重置</el-button |
| | | > |
| | | </el-form-item> |
| | | </el-form> |
| | | <el-row :gutter="20"> |
| | |
| | | </el-col> |
| | | </el-row> |
| | | <el-table :data="list" border> |
| | | <el-table-column label="名称" align="center" prop="label">{{label}}</el-table-column> |
| | | <el-table-column label="名称" align="center" prop="label">{{ |
| | | label |
| | | }}</el-table-column> |
| | | <el-table-column label="总量" align="center" |
| | | ><template slot-scope="scope">{{ |
| | | numFilter(scope.row.value_total) |
| | | }}</template></el-table-column |
| | | > |
| | | <!--<el-table-column label="产出" align="center"> <template slot-scope="scope">{{numFilter(scope.row.value_CC)}}</template></el-table-column>--> |
| | | <el-table-column label="消耗" align="center"> <template slot-scope="scope">{{numFilter(scope.row.value_XH)}}</template></el-table-column> |
| | | <el-table-column label="外供" align="center"> <template slot-scope="scope">{{numFilter(scope.row.value_WG)}}</template></el-table-column> |
| | | <el-table-column label="损耗" align="center"> <template slot-scope="scope">{{numFilter(scope.row.value_SH)}}</template></el-table-column> |
| | | <el-table-column label="总量" align="center"><template slot-scope="scope">{{numFilter(scope.row.value_total)}}</template></el-table-column> |
| | | <el-table-column label="消耗" align="center"> |
| | | <template slot-scope="scope">{{ |
| | | numFilter(scope.row.value_XH) |
| | | }}</template></el-table-column |
| | | > |
| | | <!-- <el-table-column label="外供" align="center"> <template slot-scope="scope">{{numFilter(scope.row.value_WG)}}</template></el-table-column> --> |
| | | <el-table-column label="损耗" align="center"> |
| | | <template slot-scope="scope">{{ |
| | | numFilter(scope.row.value_SH) |
| | | }}</template></el-table-column |
| | | > |
| | | </el-table> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import {lossAnalysisList,energyLossTable} from '@/api/energyBalance/energyBalance' |
| | | import PieChart from './PieChart' |
| | | import { |
| | | lossAnalysisList, |
| | | energyLossTable |
| | | } from "@/api/energyBalance/energyBalance"; |
| | | import PieChart from "./PieChart"; |
| | | export default { |
| | | components: {PieChart}, |
| | | data() { |
| | |
| | | pageSize: 10, |
| | | indexCode: undefined, |
| | | timeType:"DAY", |
| | | dataTime: undefined, |
| | | dataTime: undefined |
| | | }, |
| | | dateTypes: 'date', |
| | | dateTypes: "date", |
| | | valueFormat:"yyyy-MM-dd", |
| | | skinName:"", |
| | | label:"", |
| | | lineChartData:{expectedData: [], |
| | | actualData: [],label:""}, |
| | | lineChartData: { expectedData: [], actualData: [], label: "" } |
| | | }; |
| | | }, |
| | | created() { |
| | | this.getTime(); |
| | | this.getDicts("energyBalance").then(response => { |
| | | this.dateTypeOptions = response.data; |
| | | this.queryParams.timeType = this.dateTypeOptions.find(f => f.isDefault === 'Y').dictValue; |
| | | this.queryParams.timeType = this.dateTypeOptions.find( |
| | | f => f.isDefault === "Y" |
| | | ).dictValue; |
| | | }); |
| | | this.getConfigKey("energyBalance").then(response => { |
| | | this.skinName=response.msg; |
| | |
| | | modelNodeChange(modelNode) { |
| | | this.queryParams.indexCode=modelNode.id; |
| | | this.label=modelNode.label; |
| | | this.getList(this.queryParams) |
| | | this.getList(this.queryParams); |
| | | }, |
| | | getList() { |
| | | lossAnalysisList(this.queryParams).then(response => { |
| | |
| | | let total=""; |
| | | response.data.forEach(item => { |
| | | if(item.indexCode.indexOf("_total")==-1){ |
| | | actualData.push(item.indexName) |
| | | expectedData.push({"name":item.indexName,"value":this.numFilter(item.value)}); |
| | | actualData.push(item.indexName); |
| | | expectedData.push({ |
| | | name: item.indexName, |
| | | value: this.numFilter(item.value) |
| | | }); |
| | | }else{ |
| | | total=this.numFilter(item.value) |
| | | total = this.numFilter(item.value); |
| | | } |
| | | }) |
| | | }); |
| | | this.lineChartData.total=total; |
| | | this.lineChartData.actualData=actualData; |
| | | this.lineChartData.expectedData=expectedData; |
| | |
| | | this.handleQuery(); |
| | | }, |
| | | handleTime(date){ |
| | | if(date=='YEAR'){ |
| | | this.dateTypes= 'year', |
| | | this.valueFormat='yyyy' |
| | | }else if(date=='MONTH'){ |
| | | this.dateTypes= 'month', |
| | | this.valueFormat='yyyy-MM' |
| | | if (date == "YEAR") { |
| | | (this.dateTypes = "year"), (this.valueFormat = "yyyy"); |
| | | } else if (date == "MONTH") { |
| | | (this.dateTypes = "month"), (this.valueFormat = "yyyy-MM"); |
| | | }else{ |
| | | this.dateTypes= 'date', |
| | | this.valueFormat='yyyy-MM-dd' |
| | | (this.dateTypes = "date"), (this.valueFormat = "yyyy-MM-dd"); |
| | | } |
| | | }, |
| | | getTime(){ |
| | | var date = new Date() |
| | | var year = date.getFullYear() |
| | | var month = date.getMonth() + 1 |
| | | var date = date.getDate() |
| | | month = month < 10 ? '0' + month : month |
| | | date = date < 10 ? '0' + date : date |
| | | this.queryParams.dataTime = year + '-' + month + '-' + (date-1) |
| | | var date = new Date(); |
| | | var year = date.getFullYear(); |
| | | var month = date.getMonth() + 1; |
| | | var date = date.getDate(); |
| | | month = month < 10 ? "0" + month : month; |
| | | date = date < 10 ? "0" + date : date; |
| | | this.queryParams.dataTime = year + "-" + month + "-" + (date - 1); |
| | | }, |
| | | numFilter(value) {// 截取当前数据到小数点后的几位 |
| | | let realVal = '' ; |
| | | if (!isNaN(value) && value !== '' && value !== null) { |
| | | realVal = parseFloat(value).toFixed(this.skinName) |
| | | numFilter(value) { |
| | | // 截取当前数据到小数点后的几位 |
| | | let realVal = ""; |
| | | if (!isNaN(value) && value !== "" && value !== null) { |
| | | realVal = parseFloat(value).toFixed(this.skinName); |
| | | } else { |
| | | realVal = '--' |
| | | realVal = "--"; |
| | | } |
| | | return realVal |
| | | }, |
| | | return realVal; |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | |
| | | } |
| | | @keyframes fade { |
| | | from { |
| | | opacity: 1.0; |
| | | opacity: 1; |
| | | } |
| | | 50% { |
| | | opacity: 0.4; |
| | | } |
| | | to { |
| | | opacity: 1.0; |
| | | opacity: 1; |
| | | } |
| | | } |
| | | |
| | | @-webkit-keyframes fade { |
| | | from { |
| | | opacity: 1.0; |
| | | opacity: 1; |
| | | } |
| | | 50% { |
| | | opacity: 0.4; |
| | | } |
| | | to { |
| | | opacity: 1.0; |
| | | opacity: 1; |
| | | } |
| | | } |
| | | </style> |