fix:本月各工段生产产品数柱状颜色调整

This commit is contained in:
shijing 2025-07-23 16:55:05 +08:00
parent 2ab27c571c
commit b7cc7913a6
5 changed files with 55 additions and 181 deletions

View File

@ -318,11 +318,16 @@ export default {
yAxisIndex: 0, yAxisIndex: 0,
barCategoryGap: 50, barCategoryGap: 50,
barWidth: 10, barWidth: 10,
label: {
show: true,
position: "right",
color: "#fff",
},
itemStyle: { itemStyle: {
normal: { normal: {
barBorderRadius: 5, barBorderRadius: 5,
color: function (params) { color: function (params) {
return myColor[params.dataIndex]; return myColor[params.dataIndex%5];
} }
}, },
label: { label: {
@ -391,7 +396,8 @@ export default {
{name:'一次复丝',value:0}, {name:'一次复丝',value:0},
{name:'捆二次棒',value:0}, {name:'捆二次棒',value:0},
{name:'二次复丝',value:0}, {name:'二次复丝',value:0},
] ],
showValue: true
} , } ,
config_left2:{ config_left2:{
data:[] data:[]

View File

@ -318,11 +318,16 @@ export default {
yAxisIndex: 0, yAxisIndex: 0,
barCategoryGap: 50, barCategoryGap: 50,
barWidth: 10, barWidth: 10,
label: {
show: true,
position: "right",
color: "#fff",
},
itemStyle: { itemStyle: {
normal: { normal: {
barBorderRadius: 5, barBorderRadius: 5,
color: function (params) { color: function (params) {
return myColor[params.dataIndex]; return myColor[params.dataIndex%5];
} }
}, },
label: { label: {
@ -388,7 +393,8 @@ export default {
{name:'排二次棒',value:0}, {name:'排二次棒',value:0},
{name:'切丝',value:0}, {name:'切丝',value:0},
{name:'排板',value:0}, {name:'排板',value:0},
] ],
showValue: true
} , } ,
config_left2:{ config_left2:{
data:[] data:[]

View File

@ -12,9 +12,9 @@
<dv-border-box-1> <dv-border-box-1>
<div class="chartBlockTitle">本月各工段生产产品数</div> <div class="chartBlockTitle">本月各工段生产产品数</div>
<div class="echartsWrap"> <div class="echartsWrap">
<scEcharts id="barCharts" :option="barOption2" style="height: 140vh;width: 96%;left: 2%;position: absolute;top: 0px;"/> <dv-capsule-chart id="barCharts" :config="config_left1" class="leftChartBlock1" style="height: 140vh;width: 90%;left: 2%;position: absolute;top: 0px;"/>
</div> </div>
<!-- <dv-capsule-chart :config="config_left1" class="leftChartBlock1"/> -->
</dv-border-box-1> </dv-border-box-1>
</div> </div>
<div style="height: 34vh;"> <div style="height: 34vh;">
@ -294,11 +294,16 @@ export default {
yAxisIndex: 0, yAxisIndex: 0,
barCategoryGap: 50, barCategoryGap: 50,
barWidth: 10, barWidth: 10,
label: {
show: true,
position: "right",
color: "#fff",
},
itemStyle: { itemStyle: {
normal: { normal: {
barBorderRadius: 5, barBorderRadius: 5,
color: function (params) { color: function (params) {
return myColor[params.dataIndex]; return myColor[params.dataIndex%5];
} }
}, },
label: { label: {
@ -332,154 +337,6 @@ export default {
} }
] ]
}, },
barOption2: {
grid: {
top: "1%",
left: "10%",
bottom: "5%",
containLabel: true
},
xAxis: {
splitLine: {
show:false
},
},
yAxis: [
{
axisLine: {
show: false
},
axisTick: {
show: false
},
axisLabel: {
color: "#fff"
},
splitLine: {
show:false
},
type: 'category',
inverse: true, //
data: []
},
{
show: false,
axisLine: {
show: false
},
axisTick: {
show: false
},
splitLine: {
show:false
},
axisLabel: {
textStyle: {
fontSize: 12,
color: "#fff"
}
},
inverse: true, //
data: [],
}
],
series: [
{
name: '柱状图',
type: 'bar',
data: [],
yAxisIndex: 0,
barCategoryGap: 50,
barWidth: 10,
itemStyle: {
normal: {
barBorderRadius: 5,
color: function (params) {
return myColor[params.dataIndex];
}
},
label: {
normal: {
position: "outside",
color: "#fff",
}
}
},
},
{
name: "框",
type: "bar",
barCategoryGap: 50,
barWidth: 12,
itemStyle: {
color: "none",
shadowColor: '#999', //
shadowBlur: 3, //
shadowOffsetX: 0, //
shadowOffsetY: 0, //
borderColor: "rgba(153,153,153,0.6)", //
borderWidth: 0.5,
barBorderRadius: 5,
},
yAxisIndex: 1,
data: []
}
]
},
barOption: {
grid: {
top: "1%",
left: "10%",
bottom: "5%",
containLabel: true
},
xAxis: {
splitLine: {
show:false
},
},
yAxis: {
axisLine: {
show: false
},
axisTick: {
show: false
},
axisLabel: {
color: "#fff"
},
splitLine: {
show:false
},
type: 'category',
inverse: true, //
data: []
},
series:{
name: '柱状图',
type: 'bar',
data: [],
barCategoryGap: 50,
barWidth: 10,
itemStyle: {
normal: {
barBorderRadius: 5,
color: function (params) {
return myColor[params.dataIndex];
}
},
label: {
normal: {
show: true,
position: "outside",
color: "#fff",
formatter: "{a}"
}
}
},
}
},
tableHeight: 100, tableHeight: 100,
speed: 2000, speed: 2000,
time: null, time: null,
@ -507,7 +364,8 @@ export default {
data:[] data:[]
}, },
config_left1:{ config_left1:{
data:[] data:[],
showValue: true
} , } ,
config_left2:{ config_left2:{
data:[] data:[]
@ -562,8 +420,10 @@ export default {
that.start_date = year + "-" + month + "-01"; that.start_date = year + "-" + month + "-01";
that.end_date = year + "-" + month + "-" + days; that.end_date = year + "-" + month + "-" + days;
that.materialAll(); that.materialAll();
that.barOption.yAxis.data=[]; that.getmgroupMaterial(that.deptName1);
that.barOption.series.data=[]; that.getmgroupMaterial(that.deptName2);
that.getmgroupMaterial(that.deptName3);
that.getmgroupMaterial(that.deptName4);
that.getMgroups(that.deptName1); that.getMgroups(that.deptName1);
that.getMgroups(that.deptName2); that.getMgroups(that.deptName2);
that.getMgroups(that.deptName3); that.getMgroups(that.deptName3);
@ -587,7 +447,7 @@ export default {
top = top.substring(0,top.length-2); top = top.substring(0,top.length-2);
let topNumber = Number(top); let topNumber = Number(top);
let newTop = 0; let newTop = 0;
if(topNumber <= -85){ if(topNumber <= -90){
newTop = 0; newTop = 0;
}else{ }else{
newTop =Number(top)-2.5; newTop =Number(top)-2.5;
@ -641,11 +501,7 @@ export default {
that.mgroupsId += item.id + ','; that.mgroupsId += item.id + ',';
// //
that.getInms(item); that.getInms(item);
that.barOption2.yAxis[0].data.push(item.name); // that.getmgroupMaterial(item.name);
that.barOption2.yAxis[1].data.push(0);
that.barOption2.series[0].data.push(0);
that.barOption2.series[1].data.push(0);
that.getmgroupMaterial(item.name);
}) })
} }
}); });
@ -669,26 +525,20 @@ export default {
}) })
}, },
// //
getmgroupMaterial(mgroupName) { getmgroupMaterial(deptName) {
let that = this; let that = this;
let params = { let params = {
query: {start_date:that.start_date,end_date:that.end_date,mgroup_name:mgroupName} query: {start_date:that.start_date,end_date:that.end_date,dept_name:deptName}
}; };
this.$API.bi.dataset.exec.req("mlog_okrate", params).then((res) => { this.$API.bi.dataset.exec.req("mlog_okrate", params).then((res) => {
if(res.data2.ds0.length>0){ if(res.data2.ds0.length>0){
let data = res.data2.ds0; let data = res.data2.ds0;
data.forEach((item) => { data.forEach((item)=>{
// that.barOption2.yAxis[0].data.push(item.name); let obj = {};
let index2 = that.barOption2.yAxis[0].data.indexOf(mgroupName); obj.name = item.工段;
that.barOption2.yAxis[1].data[index2] = item.合格数; obj.value = item.合格数;
that.barOption2.series[0].data[index2] = item.合格数; that.config_left1.data.push(obj);
}) })
let maxNum = that.barOption2.series[0].data.sort((a, b) => b - a)[0]+2;
let arr = [];
that.barOption2.series[1].data.forEach((item)=>{
arr.push(maxNum)
})
that.barOption2.series[1].data = arr;
} }
}); });
}, },

