fix:石灰石破碎mgroup根据名称获取

This commit is contained in:
shijing 2024-04-29 16:18:45 +08:00
parent 4e8a3d486a
commit 74e65ba199
3 changed files with 168 additions and 215 deletions

View File

@ -246,8 +246,8 @@ export default {
this.apiObj = this.$API.wpm.sflog.list; this.apiObj = this.$API.wpm.sflog.list;
this.deptId = res[0].belong_dept; this.deptId = res[0].belong_dept;
this.getTeam(); this.getTeam();
this.getShfit();
}); });
this.getShfit();
}, },
methods: { methods: {
getTeam() { getTeam() {

View File

@ -306,8 +306,10 @@ export default {
}, },
data() { data() {
return { return {
exportLoading: false,
chartShow: false, chartShow: false,
myOption: null, myOption: null,
timeStamp: null,
optionHour: {}, optionHour: {},
optionDay: {}, optionDay: {},
optionMonth: {}, optionMonth: {},
@ -450,50 +452,6 @@ export default {
}, },
], ],
}, },
list: [
{
x: 1,
y: 1,
z: 99,
k: 11,
},
{
x: 2,
y: 2,
z: 70,
k: 11,
},
{
x: 3,
y: 3,
z: 1,
k: 11,
},
{
x: 4,
y: 4,
z: 30,
k: 11,
},
{
x: 5,
y: 1,
z: 20,
k: 11,
},
{
x: 6,
y: 0,
z: 18,
k: 11,
},
{
x: 7,
y: 10,
z: 12,
k: 11,
},
],
dataX: [], dataX: [],
dataY: [], dataY: [],
dataY2: [], dataY2: [],
@ -519,34 +477,6 @@ export default {
} }
} }
let that = this; let that = this;
this.$nextTick(() => {
this.dataX = this.list.map((item) => item.x);
// 1Y
this.dataY.push({
name: "AA",
type: "line", // 线
yAxisIndex: 0, // Y
symbolSize: "10",
// lineStyle: { color: '#4485f4' },
data: this.list.map((item) => item.y),
});
// 2Y
this.dataY.push({
name: "BB",
type: "line",
yAxisIndex: 1, // Y
data: this.list.map((item) => item.z),
});
// 3Y
this.dataY.push({
name: "CC",
type: "line",
yAxisIndex: 2, // Y
data: this.list.map((item) => item.k),
});
// this.init(this.dataX, this.dataY);
});
this.$nextTick(() => { this.$nextTick(() => {
var myDate = new Date(); var myDate = new Date();
let year = (that.year = myDate.getFullYear()); let year = (that.year = myDate.getFullYear());
@ -574,127 +504,131 @@ export default {
let month_h = hourDate.getMonth() + 1; let month_h = hourDate.getMonth() + 1;
let days_h = hourDate.getDate(); let days_h = hourDate.getDate();
let hours_h = hourDate.getHours(); let hours_h = hourDate.getHours();
this.$API.mtm.mgroup.list
// .req({ page: 0, search: "电石渣" })
let params3 = {};
params3.page = 0;
params3.year_s = year_d;
params3.month_s = month_d;
params3.day_s = days_d;
params3.type = "day_s";
params3.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(params3).then((res3) => {
if (res3.length > 0) {
let data3 = res3[0];
that.tableDatas[0][3] = data3.total_production;
that.tableDatas[1][3] = data3.elec_consume_unit;
}
});
//
let params4 = {};
params4.page = 0;
params4.year = year_h;
params4.month = month_h;
params4.day = days_h;
params4.hour = hours_h;
params4.type = "hour_st";
params4.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(params4).then((res4) => {
if (res4.length > 0) {
let data4 = res4[0];
that.tableDatas[0][2] = data4.total_production;
that.tableDatas[1][2] = data4.elec_consume_unit;
}
});
//
let params5 = {};
params5.page = 0;
params5.mgroup = "3346520558031773696";
this.$API.mtm.goal.list
.req(params5)
.then((res5) => {
if (res5.length > 0) {
let data5 = res5;
data5.forEach((item5) => {
let str = "goal_val_" + that.month;
debugger;
console.log(str, item5[str]);
if (item5.goal_cate_name == "总产量t") {
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][6] = item5[str];
that.tableDatas[1][8] = item5.goal_val;
}
});
}
})
.then((res) => { .then((res) => {
// console.log("电石渣", res);
let params1 = {}; that.query.mgroup = res[0].id;
params1.page = 0; //
params1.year_s = year; let params3 = {};
params1.type = "year_s"; params3.page = 0;
params1.mgroup = this.query.mgroup; params3.year_s = year_d;
this.$API.enm.enstat.req(params1).then((res1) => { params3.month_s = month_d;
if (res1.length > 0) { params3.day_s = days_d;
let data1 = res1[0]; params3.type = "day_s";
that.tableDatas[0][5] = data1.total_production; params3.mgroup = that.query.mgroup;
that.tableDatas[0][9] = precen( that.$API.enm.enstat.req(params3).then((res3) => {
that.tableDatas[0][5], if (res3.length > 0) {
that.tableDatas[0][8] let data3 = res3[0];
); that.tableDatas[0][3] = data3.total_production;
that.tableDatas[1][3] = data3.elec_consume_unit;
that.tableDatas[1][5] = data1.elec_consume_unit;
that.tableDatas[1][9] = precen(
that.tableDatas[1][5],
that.tableDatas[1][8]
);
} else {
} }
}); });
// //
let params2 = {}; let params4 = {};
params2.page = 0; params4.page = 0;
params2.year_s = year; params4.year = year_h;
params2.month_s = month; params4.month = month_h;
params2.type = "month_s"; params4.day = days_h;
params2.mgroup = this.query.mgroup; params4.hour = hours_h;
this.$API.enm.enstat.req(params2).then((res2) => { params4.type = "hour_st";
if (res2.length > 0) { params4.mgroup = that.query.mgroup;
let data2 = res2[0]; that.$API.enm.enstat.req(params4).then((res4) => {
that.tableDatas[0][4] = data2.total_production; if (res4.length > 0) {
if (that.tableDatas[0][4] > that.tableDatas[0][6]) { let data4 = res4[0];
that.wraning = true; that.tableDatas[0][2] = data4.total_production;
that.tableDatas[1][2] = data4.elec_consume_unit;
}
});
//
let params5 = {};
params5.page = 0;
params5.mgroup = that.query.mgroup;
that.$API.mtm.goal.list
.req(params5)
.then((res5) => {
if (res5.length > 0) {
let data5 = res5;
data5.forEach((item5) => {
let str = "goal_val_" + that.month;
if (item5.goal_cate_name == "总产量t") {
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][6] = item5[str];
that.tableDatas[1][8] = item5.goal_val;
}
});
} }
that.tableDatas[0][7] = precen( })
that.tableDatas[0][4], .then((res) => {
that.tableDatas[0][6] //
); let params1 = {};
params1.page = 0;
params1.year_s = year;
params1.type = "year_s";
params1.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(params1).then((res1) => {
if (res1.length > 0) {
let data1 = res1[0];
that.tableDatas[0][5] =
data1.total_production;
that.tableDatas[0][9] = precen(
that.tableDatas[0][5],
that.tableDatas[0][8]
);
that.tableDatas[1][4] = data2.elec_consume_unit; that.tableDatas[1][5] =
that.tableDatas[1][7] = precen( data1.elec_consume_unit;
that.tableDatas[1][4], that.tableDatas[1][9] = precen(
that.tableDatas[1][6] that.tableDatas[1][5],
); that.tableDatas[1][8]
} );
}); } else {
}
});
//
let params2 = {};
params2.page = 0;
params2.year_s = year;
params2.month_s = month;
params2.type = "month_s";
params2.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(params2).then((res2) => {
if (res2.length > 0) {
let data2 = res2[0];
that.tableDatas[0][4] =
data2.total_production;
if (
that.tableDatas[0][4] >
that.tableDatas[0][6]
) {
that.wraning = true;
}
that.tableDatas[0][7] = precen(
that.tableDatas[0][4],
that.tableDatas[0][6]
);
that.tableDatas[1][4] =
data2.elec_consume_unit;
that.tableDatas[1][7] = precen(
that.tableDatas[1][4],
that.tableDatas[1][6]
);
}
});
});
that.getHourData();
that.getDayData();
that.getMonthData();
}); });
that.getHourData();
that.getDayData();
that.getMonthData();
}); });
}, },
methods: { methods: {
// init(dataX, dataY) {
// this.myChart = echarts.init(document.getElementById("main"));
// // 使
// this.myChart.setOption(this.option);
// },
// //
getHourData() { getHourData() {
let that = this; let that = this;

View File

@ -95,8 +95,10 @@ export default {
}, },
data() { data() {
return { return {
exportLoading: false,
chartShow: false, chartShow: false,
myOption: null, myOption: null,
timeStamp: null,
query: { query: {
mgroup: "3555859873776693248", mgroup: "3555859873776693248",
}, },
@ -116,36 +118,15 @@ export default {
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;
// that.timeStamp = myDate.getTime();
let paramsGoal = {}; this.$API.mtm.mgroup.list
paramsGoal.page = 0; .req({ page: 0, search: "石灰石破碎" })
paramsGoal.mgroup = that.query.mgroup; .then((res) => {
that.$API.mtm.goal.list.req(paramsGoal).then((ress) => { console.log("石灰石破碎", res);
if (ress.length > 0) { that.query.mgroup = res[0].id;
let monthGoal = []; //
ress.forEach((goal) => { this.getMonthGoal();
if (goal.goal_cate_name == "单位产品分布电耗KW·h/t") { });
monthGoal[0] = goal.goal_val;
monthGoal[1] = goal.goal_val_2;
monthGoal[2] = goal.goal_val_3;
monthGoal[3] = goal.goal_val_4;
monthGoal[4] = goal.goal_val_5;
monthGoal[5] = goal.goal_val_6;
monthGoal[6] = goal.goal_val_7;
monthGoal[7] = goal.goal_val_8;
monthGoal[8] = goal.goal_val_9;
monthGoal[9] = goal.goal_val_10;
monthGoal[10] = goal.goal_val_11;
monthGoal[11] = goal.goal_val_12;
monthGoal[12] = goal.goal_val_12;
that.monthGoal = monthGoal;
}
});
this.getData();
} else {
this.getData();
}
});
}, },
methods: { methods: {
// Class // Class
@ -164,6 +145,41 @@ export default {
} }
return classInfo; return classInfo;
}, },
//
getMonthGoal() {
let that = this;
let paramsGoal = {};
paramsGoal.page = 0;
paramsGoal.mgroup = that.query.mgroup;
that.$API.mtm.goal.list.req(paramsGoal).then((ress) => {
if (ress.length > 0) {
let monthGoal = [];
ress.forEach((goal) => {
if (
goal.goal_cate_name == "单位产品分布电耗KW·h/t"
) {
monthGoal[0] = goal.goal_val;
monthGoal[1] = goal.goal_val_2;
monthGoal[2] = goal.goal_val_3;
monthGoal[3] = goal.goal_val_4;
monthGoal[4] = goal.goal_val_5;
monthGoal[5] = goal.goal_val_6;
monthGoal[6] = goal.goal_val_7;
monthGoal[7] = goal.goal_val_8;
monthGoal[8] = goal.goal_val_9;
monthGoal[9] = goal.goal_val_10;
monthGoal[10] = goal.goal_val_11;
monthGoal[11] = goal.goal_val_12;
monthGoal[12] = goal.goal_val_12;
that.monthGoal = monthGoal;
}
});
this.getData();
} else {
this.getData();
}
});
},
getData() { getData() {
let that = this; let that = this;
let query0 = {}; let query0 = {};
@ -293,6 +309,9 @@ export default {
this.chartShow = true; this.chartShow = true;
}); });
}, },
handleQuery() {
this.getMonthGoal();
},
handlePrint() { handlePrint() {
this.$PRINT("#myReport"); this.$PRINT("#myReport");
}, },