fix:统计分析修改

This commit is contained in:
shijing 2025-04-10 14:15:49 +08:00
parent 4bf623b93f
commit 141d7db185
3 changed files with 87 additions and 71 deletions

View File

@ -21,13 +21,12 @@
<el-col :lg="12">
<el-card shadow="never">
<div id="bachart1" style="width:100%;height:300px;"></div>
<!-- <scEcharts height="300px" :option="option"></scEcharts> -->
</el-card>
</el-col>
<el-col :lg="12">
<el-card shadow="never" style="position: relative;">
<el-button @click="handleExport('1')" class="tables" type="primary">导出</el-button>
<el-table :data="tableData7" id="exportDiv1" :height="300">
<el-table :data="dataList" id="exportDiv1" :height="300">
<el-table-column type="index" width="50" />
<el-table-column label="物料名" prop="物料名">
</el-table-column>
@ -53,7 +52,6 @@
<el-col :lg="12">
<el-card shadow="never">
<div id="bachart2" style="width:100%;height:300px;"></div>
<!-- <scEcharts height="300px" :option="option"></scEcharts> -->
</el-card>
</el-col>
<el-col :lg="12">
@ -131,7 +129,7 @@ export default {
barWidth: '15px',
}]
},
tableData7: [],
dataList: [],
tableData10: [],
firstWeekNum: 1,
endWeekNum: 4,
@ -158,8 +156,8 @@ export default {
that.xAxisOrigin.push('第' + i + '周');
}
that.xAxisData = that.xAxisOrigin;
that.getData7();
that.getData10();
that.getDataHL();
that.getDataHLXH();
},
methods: {
setChart(name, option = null) {
@ -191,7 +189,7 @@ export default {
}
//
},
getData7() {
getDataHL() {
let that = this;
let obj = {
query: { start_date: that.start_date, end_date: that.end_date, mgroup_name: "混料", is_count_utask: -1 },
@ -201,20 +199,18 @@ export default {
option.title.text = '混料统计';
let exec = that.queryType == '月' ? 'lineWeek' : 'lineMonth';
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
let tableData7 = res.data2.ds0 ? res.data2.ds0 : [];
that.tableData7 = tableData7;
debugger;
if (tableData7.length > 0) {
debugger;
let dataList = res.data2.ds0 ? res.data2.ds0 : [];
that.dataList = dataList;
if (dataList.length > 0) {
option.series = [];
let seriesData = [], nameList = [];
tableData7.forEach(ite => {
dataList.forEach(ite => {
if (nameList.indexOf(ite.物料名) > -1) { } else {
nameList.push(ite.物料名);
seriesData.push([])
}
})
tableData7.forEach(item => {
dataList.forEach(item => {
let indexX = 0, indexY = 0;
if (that.queryType == '月') {
indexX = nameList.indexOf(item.物料名);
@ -223,7 +219,7 @@ export default {
indexX = nameList.indexOf(item.物料名);
indexY = item. - 1;
}
seriesData[indexX][indexY] = item.合格数;
seriesData[indexX][indexY] += item.合格数;
});
for (let n = 0; n < seriesData.length; n++) {
let obj = {};
@ -240,7 +236,7 @@ export default {
}
});
},
getData10() {
getDataHLXH() {
let that = this;
let option = deepCopy(that.basicOption);
option.xAxis.data = that.xAxisData;
@ -320,8 +316,8 @@ export default {
}
that.xAxisData = that.monthList;
}
this.getData7();
this.getData10();
this.getDataHL();
this.getDataHLXH();
},
handleExport(val) {
this.exportLoading = true;

View File

@ -75,12 +75,12 @@
</el-table-column>
<el-table-column label="完成进度" prop="完成进度">
<template #default="scope">
{{(scope.row.完成进度).toFixed(2)}} + "%"
{{(scope.row.完成进度).toFixed(2)}}%
</template>
</el-table-column>
<el-table-column label="合格率" prop="合格率">
<template #default="scope">
{{(scope.row.合格率).toFixed(2)}} + "%"
{{(scope.row.合格率).toFixed(2)}}%
</template>
</el-table-column>
</el-table>
@ -126,42 +126,42 @@ export default {
type: "value",
},
series: [
{
name: "光纤预制棒",
data: [0, 0, 0, 0, 0, 0, 0, 0],
type: "bar",
label: {
show: true,
position: "top",
formatter: "{c}",
color: "rgb(64,158,255)",
},
barWidth: "15px",
},
{
name: "光纤预制管",
data: [0, 0, 0, 0, 0, 0, 0, 0],
type: "bar",
label: {
show: true,
position: "top",
formatter: "{c}",
color: "rgb(64,158,255)",
},
barWidth: "15px",
},
{
name: "G05",
data: [0, 0, 0, 0, 0, 0, 0, 0],
type: "bar",
label: {
show: true,
position: "top",
formatter: "{c}",
color: "rgb(64,158,255)",
},
barWidth: "15px",
},
// {
// name: "",
// data: [0, 0, 0, 0, 0, 0, 0, 0],
// type: "bar",
// label: {
// show: true,
// position: "top",
// formatter: "{c}",
// color: "rgb(64,158,255)",
// },
// barWidth: "15px",
// },
// {
// name: "",
// data: [0, 0, 0, 0, 0, 0, 0, 0],
// type: "bar",
// label: {
// show: true,
// position: "top",
// formatter: "{c}",
// color: "rgb(64,158,255)",
// },
// barWidth: "15px",
// },
// {
// name: "G05",
// data: [0, 0, 0, 0, 0, 0, 0, 0],
// type: "bar",
// label: {
// show: true,
// position: "top",
// formatter: "{c}",
// color: "rgb(64,158,255)",
// },
// barWidth: "15px",
// },
],
},
processData: [],
@ -213,7 +213,7 @@ export default {
",EXTRACT ( MONTH FROM mlog.handle_date )";
obj.query.order_bys_date = ", 月";
}
let xAxisData = [],data2 = [],data1 = [],data0 = [];
let xAxisData = [],nameData=[],seriesData=[],data2 = [],data1 = [],data0 = [];
that.$API.bi.dataset.exec.req("lineWeek", obj).then((res) => {
let data = res.data2.ds0;
that.tableData = data;
@ -222,21 +222,43 @@ export default {
} else {
xAxisData.push(item.工段);
}
console.log("xAxisData:", xAxisData);
let index = xAxisData.indexOf(item.工段);
if (item.物料名.indexOf("G05") > -1) {
data2[index] = item.合格数;
}else if (item.物料名.indexOf("棒") > -1) {
data0[index] = item.合格数;
if (nameData.indexOf(item.物料名) > -1) {
} else {
data1[index] = item.合格数;
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);
}
console.log("xAxisData:", xAxisData);
console.log("nameData:", nameData);
let index = xAxisData.indexOf(item.工段);
let indexY = nameData.indexOf(item.物料名);
seriesData[indexY].data[index] += item.合格数;
// if (item..indexOf("G05") > -1) {
// data2[index] = item.;
// }else if (item..indexOf("") > -1) {
// data0[index] = item.;
// } else {
// data1[index] = item.;
// }
});
that.xAxisData = xAxisData;
that.option.xAxis.data = that.xAxisData;
that.option.series[0].data = data0;
that.option.series[1].data = data1;
that.option.series[2].data = data2;
that.option.series = seriesData;
// that.option.series[0].data = data0;
// that.option.series[1].data = data1;
// that.option.series[2].data = data2;
});
},
handleQuery() {

View File

@ -141,10 +141,8 @@
this.currentYear = year;
this.currentMonth = month;
this.queryDate = year + '-' + month;
// this.start_date =year+'-'+month+'-01';
// this.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate();
this.start_date ='2023-01-01';
this.end_date = '2023-12-31';
this.start_date =year+'-'+month+'-01';
this.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate();
this.getProcess();
},
methods:{