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: "",
cateName: "",
myChart: null,
isMpoint:false,
dictData: [],
option: {
title: {
@ -323,6 +324,7 @@ export default {
} else if (
that.cate == "单位产品成本(元/吨)" ||
that.cate == "电石渣成本(元/吨)" ||
that.cate == "电石渣成本(元/吨)" ||
that.cate == "生料成本(元/吨)"
) {
that.cateName = "production_cost_unit";
@ -336,15 +338,59 @@ export default {
that.cateName = "production_hour";
} else if (that.cate == "吨熟料发电量KW·h/t") {
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";
}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 {
that.cateName = "elec_consume_unit";
}
this.$nextTick((res) => {
this.getDict();
console.log('that.isMpoint',that.isMpoint);
this.getChartsData();
this.getDict();
});
},
methods: {
@ -395,32 +441,73 @@ export default {
} else {
params.mpoint = that.mpoint;
}
that.apiObj.req(params).then((res) => {
let xAxisData = [],
lineData = [];
res.forEach((item) => {
let ind = 0;
let 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);
// ind = item[type] - 1;
// xAxisData[ind] = item[type] + unit;
// lineData[ind] = values;
console.log(params);
console.log(that.cateName);
if(that.isMpoint){
params.mpoint__code = that.cateName;
that.$API.enm.mpointstat.list.req(params).then((res1) => {
let xAxisData = [],
lineData = [];
if(res1.length>0){
res1.reverse();
res1.forEach((item) => {
let ind = 0;
if (type == "hour_s") {
ind = item[type];
xAxisData[ind] = item[type] + unit;
lineData[ind] = item.val;
} else {
lineData.push(item.val);
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;
that.option.series[0].data = lineData;
that.myChart.setOption(that.option);
});
}
},
getChartsData2(){
},
dataSearch() {
this.getChartsData();