feat:统计分析/生产统计/混料统计 调整
This commit is contained in:
parent
186297f26d
commit
516a34f293
|
|
@ -20,7 +20,9 @@
|
|||
<el-row :gutter="10">
|
||||
<el-col :lg="11">
|
||||
<el-card shadow="never">
|
||||
<div id="bachart1" style="width:100%;height:300px;"></div>
|
||||
<div class="chart-scroll" ref="chartScroll">
|
||||
<div id="bachart1" style="width:100%;height:300px;"></div>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :lg="13">
|
||||
|
|
@ -100,13 +102,14 @@ export default {
|
|||
text: '',
|
||||
},
|
||||
grid: {
|
||||
top: '80px'
|
||||
top: '150px'
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
legend: {
|
||||
top: 30
|
||||
top: 30,
|
||||
left: 10,
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
|
|
@ -170,7 +173,8 @@ export default {
|
|||
}
|
||||
setTimeout(() => {
|
||||
try {
|
||||
myChart.setOption(option);
|
||||
myChart.clear();
|
||||
myChart.setOption(option, true);
|
||||
} catch (error) { }
|
||||
}, 500)
|
||||
},
|
||||
|
|
@ -230,13 +234,13 @@ export default {
|
|||
})
|
||||
let seriesData = [];
|
||||
for (let i = 0; i < dateLabels.length; i++) {
|
||||
seriesData.push(new Array(nameList.length).fill(0));
|
||||
seriesData.push(new Array(modelList.length).fill(0));
|
||||
}
|
||||
dataList.forEach(item => {
|
||||
let indexX = 0, indexY = 0;
|
||||
if (that.queryType == '月') {
|
||||
indexX = item.周 - that.firstWeekNum;
|
||||
indexY = nameList.indexOf(item.物料名);
|
||||
indexY = modelList.indexOf(item.型号);
|
||||
if(dateList.indexOf(item.周)>-1){}else{
|
||||
dateList.push(item.周);
|
||||
let obj = {};
|
||||
|
|
@ -247,21 +251,29 @@ export default {
|
|||
} else {
|
||||
that.dateFilters = [1,2,3,4,5,6,7,8,9,10,11,12];
|
||||
indexX = item.月 - 1;
|
||||
indexY = nameList.indexOf(item.物料名);
|
||||
indexY = modelList.indexOf(item.型号);
|
||||
}
|
||||
if (indexX >= 0 && indexX < seriesData.length && indexY >= 0) {
|
||||
seriesData[indexX][indexY] += item.合格数;
|
||||
}
|
||||
});
|
||||
option.xAxis.data = nameList;
|
||||
option.xAxis.data = modelList;
|
||||
for (let n = 0; n < seriesData.length; n++) {
|
||||
let obj = {};
|
||||
obj.name = dateLabels[n];
|
||||
obj.type = 'bar';
|
||||
obj.barWidth = '15px';
|
||||
obj.barWidth = '10px';
|
||||
obj.data = seriesData[n];
|
||||
option.series.push(obj)
|
||||
}
|
||||
let chartDom = document.getElementById('bachart1');
|
||||
if (chartDom) {
|
||||
let parentWidth = that.$refs.chartScroll ? that.$refs.chartScroll.clientWidth : chartDom.parentElement.clientWidth;
|
||||
let needWidth = modelList.length * dateLabels.length * 15;
|
||||
chartDom.style.width = Math.max(parentWidth, needWidth) + 'px';
|
||||
let inst = echarts.getInstanceByDom(chartDom);
|
||||
if (inst) inst.resize();
|
||||
}
|
||||
that.setChart("bachart1", option);
|
||||
} else {
|
||||
option.xAxis.data = [];
|
||||
|
|
@ -366,4 +378,8 @@ export default {
|
|||
right: 8px;
|
||||
z-index: 10;
|
||||
}
|
||||
.chart-scroll {
|
||||
width: 100%;
|
||||
overflow-x: auto;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
Loading…
Reference in New Issue