View File

@ -317,11 +317,16 @@ export default {
yAxisIndex: 0, yAxisIndex: 0,
barCategoryGap: 50, barCategoryGap: 50,
barWidth: 10, barWidth: 10,
label: {
show: true,
position: "right",
color: "#fff",
},
itemStyle: { itemStyle: {
normal: { normal: {
barBorderRadius: 5, barBorderRadius: 5,
color: function (params) { color: function (params) {
return myColor[params.dataIndex]; return myColor[params.dataIndex%5];
} }
}, },
label: { label: {
@ -382,7 +387,8 @@ export default {
data:[] data:[]
}, },
config_left1:{ config_left1:{
data:[] data:[],
showValue: true
} , } ,
config_left2:{ config_left2:{
data:[] data:[]

View File

@ -317,11 +317,16 @@ export default {
yAxisIndex: 0, yAxisIndex: 0,
barCategoryGap: 50, barCategoryGap: 50,
barWidth: 10, barWidth: 10,
label: {
show: true,
position: "right",
color: "#fff",
},
itemStyle: { itemStyle: {
normal: { normal: {
barBorderRadius: 5, barBorderRadius: 5,
color: function (params) { color: function (params) {
return myColor[params.dataIndex]; return myColor[params.dataIndex%5];
} }
}, },
label: { label: {
@ -382,7 +387,8 @@ export default {
data:[] data:[]
}, },
config_left1:{ config_left1:{
data:[] data:[],
showValue: true
} , } ,
config_left2:{ config_left2:{
data:[] data:[]