feat:修改车间工序单耗查询问题

This commit is contained in:
zty 2025-01-07 14:19:16 +08:00
parent 97af55e294
commit 95bba723b0
5 changed files with 109 additions and 53 deletions

View File

@ -39,7 +39,7 @@
<thead class="myTableHead"> <thead class="myTableHead">
<tr> <tr>
<th colspan="9"> <th colspan="9">
磨分布电耗月度分析表 磨分布电耗月度分析表
</th> </th>
</tr> </tr>
<tr> <tr>
@ -135,35 +135,37 @@ export default {
try{ try{
var res = await this.$API.mtm.mgroup.list.req({ page: 0, search: "煤磨" }); var res = await this.$API.mtm.mgroup.list.req({ page: 0, search: "煤磨" });
that.query.mgroup = res[0].id; that.query.mgroup = res[0].id;
this.getMonthGoal();
}catch(e){ }catch(e){
this.$message.error("获取工段失败"); this.$message.error("获取工段失败");
} }
// //
let paramsGoal = {}; // let paramsGoal = {};
let monthGoal = []; // let monthGoal = [];
paramsGoal.page = 0; // paramsGoal.page = 0;
paramsGoal.mgroup = that.query.mgroup; // paramsGoal.year_s = that.query.year_s;
paramsGoal.goal_cate__code = "elec_consume_unit"; // paramsGoal.mgroup = that.query.mgroup;
var ress = await that.$API.mtm.goal.list.req(paramsGoal); // paramsGoal.goal_cate__code = "elec_consume_unit";
if (ress.length > 0) { // var ress = await that.$API.mtm.goal.list.req(paramsGoal);
// if (ress.length > 0) {
ress.forEach((goal) => { // ress.forEach((goal) => {
monthGoal[0] = goal.goal_val; // monthGoal[0] = goal.goal_val;
monthGoal[1] = goal.goal_val_1; // monthGoal[1] = goal.goal_val_1;
monthGoal[2] = goal.goal_val_2; // monthGoal[2] = goal.goal_val_2;
monthGoal[3] = goal.goal_val_3; // monthGoal[3] = goal.goal_val_3;
monthGoal[4] = goal.goal_val_4; // monthGoal[4] = goal.goal_val_4;
monthGoal[5] = goal.goal_val_5; // monthGoal[5] = goal.goal_val_5;
monthGoal[6] = goal.goal_val_6; // monthGoal[6] = goal.goal_val_6;
monthGoal[7] = goal.goal_val_7; // monthGoal[7] = goal.goal_val_7;
monthGoal[8] = goal.goal_val_8; // monthGoal[8] = goal.goal_val_8;
monthGoal[9] = goal.goal_val_9; // monthGoal[9] = goal.goal_val_9;
monthGoal[10] = goal.goal_val_10; // monthGoal[10] = goal.goal_val_10;
monthGoal[11] = goal.goal_val_11; // monthGoal[11] = goal.goal_val_11;
monthGoal[12] = goal.goal_val_12; // monthGoal[12] = goal.goal_val_12;
}); // });
} // }
this.getData(monthGoal); // this.getData(monthGoal);
}, },
methods: { methods: {
// Class // Class
@ -183,6 +185,41 @@ export default {
} }
return classInfo; return classInfo;
}, },
getMonthGoal() {
//
let that = this;
let paramsGoal = {};
let monthGoal = [];
paramsGoal.page = 0;
paramsGoal.year = that.query.year_s;
paramsGoal.mgroup = that.query.mgroup;
// paramsGoal.goal_cate__code = "elec_consume_unit";
that.$API.mtm.goal.list.req(paramsGoal).then((ress) => {
if (ress.length > 0) {
ress.forEach((goal) => {
if (
goal.goal_cate_name == "单位产品分布电耗kW·h/t"
){
monthGoal[0] = goal.goal_val;
monthGoal[1] = goal.goal_val_1;
monthGoal[2] = goal.goal_val_2;
monthGoal[3] = goal.goal_val_3;
monthGoal[4] = goal.goal_val_4;
monthGoal[5] = goal.goal_val_5;
monthGoal[6] = goal.goal_val_6;
monthGoal[7] = goal.goal_val_7;
monthGoal[8] = goal.goal_val_8;
monthGoal[9] = goal.goal_val_9;
monthGoal[10] = goal.goal_val_10;
monthGoal[11] = goal.goal_val_11;
monthGoal[12] = goal.goal_val_12;}
});
}
this.getData(monthGoal);
})
},
precen(a, b) { precen(a, b) {
if (b !== 0 && b !== null && a !== null) { if (b !== 0 && b !== null && a !== null) {
let precen = (a / b)* 100; let precen = (a / b)* 100;
@ -336,7 +373,10 @@ export default {
this.$message.success("修改成功"); this.$message.success("修改成功");
} }
) )
} },
handleQuery() {
this.getMonthGoal();
},
}, },
}; };
</script> </script>

