feat: 修改 report

This commit is contained in:
zty 2024-12-27 13:44:54 +08:00
parent b0ffdf0b18
commit c7d5c96de9
6 changed files with 163 additions and 114 deletions

View File

@ -359,7 +359,7 @@ const routes = [
name: "enm_rm",
path: "/enm_rm",
meta: {
title: "生料工序",
title: "生料辅料工序",
icon: "el-icon-menu",
type: "menu",
perms: ["enm_rm"],

View File

@ -75,14 +75,14 @@
<div class="flexItem">
<div class="itemTitle">
<div class="itemTitleIcon"></div>
<div>产量</div>
<div>本月产量</div>
</div>
<div class="itemBody" id="line1"></div>
</div>
<div class="flexItem">
<div class="itemTitle">
<div class="itemTitleIcon"></div>
<div>本月台时产量</div>
<div>本月台时</div>
</div>
<div class="itemBody itemBodyCircle">
<div
@ -110,7 +110,7 @@
<div class="flexItem">
<div class="itemTitle">
<div class="itemTitleIcon"></div>
<div>车间用水量</div>
<div>本月用水</div>
</div>
<div class="itemBody" id="line2"></div>
</div>

View File

@ -509,9 +509,10 @@ export default {
params4.day_s = days_h;
params4.type = "day_s";
params4.mgroup = that.query.mgroup;
console.log("本日", params4);
console.log("本日----p", params4);
that.$API.enm.enstat.req(params4).then((res4) => {
if (res4) {
if (res4) {
console.log("本日", res4);
let data4 = res4[0];
that.tableDatas[0][2] = data4.total_production;
if (data4.total_production < 1 ){

View File

@ -266,10 +266,11 @@ export default {
let year = nowDate.getFullYear();
let month = nowDate.getMonth() + 1;
that.timeStamp = nowDate.getTime();
let day = nowDate.getDate();
that.days = new Date(year, month, 0).getDate();
that.headerLength = that.days + 4;
that.tableWidth = that.headerLength * 100 + "";
this.getMPoints();
this.getMPoints(day, month, year);
let heightContainer =
document.getElementById("app-container").clientHeight;
@ -292,10 +293,8 @@ export default {
that.year = Number(arr[0]);
that.month = Number(arr[1]);
that.day = Number(arr[2]);
that.dataLoop();
that.dataLoop(that.day, that.month, that.year);
}
let nowDate = new Date();
that.timeStamp = nowDate.getTime();
},
formatArry(){
this.result = this.mpointIdList.join(","); //
@ -321,7 +320,7 @@ export default {
this.tableDatas_range = res;
});
},
getMPoints() {
getMPoints(day, month, year) {
let that = this;
that.$API.enm.mpoint.list
.req({
@ -334,14 +333,14 @@ export default {
})
.then((res) => {
that.mpointList = res.filter((item) => {
// mpointIdList
that.mpointIdList.push(item.id);
return true;
});
that.dataLoop();
console.log(day, month, year, "day, month, year");
that.dataLoop(day, month, year);
});
},
dataLoop() {
dataLoop(day, month, year) {
let that = this;
that.tableDatas2 = [];
that.mpointList.forEach((item, index) => {
@ -352,53 +351,67 @@ export default {
? item.code
: None;
that.tableDatas2.push(obj);
that.getData(item.id, index);
that.getData(item.id, index, day, month, year);
});
},
getData(id, index) {
let that = this;
let obj = {
query: "{val}"
};
obj.type = "day";
obj.year = that.year;
obj.month = that.month;
obj.day = that.day;
obj.mpoint = id;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((res) => {
res.forEach((item) => {
that.tableDatas2[index]['day'] = item.val;
});
});
//
getData(id, index, day, month, year) {
let that = this;
// Object for Day stats request
let obj = {
query: "{val}",
type: "day",
year: year,
month: month,
day: day,
mpoint: id,
page: 0
};
this.$API.enm.mpoint.stat.req(obj)
.then((res) => {
res.forEach((item) => {
that.tableDatas2[index]['day'] = item.val;
});
})
.then(() => {
// Object for Month stats request
let obj_month = {
query: "{val}"
};
obj_month.type = "month";
obj_month.year = that.year;
obj_month.month = that.month;
obj_month.mpoint = id;
obj_month.page = 0;
this.$API.enm.mpoint.stat.req(obj_month).then((res) => {
res.forEach((item) => {
that.tableDatas2[index]['month'] = item.val;
});
});
//
query: "{val}",
type: "month",
year: year,
month: month,
mpoint: id,
page: 0
};
console.log('obj_month---------', obj_month);
return this.$API.enm.mpoint.stat.req(obj_month); // Return the promise for chaining
})
.then((res) => {
res.forEach((item) => {
that.tableDatas2[index]['month'] = item.val;
});
})
.then(() => {
// Object for Year stats request
let obj_year = {
query: "{val}"
};
obj_year.type = "year";
obj_year.year = that.year;
obj_year.mpoint = id;
obj_year.page = 0;
this.$API.enm.mpoint.stat.req(obj_year).then((res) => {
res.forEach((item) => {
that.tableDatas2[index]['year'] = item.val;
});
});
query: "{val}",
type: "year",
year: year,
mpoint: id,
page: 0
};
return this.$API.enm.mpoint.stat.req(obj_year); // Return the promise for chaining
})
.then((res) => {
res.forEach((item) => {
that.tableDatas2[index]['year'] = item.val;
});
})
.catch((error) => {
console.error("Error fetching data:", error);
});
},
// handleCellClick(row, column, cell, event) {
// let that = this;

View File

@ -1066,7 +1066,6 @@ export default {
seriesData2 = [],
seriesData3 = [],
seriesData4 = [];
let data = response;
data.forEach((item) => {
let ind = item.hour;

View File

@ -25,10 +25,11 @@
>
<thead class="myTableHead">
<tr>
<th colspan="9">电石渣工段生产报告</th>
<th colspan="10">电石渣工段生产报告</th>
</tr>
<tr>
<th colspan="2">参数</th>
<th>本日</th>
<th>昨日</th>
<th>本月</th>
<th>本年</th>
@ -74,6 +75,7 @@
<td class="numCell">{{ item[6] }}</td>
<td class="numCell">{{ item[7]}}</td>
<td class="numCell">{{ item[8] }}</td>
<td class="numCell">{{ item[9] }}</td>
</tr>
</tbody>
</table>
@ -113,7 +115,7 @@
<div class="chartTitle">本月生产参数统计图</div>
<scEcharts
height="400px"
width="1033px"
width="1600px"
:option="optionDay"
></scEcharts>
</div>
@ -121,7 +123,7 @@
<div class="chartTitle">本年生产参数统计图</div>
<scEcharts
height="400px"
width="1033px"
width="1600px"
:option="optionMonth"
></scEcharts>
</div>
@ -227,6 +229,7 @@
</div>
<scEcharts
height="360px"
width="100%"
:option="myOption"
v-if="chartShow"
></scEcharts>
@ -274,7 +277,7 @@ let toolbox = {
};
let legend = {
top: "2%",
data: ["总产量", "分布电耗", "总电", "成本", "消耗", "进厂"],
data: ["总产量", "分布电耗", "总电", "成本", "消耗", "进厂"],
};
let yAxis = [
{
@ -299,7 +302,7 @@ let yAxis = [
name: "分布电耗(KW.h)",
position: "left",
alignTicks: true,
offset: 100,
offset: 80,
axisLine: {
show: true,
lineStyle: {
@ -313,7 +316,7 @@ let yAxis = [
{
type: "value",
nameRotate: 45,
name: "总电(KW.h)",
name: "总电(KW.h)",
position: "left",
alignTicks: true,
offset: 50,
@ -331,7 +334,7 @@ let yAxis = [
{
type: "value",
nameRotate: 45,
name: "成本(元)",
name: "成本(元/t)",
position: "right",
alignTicks: true,
axisLine: {
@ -405,7 +408,7 @@ export default {
tableDatas: [
["产量", "总产量t", 0, 0, 0, 0, 0, 0, 0, 0],
["能耗", "单位产品分布电耗KW·h/t", 0, 0, 0, 0, 0, 0, 0, 0],
["能耗", "总电KW·h", 0, 0, 0, "/", "/", "/", "/", "/"],
["能耗", "总电KW·h", 0, 0, 0, "/", "/", "/", "/", "/"],
["成本", "电石渣成本(元/吨)", 0, 0, 0, 0, 0, 0, 0, 0],
["湿电石渣", "消耗", 0, 0, 0, "/", "/", "/", "/", "/"],
["湿电石渣", "进厂", 0, 0, 0, "/", "/", "/", "/", "/"],
@ -448,29 +451,29 @@ export default {
data: [],
},
{
name: "总电耗",
type: "bar",
yAxisIndex: 5,
data: [],
},
{
name: "成本",
name: "总电量",
type: "bar",
yAxisIndex: 2,
data: [],
},
{
name: "消耗",
name: "成本",
type: "bar",
yAxisIndex: 3,
data: [],
},
{
name: "进厂",
name: "消耗",
type: "bar",
yAxisIndex: 4,
data: [],
},
{
name: "进厂",
type: "bar",
yAxisIndex: 5,
data: [],
},
],
},
option2: {
@ -502,7 +505,7 @@ export default {
data: [],
},
{
name: "总电",
name: "总电",
type: "bar",
yAxisIndex: 2,
data: [],
@ -574,20 +577,53 @@ export default {
this.$API.enm.enstat.req(params3).then((res3) => {
if (res3.length > 0) {
let data3 = res3[0];
that.tableDatas[0][2] = data3.total_production;
that.tableDatas[1][2] = data3.elec_consume_unit;
that.tableDatas[2][2] = data3.elec_consume;
that.tableDatas[3][2] = data3.production_cost_unit;
that.tableDatas[0][3] = data3.total_production;
that.tableDatas[1][3] = data3.elec_consume_unit;
that.tableDatas[2][3] = data3.elec_consume;
that.tableDatas[3][3] = data3.production_cost_unit;
if (data3.imaterial_data.length > 0) {
data3.imaterial_data.forEach((item) => {
if (item.material_name == "湿电石渣消耗") {
that.tableDatas[4][3] = item.amount_consume;
}else if(item.material_name == "湿电石渣进厂"){
that.tableDatas[5][3] = item.amount_consume;
}
});
}
}
});
//
//
let params4 = {};
params4.page = 0;
params4.year_s = year_d;
params4.month_s = month_d;
params4.day_s = days;
params4.type = "day_s";
params4.mgroup = this.query.mgroup;
console.log(params4,"params4");
this.$API.enm.enstat.req(params4).then((res4) => {
if (res4.length > 0) {
let data4 = res4[0];
that.tableDatas[0][2] = data4.total_production;
if (data4.total_production == 0) {
that.tableDatas[1][2] = 0;
that.tableDatas[2][2] = 0;
that.tableDatas[3][2] = 0;
}
that.tableDatas[1][2] = data4.elec_consume_unit;
that.tableDatas[2][2] = data4.elec_consume;
that.tableDatas[3][2] = data4.production_cost_unit;
if (data4.imaterial_data.length > 0) {
data4.imaterial_data.forEach((item) => {
if (item.material_name == "湿电石渣消耗") {
that.tableDatas[4][2] = item.amount_consume;
}else if(item.material_name == "湿电石渣进厂"){
that.tableDatas[5][2] = item.amount_consume;
}
});
}
}
}
});
//
let params5 = {};
@ -601,20 +637,20 @@ export default {
data5.forEach((item5) => {
let str = "goal_val_" + that.month;
if (item5.goal_cate_name == "总产量t") {
that.tableDatas[0][5] = item5[str];
that.tableDatas[0][7] = item5.goal_val;
that.tableDatas[0][6] = item5[str];
that.tableDatas[0][8] = item5.goal_val;
} else if (
item5.goal_cate_name ==
"单位产品分布电耗KW·h/t"
) {
that.tableDatas[1][5] = item5[str];
that.tableDatas[1][7] = item5.goal_val;
that.tableDatas[1][6] = item5[str];
that.tableDatas[1][8] = item5.goal_val;
} else if (
item5.goal_cate_name ==
"单位产品成本(元/吨)"
) {
that.tableDatas[3][5] = item5[str];
that.tableDatas[3][7] = item5.goal_val;
that.tableDatas[3][6] = item5[str];
that.tableDatas[3][8] = item5.goal_val;
}
});
}
@ -629,29 +665,29 @@ export default {
this.$API.enm.enstat.req(params1).then((res1) => {
if (res1.length > 0) {
let data1 = res1[0];
that.tableDatas[0][4] = data1.total_production;
that.tableDatas[0][8] = precen(
that.tableDatas[0][4],
that.tableDatas[0][7]
that.tableDatas[0][5] = data1.total_production;
that.tableDatas[0][9] = precen(
that.tableDatas[0][5],
that.tableDatas[0][6]
);
that.tableDatas[1][4] = data1.elec_consume_unit;
that.tableDatas[1][8] = precen(
that.tableDatas[1][5] = data1.elec_consume_unit;
that.tableDatas[1][9] = precen(
(that.tableDatas[1][4]-that.tableDatas[1][7]),
that.tableDatas[1][7]
);
that.tableDatas[2][4] = data1.elec_consume;
that.tableDatas[3][4] =
that.tableDatas[2][5] = data1.elec_consume;
that.tableDatas[3][5] =
data1.production_cost_unit;
that.tableDatas[3][8] = precen(
(that.tableDatas[3][4]-that.tableDatas[3][7]),
that.tableDatas[3][7]
that.tableDatas[3][9] = precen(
(that.tableDatas[3][5]-that.tableDatas[3][8]),
that.tableDatas[3][8]
);
if (data1.imaterial_data.length > 0) {
data1.imaterial_data.forEach((item) => {
if (item.material_name == "湿电石渣消耗") {
that.tableDatas[4][4] = (item.amount_consume).toFixed(2);
that.tableDatas[4][5] = (item.amount_consume).toFixed(2);
}else if(item.material_name == "湿电石渣进厂"){
that.tableDatas[5][4] = (item.amount_consume).toFixed(2);
that.tableDatas[5][5] = (item.amount_consume).toFixed(2);
}
});
}
@ -668,29 +704,29 @@ export default {
this.$API.enm.enstat.req(params2).then((res2) => {
if (res2.length > 0) {
let data2 = res2[0];
that.tableDatas[0][3] = data2.total_production;
that.tableDatas[0][6] = precen(
that.tableDatas[0][3],
that.tableDatas[0][5]
that.tableDatas[0][4] = data2.total_production;
that.tableDatas[0][7] = precen(
that.tableDatas[0][4],
that.tableDatas[0][6]
);
that.tableDatas[1][3] = data2.elec_consume_unit;
that.tableDatas[1][6] = precen(
(that.tableDatas[1][3]-that.tableDatas[1][5]),
that.tableDatas[1][5]
that.tableDatas[1][4] = data2.elec_consume_unit;
that.tableDatas[1][7] = precen(
(that.tableDatas[1][4]-that.tableDatas[1][6]),
that.tableDatas[1][6]
);
that.tableDatas[3][3] =
that.tableDatas[3][4] =
data2.production_cost_unit;
that.tableDatas[3][6] = precen(
(that.tableDatas[3][3]-that.tableDatas[3][5]),
that.tableDatas[3][5]
that.tableDatas[3][7] = precen(
(that.tableDatas[3][3]-that.tableDatas[3][6]),
that.tableDatas[3][6]
);
that.tableDatas[2][3] = data2.elec_consume;
that.tableDatas[2][4] = data2.elec_consume;
if (data2.imaterial_data.length > 0) {
data2.imaterial_data.forEach((item) => {
if (item.material_name == "湿电石渣消耗") {
that.tableDatas[4][3] = (item.amount_consume).toFixed(2);
that.tableDatas[4][4] = (item.amount_consume).toFixed(2);
}else if(item.material_name == "湿电石渣进厂"){
that.tableDatas[5][3] = (item.amount_consume).toFixed(2);
that.tableDatas[5][4] = (item.amount_consume).toFixed(2);
}
});
}