feat: 煤磨获取目标值错误

This commit is contained in:
caoqianming 2024-12-28 12:43:08 +08:00
parent 24e3a51c1f
commit 07b336e0c6
1 changed files with 24 additions and 29 deletions

View File

@ -126,20 +126,26 @@ export default {
asynDialog: false, asynDialog: false,
}; };
}, },
mounted() { async mounted() {
let that = this; let that = this;
var myDate = new Date(); var myDate = new Date();
let year = myDate.getFullYear(); let year = myDate.getFullYear();
that.query.year_s = year; that.query.year_s = year;
try{
var res = await this.$API.mtm.mgroup.list.req({ page: 0, search: "煤磨" });
that.query.mgroup = res[0].id;
}catch(e){
this.$message.error("获取工段失败");
}
// //
let paramsGoal = {}; let paramsGoal = {};
paramsGoal.page = 0; paramsGoal.page = 0;
paramsGoal.mgroup = that.query.mgroup; paramsGoal.mgroup = that.query.mgroup;
that.$API.mtm.goal.list.req(paramsGoal).then((ress) => { paramsGoal.goal_cate__code = "elec_consume_unit";
var ress = await that.$API.mtm.goal.list.req(paramsGoal);
if (ress.length > 0) { if (ress.length > 0) {
let monthGoal = []; let monthGoal = [];
ress.forEach((goal) => { ress.forEach((goal) => {
if (goal.goal_cate_name == "单位产品分布电耗kW·h/t") {
monthGoal[0] = goal.goal_val; monthGoal[0] = goal.goal_val;
monthGoal[1] = goal.goal_val_2; monthGoal[1] = goal.goal_val_2;
monthGoal[2] = goal.goal_val_3; monthGoal[2] = goal.goal_val_3;
@ -153,20 +159,9 @@ export default {
monthGoal[10] = goal.goal_val_11; monthGoal[10] = goal.goal_val_11;
monthGoal[11] = goal.goal_val_12; monthGoal[11] = goal.goal_val_12;
monthGoal[12] = goal.goal_val_12; monthGoal[12] = goal.goal_val_12;
that.monthGoal = monthGoal; });
} }
});
} else {
this.getData(); this.getData();
}
});
this.$API.mtm.mgroup.list
.req({ page: 0, search: "煤磨" })
.then((res) => {
console.log("煤磨", res);
that.query.mgroup = res[0].id;
this.getData();
});
}, },
methods: { methods: {
// Class // Class