feat:统计分析/生产统计/工序合格数统计调整
This commit is contained in:
parent
516a34f293
commit
719a2f899b
|
|
@ -40,7 +40,9 @@
|
|||
<el-row :gutter="10">
|
||||
<el-col :lg="12">
|
||||
<el-card shadow="never">
|
||||
<scEcharts id="bachart1" height="300px" :option="option"></scEcharts>
|
||||
<div class="echarts-scroll">
|
||||
<scEcharts ref="echarts1" id="bachart1" height="300px" :option="option"></scEcharts>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :lg="12">
|
||||
|
|
@ -128,9 +130,21 @@ export default {
|
|||
type: "category",
|
||||
data: [],
|
||||
},
|
||||
yAxis: {
|
||||
type: "value",
|
||||
},
|
||||
yAxis: [
|
||||
{
|
||||
type: "value",
|
||||
name: "数量",
|
||||
},
|
||||
{
|
||||
type: "value",
|
||||
name: "合格率",
|
||||
min: 0,
|
||||
max: 100,
|
||||
axisLabel: {
|
||||
formatter: "{value}%",
|
||||
},
|
||||
},
|
||||
],
|
||||
series: [],
|
||||
},
|
||||
nameFilters: [],
|
||||
|
|
@ -189,43 +203,73 @@ export default {
|
|||
obj.query.order_bys_date = ", 月";
|
||||
}
|
||||
let xAxisData = [],nameData=[],seriesData=[];
|
||||
let colorPalette = ['#5470c6', '#91cc75', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc'];
|
||||
that.$API.bi.dataset.exec.req("lineWeek", obj).then((res) => {
|
||||
let data = res.data2.ds0;
|
||||
that.tableData = data;
|
||||
data.forEach((item) => {
|
||||
if (xAxisData.indexOf(item.工段) > -1) {
|
||||
} else {
|
||||
if (xAxisData.indexOf(item.工段) === -1) {
|
||||
xAxisData.push(item.工段);
|
||||
let obj = {};
|
||||
obj.text = item.工段;
|
||||
obj.value = item.工段;
|
||||
that.mgroupFilters.push(obj);
|
||||
that.mgroupFilters.push({ text: item.工段, value: item.工段 });
|
||||
}
|
||||
if (nameData.indexOf(item.物料名) > -1) {
|
||||
} else {
|
||||
let obj0 = {};
|
||||
obj0.text = item.物料名;
|
||||
obj0.value = item.物料名;
|
||||
that.nameFilters.push(obj0);
|
||||
if (nameData.indexOf(item.物料名) === -1) {
|
||||
nameData.push(item.物料名);
|
||||
let obj = {
|
||||
name:'',
|
||||
type: "bar",
|
||||
label:{
|
||||
show: true,
|
||||
position: "top",
|
||||
formatter: "{c}",
|
||||
color: "rgb(64,158,255)",
|
||||
},
|
||||
barWidth: "15px",
|
||||
data:[0, 0, 0, 0, 0, 0, 0, 0],
|
||||
};
|
||||
obj.name=item.物料名,
|
||||
seriesData.push(obj);
|
||||
that.nameFilters.push({ text: item.物料名, value: item.物料名 });
|
||||
}
|
||||
let index = xAxisData.indexOf(item.工段);
|
||||
let indexY = nameData.indexOf(item.物料名);
|
||||
seriesData[indexY].data[index] += item.合格数;
|
||||
});
|
||||
nameData.forEach((materialName, idx) => {
|
||||
let color = colorPalette[idx % colorPalette.length];
|
||||
let barData = xAxisData.map((mgroup) => {
|
||||
let qualified = 0;
|
||||
data.forEach((item) => {
|
||||
if (item.工段 === mgroup && item.物料名 === materialName) {
|
||||
qualified += Number(item.合格数) || 0;
|
||||
}
|
||||
});
|
||||
return qualified;
|
||||
});
|
||||
let passRateData = xAxisData.map((mgroup) => {
|
||||
let qualified = 0;
|
||||
let produced = 0;
|
||||
data.forEach((item) => {
|
||||
if (item.工段 === mgroup && item.物料名 === materialName) {
|
||||
qualified += Number(item.合格数) || 0;
|
||||
produced += Number(item.生产数) || 0;
|
||||
}
|
||||
});
|
||||
return produced > 0
|
||||
? Number(((qualified / produced) * 100).toFixed(2))
|
||||
: null;
|
||||
});
|
||||
seriesData.push({
|
||||
name: materialName,
|
||||
type: "bar",
|
||||
yAxisIndex: 0,
|
||||
itemStyle: { color },
|
||||
label: {
|
||||
show: true,
|
||||
position: "top",
|
||||
formatter: "{c}",
|
||||
color: color,
|
||||
},
|
||||
barWidth: "15px",
|
||||
data: barData,
|
||||
});
|
||||
seriesData.push({
|
||||
name: materialName + " 合格率",
|
||||
type: "line",
|
||||
yAxisIndex: 1,
|
||||
smooth: true,
|
||||
data: passRateData,
|
||||
label: {
|
||||
show: true,
|
||||
position: "top",
|
||||
formatter: "{c}%",
|
||||
color: color,
|
||||
},
|
||||
lineStyle: { color },
|
||||
itemStyle: { color },
|
||||
});
|
||||
});
|
||||
that.xAxisData = xAxisData;
|
||||
that.option.xAxis.data = that.xAxisData;
|
||||
|
|
|
|||
Loading…
Reference in New Issue