View File

@ -244,7 +244,7 @@
</div> </div>
</template> </template>
<script> <script>
const colors = ["#5b9bd5", "#cbd3fe", "#91CC75", "#EE6666", "#CC00CC", "#7DDA58"]; const colors = ["#5b9bd5", "#cbd3fe", "#91CC75", "#EE6666", "#CC00CC", "#7DDA58", "#BCB69D"];
let tooltip = { let tooltip = {
show: true, show: true,
trigger: "axis", trigger: "axis",
@ -434,7 +434,7 @@ export default {
option2: { option2: {
color: colors, color: colors,
tooltip: tooltip, tooltip: tooltip,
legend: Object.assign(legend, {data:["袋装合计", "散装合计", "熟料出厂合计", "出厂水泥合计", "复合水泥合计", "分布电耗目标值"]}), legend: Object.assign(legend, {data:["袋装合计", "散装合计", "熟料出厂合计", "出厂水泥合计", "复合水泥合计", "分布电耗目标值","分布电耗"]}),
grid: grid, grid: grid,
toolbox: toolbox, toolbox: toolbox,
xAxis: { xAxis: {
@ -496,6 +496,12 @@ export default {
yAxisIndex: 0, yAxisIndex: 0,
data: [], data: [],
}, },
{
name: "分布电耗",
type: "bar",
yAxisIndex: 0,
data: [],
},
], ],
}, },
}; };
@ -808,7 +814,8 @@ export default {
seriesData3 = [], seriesData3 = [],
seriesData4 = [], seriesData4 = [],
seriesData5 = [], seriesData5 = [],
seriesData6 = []; seriesData6 = [],
seriesData7 = [];
let data = response; let data = response;
data.forEach((item) => { data.forEach((item) => {
@ -825,6 +832,8 @@ export default {
}else if (item.mpoint_name == "复合水泥合计" || item.mpoint_name == "复合硅酸盐水泥;42.5R;袋装水泥") { }else if (item.mpoint_name == "复合水泥合计" || item.mpoint_name == "复合硅酸盐水泥;42.5R;袋装水泥") {
console.log(item.mpoint_name, item.val); console.log(item.mpoint_name, item.val);
seriesData5[ind] = item.val; seriesData5[ind] = item.val;
}else if(item.mpoint_name == "包装进线"){
seriesData7[ind] = item.elec_consume_unit;
} }
seriesData6[ind] = that.goal_list[0][goal_index]; seriesData6[ind] = that.goal_list[0][goal_index];
}); });
@ -835,6 +844,7 @@ export default {
options.series[3].data = seriesData4; options.series[3].data = seriesData4;
options.series[4].data = seriesData5; options.series[4].data = seriesData5;
options.series[5].data = seriesData6; options.series[5].data = seriesData6;
options.series[6].data = seriesData7;
let monthXAxis = []; let monthXAxis = [];
if (year < that.year){ if (year < that.year){

View File

@ -115,6 +115,7 @@ export default {
// self.data = res[1]; // self.data = res[1];
// console.log("", self.data); // console.log("", self.data);
// } // }
console.log(res,'----------res');
self.getData(res[1]); self.getData(res[1]);
}) })
.catch((error) => { .catch((error) => {
@ -143,8 +144,7 @@ export default {
wrapArr0[month].push(item0); wrapArr0[month].push(item0);
}); });
} else {} } else {}
}).then(() => {
});
this.$API.enm.enstat.req(that.query).then((res) => { this.$API.enm.enstat.req(that.query).then((res) => {
let data = res; let data = res;
if (data.length > 0) { if (data.length > 0) {
@ -178,13 +178,17 @@ export default {
arr.push(item.total_production); arr.push(item.total_production);
arr[3] = item.elec_consume_unit; //kW·h/t arr[3] = item.elec_consume_unit; //kW·h/t
let keyVale = '';
let keyVale = "goal_val_" + n; if (n==1){
if (goalData && goalData[keyVale]){ keyVale = "goal_val_" + 12;
arr[4] = goalData[keyVale].goal_val_1; }else{
}else{arr[4] = 0; // keyVale = "goal_val_" + n;
}
if (goalData && goalData[keyVale]){
arr[4] = goalData[keyVale];
}else{
arr[4] = 0; //
} }
arr[5] = (arr[3] - arr[4]).toFixed(2); //kW·h/t arr[5] = (arr[3] - arr[4]).toFixed(2); //kW·h/t
let ind_pre = 0, let ind_pre = 0,
huanbi = 0; huanbi = 0;
@ -267,6 +271,8 @@ export default {
} else { } else {
} }
}); });
});
}, },
handleQuery() { handleQuery() {
this.tableDatas = []; this.tableDatas = [];

View File

@ -141,7 +141,7 @@ export default {
that.query.mgroup = res[0].id; that.query.mgroup = res[0].id;
// //
that.getMonthGoal(); that.getMonthGoal();
that.getData();
}); });
}, },
methods: { methods: {
@ -166,8 +166,11 @@ export default {
getMonthGoal() { getMonthGoal() {
let that = this; let that = this;
let paramsGoal = {}; let paramsGoal = {};
let monthGoal = [];
paramsGoal.page = 0; paramsGoal.page = 0;
paramsGoal.year = that.query.year_s;
paramsGoal.mgroup = that.query.mgroup; paramsGoal.mgroup = that.query.mgroup;
console.log("paramsGoal", paramsGoal);
that.$API.mtm.goal.list.req(paramsGoal).then((ress) => { that.$API.mtm.goal.list.req(paramsGoal).then((ress) => {
if (ress.length > 0) { if (ress.length > 0) {
let monthGoal = []; let monthGoal = [];
@ -188,15 +191,14 @@ export default {
monthGoal[10] = goal.goal_val_10; monthGoal[10] = goal.goal_val_10;
monthGoal[11] = goal.goal_val_11; monthGoal[11] = goal.goal_val_11;
monthGoal[12] = goal.goal_val_12; monthGoal[12] = goal.goal_val_12;
that.monthGoal = monthGoal; }
} that.getData(monthGoal);
}); });
} else {
this.getData();
} }
}); });
}, },
getData() { getData(monthGoal) {
let that = this; let that = this;
let query0 = {}; let query0 = {};
query0.page = 0; query0.page = 0;
@ -231,8 +233,8 @@ export default {
arr.push(time); arr.push(time);
arr.push(item.elec_consume_unit); //kW·h/t arr.push(item.elec_consume_unit); //kW·h/t
arr[2] = arr[2] =
that.monthGoal[ind] !== undefined monthGoal[ind] !== undefined
? that.monthGoal[ind] ? monthGoal[ind]
: "/"; : "/";
arr[3] = item.note; arr[3] = item.note;
arr[4] = item.id; arr[4] = item.id;

View File

@ -136,7 +136,6 @@ export default {
that.$API.mtm.mgroup.list that.$API.mtm.mgroup.list
.req({ page: 0, name: "生料工序(二次配料)" }) .req({ page: 0, name: "生料工序(二次配料)" })
.then((res) => { .then((res) => {
console.log("原料磨", res);
that.query.mgroup = res[0].id; that.query.mgroup = res[0].id;
// //
that.getMonthGoal(); that.getMonthGoal();
@ -167,6 +166,7 @@ export default {
let paramsGoal = {}; let paramsGoal = {};
paramsGoal.page = 0; paramsGoal.page = 0;
paramsGoal.mgroup = that.query.mgroup; paramsGoal.mgroup = that.query.mgroup;
paramsGoal.year = that.query.year_s;
that.$API.mtm.goal.list.req(paramsGoal).then((ress) => { that.$API.mtm.goal.list.req(paramsGoal).then((ress) => {
if (ress.length > 0) { if (ress.length > 0) {
let monthGoal = []; let monthGoal = [];
@ -187,20 +187,18 @@ export default {
monthGoal[10] = goal.goal_val_10; monthGoal[10] = goal.goal_val_10;
monthGoal[11] = goal.goal_val_11; monthGoal[11] = goal.goal_val_11;
monthGoal[12] = goal.goal_val_12; monthGoal[12] = goal.goal_val_12;
that.monthGoal = monthGoal;
} }
this.getData(monthGoal);
}); });
} else {
this.getData();
} }
}); });
}, },
getData() { getData(monthGoal) {
let that = this; let that = this;
let query0 = {}; let query0 = {};
query0.page = 0; query0.page = 0;
query0.type = "month_s"; query0.type = "month_s";
query0.year_s = that.query.year_s - 1; query0.year = that.query.year_s - 1;
query0.mgroup = that.query.mgroup; query0.mgroup = that.query.mgroup;
let wrapArr = [], let wrapArr = [],
wrapArr0 = [], wrapArr0 = [],
@ -230,8 +228,8 @@ export default {
arr.push(time); arr.push(time);
arr.push(item.elec_consume_unit); //kW·h/t arr.push(item.elec_consume_unit); //kW·h/t
arr[2] = arr[2] =
that.monthGoal[ind] !== undefined monthGoal[ind] !== undefined
? that.monthGoal[ind] ? monthGoal[ind]
: "/"; : "/";
arr[3] = item.note; arr[3] = item.note;
arr[4] = item.id; arr[4] = item.id;