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", name: "enm_rm",
path: "/enm_rm", path: "/enm_rm",
meta: { meta: {
title: "生料工序", title: "生料辅料工序",
icon: "el-icon-menu", icon: "el-icon-menu",
type: "menu", type: "menu",
perms: ["enm_rm"], perms: ["enm_rm"],

View File

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

View File

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

View File

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

View File

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

View File

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