fix:coding#658能源监察报表填数

This commit is contained in:
shijing 2024-12-05 17:48:31 +08:00
parent 4909cadf77
commit 520004edb9
1 changed files with 57 additions and 34 deletions

View File

@ -17,29 +17,29 @@
></el-option> ></el-option>
</el-select> </el-select>
<el-date-picker <el-date-picker
v-model="query.month" v-model="query.searchDay"
type="month" type="date"
value-format="YYYY-MM" value-format="YYYY-MM-DD"
format="YYYY-MM" format="YYYY-MM-DD"
placeholder="查询月份" placeholder="查询日期"
v-if="query.type==0" v-if="query.type==0"
class="headerSearch" class="headerSearch"
/> />
<el-date-picker <el-date-picker
v-model="query.year" v-model="query.searchMonth"
type="year" type="month"
value-format="YYYY" value-format="YYYY-MM"
format="YYYY" format="YYYY-MM"
placeholder="查询份" placeholder="查询份"
v-if="query.type==1" v-if="query.type==1"
class="headerSearch" class="headerSearch"
/> />
<el-date-picker <el-date-picker
v-model="query.yearStart" v-model="query.searchYear"
type="year" type="year"
value-format="YYYY" value-format="YYYY"
format="YYYY" format="YYYY"
placeholder="起始年份" placeholder="查询年份"
v-if="query.type==2" v-if="query.type==2"
class="headerSearch" class="headerSearch"
/> />
@ -95,6 +95,7 @@
month:'', month:'',
yearStart:'', yearStart:'',
}, },
currentDay:'',
tableName:'能源监察日报表', tableName:'能源监察日报表',
options:[ options:[
{id:0,name:'日统计'}, {id:0,name:'日统计'},
@ -103,21 +104,17 @@
], ],
tableDatas:[ tableDatas:[
{index:1,name:'水泥单位产品综合能耗(kgce/t)',value:0,note:''}, {index:1,name:'水泥单位产品综合能耗(kgce/t)',value:0,note:''},
{index:1,name:'熟料单位产品综合能耗(kgce/t)',value:0,note:''}, {index:2,name:'熟料单位产品综合能耗(kgce/t)',value:0,note:''},
{index:1,name:'熟料单位产品综合电耗(kw.h/t)',value:0,note:''}, {index:3,name:'熟料单位产品综合电耗(kw.h/t)',value:0,note:''},
{index:1,name:'熟料单位产品综合煤耗(kgce/t)',value:0,note:''}, {index:4,name:'熟料单位产品综合煤耗(kgce/t)',value:0,note:''},
{index:1,name:'水泥单位产品综合电耗(kw.h/t)',value:0,note:''}, {index:5,name:'水泥单位产品综合电耗(kw.h/t)',value:0,note:''},
], ],
}; };
}, },
mounted() { mounted() {
var myDate = new Date(); var myDate = new Date();
let month = myDate.getMonth()+1; this.query.searchDay =this.currentDay = this.$TOOL.dateFormat2(myDate);
if(month<10){
month = '0'+month;
}
this.query.month = myDate.getFullYear()+'-'+month;
this.getData(); this.getData();
}, },
methods: { methods: {
@ -132,24 +129,50 @@
}, },
getData(){ getData(){
let that = this; let that = this;
let params = {page:0}; let arr = [],type='',year_s = 2024,month_s = 1,day_s = 1;
let arr = [];
if(that.query.type==0){// if(that.query.type==0){//
params.type='day_s'; type='day_s';
arr = that.query.month.split('-'); arr = that.query.searchDay.split('-');
params.year_s = Number(arr[0]); year_s = Number(arr[0]);
params.month_s = Number(arr[1]); month_s = Number(arr[1]);
day_s = Number(arr[2]);
}else if(that.query.type==1){// }else if(that.query.type==1){//
params.type='month_s'; type='month_s';
params.year_s = Number(that.query.year); arr = that.query.searchMonth.split('-');
year_s = Number(arr[0]);
month_s = Number(arr[1]);
}else if (that.query.type==2){ }else if (that.query.type==2){
params.type='year_s'; type='year_s';
params.year_s = Number(that.query.yearStart); year_s = Number(that.query.searchYear);
} }
params.mgroup__belong_dept = that.query.belong_dept; let params1 = {
this.$API.enm.enstat.req(params).then((res) => { page:0,
type:type,
year_s:year_s,
month_s:month_s,
day_s:day_s,
mgroup__name:'水泥磨'
}
that.$API.enm.enstat.req(params1).then((res) => {
console.log(res[0]);
that.tableDatas[0].value = res[0].cen_consume_unit;
that.tableDatas[4].value = res[0].celec_consume_unit;
}); });
let params2 = {
page:0,
type:type,
year_s:year_s,
month_s:month_s,
day_s:day_s,
mgroup__name:'回转窑'
}
that.$API.enm.enstat.req(params2).then((res2) => {
that.tableDatas[1].value = res2[0].cen_consume_unit;
that.tableDatas[2].value = res2[0].celec_consume_unit;
that.tableDatas[3].value = res2[0].coal_consume_unit;
console.log(res2[0]);
});
}, },
getTableData(){ getTableData(){
this.getData(); this.getData();