fix:统计分析修改
This commit is contained in:
parent
4bf623b93f
commit
141d7db185
|
|
@ -21,13 +21,12 @@
|
||||||
<el-col :lg="12">
|
<el-col :lg="12">
|
||||||
<el-card shadow="never">
|
<el-card shadow="never">
|
||||||
<div id="bachart1" style="width:100%;height:300px;"></div>
|
<div id="bachart1" style="width:100%;height:300px;"></div>
|
||||||
<!-- <scEcharts height="300px" :option="option"></scEcharts> -->
|
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :lg="12">
|
<el-col :lg="12">
|
||||||
<el-card shadow="never" style="position: relative;">
|
<el-card shadow="never" style="position: relative;">
|
||||||
<el-button @click="handleExport('1')" class="tables" type="primary">导出</el-button>
|
<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 type="index" width="50" />
|
||||||
<el-table-column label="物料名" prop="物料名">
|
<el-table-column label="物料名" prop="物料名">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
@ -53,7 +52,6 @@
|
||||||
<el-col :lg="12">
|
<el-col :lg="12">
|
||||||
<el-card shadow="never">
|
<el-card shadow="never">
|
||||||
<div id="bachart2" style="width:100%;height:300px;"></div>
|
<div id="bachart2" style="width:100%;height:300px;"></div>
|
||||||
<!-- <scEcharts height="300px" :option="option"></scEcharts> -->
|
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :lg="12">
|
<el-col :lg="12">
|
||||||
|
|
@ -131,7 +129,7 @@ export default {
|
||||||
barWidth: '15px',
|
barWidth: '15px',
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
tableData7: [],
|
dataList: [],
|
||||||
tableData10: [],
|
tableData10: [],
|
||||||
firstWeekNum: 1,
|
firstWeekNum: 1,
|
||||||
endWeekNum: 4,
|
endWeekNum: 4,
|
||||||
|
|
@ -158,8 +156,8 @@ export default {
|
||||||
that.xAxisOrigin.push('第' + i + '周');
|
that.xAxisOrigin.push('第' + i + '周');
|
||||||
}
|
}
|
||||||
that.xAxisData = that.xAxisOrigin;
|
that.xAxisData = that.xAxisOrigin;
|
||||||
that.getData7();
|
that.getDataHL();
|
||||||
that.getData10();
|
that.getDataHLXH();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
setChart(name, option = null) {
|
setChart(name, option = null) {
|
||||||
|
|
@ -191,7 +189,7 @@ export default {
|
||||||
}
|
}
|
||||||
// 计算两者之间相隔的周数并返回结果
|
// 计算两者之间相隔的周数并返回结果
|
||||||
},
|
},
|
||||||
getData7() {
|
getDataHL() {
|
||||||
let that = this;
|
let that = this;
|
||||||
let obj = {
|
let obj = {
|
||||||
query: { start_date: that.start_date, end_date: that.end_date, mgroup_name: "混料", is_count_utask: -1 },
|
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 = '混料统计';
|
option.title.text = '混料统计';
|
||||||
let exec = that.queryType == '月' ? 'lineWeek' : 'lineMonth';
|
let exec = that.queryType == '月' ? 'lineWeek' : 'lineMonth';
|
||||||
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
||||||
let tableData7 = res.data2.ds0 ? res.data2.ds0 : [];
|
let dataList = res.data2.ds0 ? res.data2.ds0 : [];
|
||||||
that.tableData7 = tableData7;
|
that.dataList = dataList;
|
||||||
debugger;
|
if (dataList.length > 0) {
|
||||||
if (tableData7.length > 0) {
|
|
||||||
debugger;
|
|
||||||
option.series = [];
|
option.series = [];
|
||||||
let seriesData = [], nameList = [];
|
let seriesData = [], nameList = [];
|
||||||
tableData7.forEach(ite => {
|
dataList.forEach(ite => {
|
||||||
if (nameList.indexOf(ite.物料名) > -1) { } else {
|
if (nameList.indexOf(ite.物料名) > -1) { } else {
|
||||||
nameList.push(ite.物料名);
|
nameList.push(ite.物料名);
|
||||||
seriesData.push([])
|
seriesData.push([])
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
tableData7.forEach(item => {
|
dataList.forEach(item => {
|
||||||
let indexX = 0, indexY = 0;
|
let indexX = 0, indexY = 0;
|
||||||
if (that.queryType == '月') {
|
if (that.queryType == '月') {
|
||||||
indexX = nameList.indexOf(item.物料名);
|
indexX = nameList.indexOf(item.物料名);
|
||||||
|
|
@ -223,7 +219,7 @@ export default {
|
||||||
indexX = nameList.indexOf(item.物料名);
|
indexX = nameList.indexOf(item.物料名);
|
||||||
indexY = item.月 - 1;
|
indexY = item.月 - 1;
|
||||||
}
|
}
|
||||||
seriesData[indexX][indexY] = item.合格数;
|
seriesData[indexX][indexY] += item.合格数;
|
||||||
});
|
});
|
||||||
for (let n = 0; n < seriesData.length; n++) {
|
for (let n = 0; n < seriesData.length; n++) {
|
||||||
let obj = {};
|
let obj = {};
|
||||||
|
|
@ -240,7 +236,7 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getData10() {
|
getDataHLXH() {
|
||||||
let that = this;
|
let that = this;
|
||||||
let option = deepCopy(that.basicOption);
|
let option = deepCopy(that.basicOption);
|
||||||
option.xAxis.data = that.xAxisData;
|
option.xAxis.data = that.xAxisData;
|
||||||
|
|
@ -320,8 +316,8 @@ export default {
|
||||||
}
|
}
|
||||||
that.xAxisData = that.monthList;
|
that.xAxisData = that.monthList;
|
||||||
}
|
}
|
||||||
this.getData7();
|
this.getDataHL();
|
||||||
this.getData10();
|
this.getDataHLXH();
|
||||||
},
|
},
|
||||||
handleExport(val) {
|
handleExport(val) {
|
||||||
this.exportLoading = true;
|
this.exportLoading = true;
|
||||||
|
|
|
||||||
|
|
@ -75,12 +75,12 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="完成进度" prop="完成进度">
|
<el-table-column label="完成进度" prop="完成进度">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
{{(scope.row.完成进度).toFixed(2)}} + "%"
|
{{(scope.row.完成进度).toFixed(2)}}%
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="合格率" prop="合格率">
|
<el-table-column label="合格率" prop="合格率">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
{{(scope.row.合格率).toFixed(2)}} + "%"
|
{{(scope.row.合格率).toFixed(2)}}%
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
@ -126,42 +126,42 @@ export default {
|
||||||
type: "value",
|
type: "value",
|
||||||
},
|
},
|
||||||
series: [
|
series: [
|
||||||
{
|
// {
|
||||||
name: "光纤预制棒",
|
// name: "光纤预制棒",
|
||||||
data: [0, 0, 0, 0, 0, 0, 0, 0],
|
// data: [0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
type: "bar",
|
// type: "bar",
|
||||||
label: {
|
// label: {
|
||||||
show: true,
|
// show: true,
|
||||||
position: "top",
|
// position: "top",
|
||||||
formatter: "{c}",
|
// formatter: "{c}",
|
||||||
color: "rgb(64,158,255)",
|
// color: "rgb(64,158,255)",
|
||||||
},
|
// },
|
||||||
barWidth: "15px",
|
// barWidth: "15px",
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
name: "光纤预制管",
|
// name: "光纤预制管",
|
||||||
data: [0, 0, 0, 0, 0, 0, 0, 0],
|
// data: [0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
type: "bar",
|
// type: "bar",
|
||||||
label: {
|
// label: {
|
||||||
show: true,
|
// show: true,
|
||||||
position: "top",
|
// position: "top",
|
||||||
formatter: "{c}",
|
// formatter: "{c}",
|
||||||
color: "rgb(64,158,255)",
|
// color: "rgb(64,158,255)",
|
||||||
},
|
// },
|
||||||
barWidth: "15px",
|
// barWidth: "15px",
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
name: "G05",
|
// name: "G05",
|
||||||
data: [0, 0, 0, 0, 0, 0, 0, 0],
|
// data: [0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
type: "bar",
|
// type: "bar",
|
||||||
label: {
|
// label: {
|
||||||
show: true,
|
// show: true,
|
||||||
position: "top",
|
// position: "top",
|
||||||
formatter: "{c}",
|
// formatter: "{c}",
|
||||||
color: "rgb(64,158,255)",
|
// color: "rgb(64,158,255)",
|
||||||
},
|
// },
|
||||||
barWidth: "15px",
|
// barWidth: "15px",
|
||||||
},
|
// },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
processData: [],
|
processData: [],
|
||||||
|
|
@ -213,7 +213,7 @@ export default {
|
||||||
",EXTRACT ( MONTH FROM mlog.handle_date )";
|
",EXTRACT ( MONTH FROM mlog.handle_date )";
|
||||||
obj.query.order_bys_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) => {
|
that.$API.bi.dataset.exec.req("lineWeek", obj).then((res) => {
|
||||||
let data = res.data2.ds0;
|
let data = res.data2.ds0;
|
||||||
that.tableData = data;
|
that.tableData = data;
|
||||||
|
|
@ -222,21 +222,43 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
xAxisData.push(item.工段);
|
xAxisData.push(item.工段);
|
||||||
}
|
}
|
||||||
console.log("xAxisData:", xAxisData);
|
if (nameData.indexOf(item.物料名) > -1) {
|
||||||
let index = xAxisData.indexOf(item.工段);
|
|
||||||
if (item.物料名.indexOf("G05") > -1) {
|
|
||||||
data2[index] = item.合格数;
|
|
||||||
}else if (item.物料名.indexOf("棒") > -1) {
|
|
||||||
data0[index] = item.合格数;
|
|
||||||
} else {
|
} 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.xAxisData = xAxisData;
|
||||||
that.option.xAxis.data = that.xAxisData;
|
that.option.xAxis.data = that.xAxisData;
|
||||||
that.option.series[0].data = data0;
|
that.option.series = seriesData;
|
||||||
that.option.series[1].data = data1;
|
// that.option.series[0].data = data0;
|
||||||
that.option.series[2].data = data2;
|
// that.option.series[1].data = data1;
|
||||||
|
// that.option.series[2].data = data2;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
|
|
|
||||||
|
|
@ -141,10 +141,8 @@
|
||||||
this.currentYear = year;
|
this.currentYear = year;
|
||||||
this.currentMonth = month;
|
this.currentMonth = month;
|
||||||
this.queryDate = year + '-' + month;
|
this.queryDate = year + '-' + month;
|
||||||
// this.start_date =year+'-'+month+'-01';
|
this.start_date =year+'-'+month+'-01';
|
||||||
// this.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate();
|
this.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate();
|
||||||
this.start_date ='2023-01-01';
|
|
||||||
this.end_date = '2023-12-31';
|
|
||||||
this.getProcess();
|
this.getProcess();
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue