fix:修改提交错误

This commit is contained in:
shijing 2024-12-30 10:12:24 +08:00
parent e4bd3cf044
commit 6ea4eb4149
1 changed files with 77 additions and 76 deletions

View File

@ -49,11 +49,11 @@
<th rowspan="2">得分</th> <th rowspan="2">得分</th>
</tr> </tr>
<tr> <tr>
<th>当期值kkW·h/t</th> <th>当期值kKW·h/t</th>
<th>目标值kkW·h/t</th> <th>目标值kKW·h/t</th>
<th>当期与目标值差值kW·h/t</th> <th>当期与目标值差值KW·h/t</th>
<th>环期值kW·h/t</th> <th>环期值KW·h/t</th>
<th>当期与环期值差值kW·h/t</th> <th>当期与环期值差值KW·h/t</th>
<th>环比增长率%</th> <th>环比增长率%</th>
<th>同比增长率%</th> <th>同比增长率%</th>
</tr> </tr>
@ -95,23 +95,10 @@ export default {
let year = myDate.getFullYear(); let year = myDate.getFullYear();
this.timeStamp = myDate.getTime(); this.timeStamp = myDate.getTime();
that.query.year_s = year; that.query.year_s = year;
this.$API.mtm.mgroup.list this.$API.mtm.mgroup.list.req({ page: 0, search: "电石渣" }).then((res) => {
.req({ page: 0, search: "电石渣" }) console.log("工段数据:", res);
.then((res) => {
that.query.mgroup = res[0].id; that.query.mgroup = res[0].id;
let params = {}; that.getGoalData();
params.page = 0;
params.year = year;
params.mgroup = that.query.mgroup;
this.$API.mtm.goal.list.req(params).then((res) => {
if (res.length > 0) {
res.forEach((item) => {
if (item.goal_cate_name == "单位产品分布电耗kW·h/t") {
that.getData(item);
}
})
}
});
}); });
}, },
methods: { methods: {
@ -125,12 +112,12 @@ export default {
if (res.length > 0) { if (res.length > 0) {
res.forEach((item) => { res.forEach((item) => {
if (item.goal_cate_name == "单位产品分布电耗kW·h/t") { if (item.goal_cate_name == "单位产品分布电耗kW·h/t") {
this.getData(item); console.log("目标数据:", item);
self.getData(item);
} }
}) })
} }
}) }).catch((error) => {
.catch((error) => {
console.error('获取目标数据失败:', error); console.error('获取目标数据失败:', error);
}); });
}, },
@ -187,13 +174,12 @@ export default {
arr.push(item.total_production); arr.push(item.total_production);
arr.push(item.production_hour); arr.push(item.production_hour);
arr[4] = item.elec_consume_unit; //kW·h/t arr[4] = item.elec_consume_unit; //KW·h/t
let keyVale = "goal_val_" + n; let keyVale = "goal_val_" + n;
arr[5] = goalData[keyVale]; //kW·h/t// arr[5] = goalData[keyVale]; //KW·h/t//
arr[6] = (arr[4] - arr[5]).toFixed(2); //kW·h/t arr[6] = (arr[4] - arr[5]).toFixed(2); //KW·h/t
let ind_pre = 0, let ind_pre = 0,
huanqi = 0, huanqi = 0,
huanqicha = 0,
tongqi = 0, tongqi = 0,
tongqicha = 0; tongqicha = 0;
if (n == 1) { if (n == 1) {
@ -209,16 +195,15 @@ export default {
} }
}) })
} }
arr[7] = huanqi; //kW·h/t arr[7] = Number(huanqi); //KW·h/t
if (arr[6] !== "/"){ if (arr[6] !== "/"){
arr[8] = (arr[4] - arr[7]).toFixed(2); //kW·h/t arr[8] = (Number(arr[4]) - arr[7]).toFixed(2); //KW·h/t
}else{ }else{
arr[8] = "/"; //kW·h/t arr[8] = "/"; //KW·h/t
} }
// arr[8] = huanqicha; //kW·h/t
let growthRate = 0; let growthRate = 0;
if (arr[8]!== "/" && arr[7]!== 0 && arr[8]!== 0 ) { if (arr[8]!== "/" && arr[7]!== 0 && arr[8]!== 0 ) {
growthRate = ((arr[8] / arr[7]) * 100).toFixed(2); growthRate = ((Number(arr[8]) /arr[7]) * 100).toFixed(2);
} else{ } else{
growthRate = "/"; growthRate = "/";
} }
@ -232,6 +217,22 @@ export default {
tongqicha = item.celec_consume_unit; tongqicha = item.celec_consume_unit;
tongqi = 0; tongqi = 0;
} }
arr[10] = tongqi; //%
//n = month_listkeyvalue, index==0arr[11] = 100 index==1arr[11] = 80 index==2arr[11] = 70 index==3arr[11] = 0
if (month_obj[n]) {
const monthData = month_obj[n];
const itemValue = item.elec_consume_unit; //
const sortedData = monthData.sort((a, b) => parseFloat(b.value) - parseFloat(a.value));
const index = sortedData.findIndex(obj => parseFloat(obj.value) === parseFloat(itemValue));
if (index === 0){
arr[11] = 50;
} else if (index === 1) {
arr[11] = 40;
} else if (index === 2) {
arr[11] = 30;
} else if (index === 3) {
arr[11] = 20;
}
const total_elec_consume = item.elec_consume; const total_elec_consume = item.elec_consume;
const sortedTotalData = monthData.sort((a, b) => parseFloat(b.elec_consume) - parseFloat(a.elec_consume)); const sortedTotalData = monthData.sort((a, b) => parseFloat(b.elec_consume) - parseFloat(a.elec_consume));
const totalIndex = sortedTotalData.findIndex(obj => parseFloat(obj.elec_consume) === parseFloat(total_elec_consume)); const totalIndex = sortedTotalData.findIndex(obj => parseFloat(obj.elec_consume) === parseFloat(total_elec_consume));