fix:tkx趋势图调整匹配六个工序

This commit is contained in:
shijing 2024-12-27 16:40:44 +08:00
parent f862714b7b
commit cdeff7a3f9
1 changed files with 113 additions and 26 deletions

View File

@ -153,6 +153,7 @@ export default {
code: "", code: "",
cateName: "", cateName: "",
myChart: null, myChart: null,
isMpoint:false,
dictData: [], dictData: [],
option: { option: {
title: { title: {
@ -323,6 +324,7 @@ export default {
} else if ( } else if (
that.cate == "单位产品成本(元/吨)" || that.cate == "单位产品成本(元/吨)" ||
that.cate == "电石渣成本(元/吨)" || that.cate == "电石渣成本(元/吨)" ||
that.cate == "电石渣成本(元/吨)" ||
that.cate == "生料成本(元/吨)" that.cate == "生料成本(元/吨)"
) { ) {
that.cateName = "production_cost_unit"; that.cateName = "production_cost_unit";
@ -336,15 +338,59 @@ export default {
that.cateName = "production_hour"; that.cateName = "production_hour";
} else if (that.cate == "吨熟料发电量KW·h/t") { } else if (that.cate == "吨熟料发电量KW·h/t") {
that.cateName = "production_elec_unit"; that.cateName = "production_elec_unit";
} else if (that.cate == "总电耗KW·h") { } else if (that.cate == "总电耗KW·h"||that.cate =="总电量KW·h") {
that.cateName = "elec_consume"; that.cateName = "elec_consume";
}else if (that.cate == "消耗") {
that.cateName = "amount_consume";
}else if (that.cate == "进厂") {
that.cateName = "amount_consume";
}else if (that.cate == "氨水消耗量(t)") {
that.cateName = "ammonia_consume";
}else if (that.cate == "单位氨水消耗量(kg/t)") {
that.cateName = "ammonia_consume_unit";
}
else if (that.cate == "P.O42.5R 散装t") {
that.cateName = "x水泥+P.O42.5R 散装";
that.isMpoint = true;
}else if (that.cate == "P.O42.5R 袋装t") {
that.cateName = "x水泥+P.O42.5R 袋装";
that.isMpoint = true;
}else if (that.cate == "P.O42.5 袋装t") {
that.cateName = "x水泥+P.O42.5 袋装";
that.isMpoint = true;
}else if (that.cate == "P.O42.5 散装t") {
that.cateName = "x水泥+P.O42.5 散装";
that.isMpoint = true;
}else if (that.cate == "复合硅酸盐水泥;42.5R;袋装水泥(t)") {
that.cateName = "x复合硅酸盐水泥;42.5R;袋装水泥";
that.isMpoint = true;
}else if (that.cate == "复合硅酸盐水泥;42.5R;散装水泥(t)") {
that.cateName = "x复合硅酸盐水泥;42.5R;散装水泥";
that.isMpoint = true;
}else if (that.cate == "普通硅酸盐水泥;52.5;散装水泥(t)") {
that.cateName = "x普通硅酸盐水泥;52.5;散装水泥";
that.isMpoint = true;
}else if (that.cate == "散装水泥(t)") {
that.cateName = "szsn_hj";
that.isMpoint = true;
}else if (that.cate == "袋装水泥(t)") {
that.cateName = "dzsn_hj";
that.isMpoint = true;
}else if (that.cate == "出厂水泥合计t") {
that.cateName = "ccsn_hj";
that.isMpoint = true;
}else if (that.cate == "熟料t") {
that.cateName = "x通用水泥熟料";
that.isMpoint = true;
} }
} else { } else {
that.cateName = "elec_consume_unit"; that.cateName = "elec_consume_unit";
} }
this.$nextTick((res) => { this.$nextTick((res) => {
this.getDict(); console.log('that.isMpoint',that.isMpoint);
this.getChartsData(); this.getChartsData();
this.getDict();
}); });
}, },
methods: { methods: {
@ -395,32 +441,73 @@ export default {
} else { } else {
params.mpoint = that.mpoint; params.mpoint = that.mpoint;
} }
that.apiObj.req(params).then((res) => { console.log(params);
let xAxisData = [], console.log(that.cateName);
lineData = []; if(that.isMpoint){
res.forEach((item) => { params.mpoint__code = that.cateName;
let ind = 0; that.$API.enm.mpointstat.list.req(params).then((res1) => {
let values = Number(item[that.cateName]); let xAxisData = [],
if (type == "hour_s") { lineData = [];
ind = item[type]; if(res1.length>0){
xAxisData[ind] = item[type] + unit; res1.reverse();
lineData[ind] = values; res1.forEach((item) => {
} else { let ind = 0;
lineData.push(values); if (type == "hour_s") {
let xAxis = item[type] + unit; ind = item[type];
xAxisData.push(xAxis); xAxisData[ind] = item[type] + unit;
lineData[ind] = item.val;
// ind = item[type] - 1; } else {
// xAxisData[ind] = item[type] + unit; lineData.push(item.val);
// lineData[ind] = values; let xAxis = item[type] + unit;
xAxisData.push(xAxis);
}
})
let chartDom = document.getElementById("myChart");
that.myChart = echarts.init(chartDom);
that.option.xAxis.data = xAxisData;
that.option.series[0].data = lineData;
that.myChart.setOption(that.option);
console.log(that.option);
} }
})
}else{
that.apiObj.req(params).then((res) => {
let xAxisData = [],
lineData = [];
res.forEach((item) => {
let ind = 0;
let values = 0;
if(that.cateName === "amount_consume"){
if(that.cate == "消耗"){
values = item.imaterial_data_dict.湿电石渣消耗.amount_consume;
}else{
values = item.imaterial_data_dict.湿电石渣进厂.amount_consume;
}
}else if(that.cateName ==="ammonia_consume_unit"){
values = (item.ammonia_consume*1000/item.total_production).toFixed(2);
}else{
values = Number(item[that.cateName]);
}
if (type == "hour_s") {
ind = item[type];
xAxisData[ind] = item[type] + unit;
lineData[ind] = values;
} else {
lineData.push(values);
let xAxis = item[type] + unit;
xAxisData.push(xAxis);
}
});
let chartDom = document.getElementById("myChart");
that.myChart = echarts.init(chartDom);
that.option.xAxis.data = xAxisData;
that.option.series[0].data = lineData;
that.myChart.setOption(that.option);
}); });
let chartDom = document.getElementById("myChart"); }
that.myChart = echarts.init(chartDom); },
that.option.xAxis.data = xAxisData; getChartsData2(){
that.option.series[0].data = lineData;
that.myChart.setOption(that.option);
});
}, },
dataSearch() { dataSearch() {
this.getChartsData(); this.getChartsData();