fix:光子统计分析更新

This commit is contained in:
shijing 2025-04-11 13:56:15 +08:00
parent 3af6b66647
commit ac108870ff
4 changed files with 107 additions and 218 deletions

View File

@ -144,13 +144,12 @@ export default {
let days = new Date(year, month, 0).getDate(); let days = new Date(year, month, 0).getDate();
that.currentYear = year; that.currentYear = year;
that.currentMonth = month; that.currentMonth = month;
that.firstWeekNum = that.getWeekOfYear(year,month,1);
that.endWeekNum = that.getWeekOfYear(year,month,days);
month = month < 10 ? '0' + month : month;
that.start_date = year + '-' + month + '-01'; that.start_date = year + '-' + month + '-01';
that.end_date = year + '-' + month + '-' + new Date(year, month, 0).getDate(); that.end_date = year + '-' + month + '-' + days;
let month1 = month; that.queryDate = year + '-' + month;
if (month1 < 10) { month1 = '0' + month1 }
that.queryDate = year + '-' + month1;
that.firstWeekNum = that.getWeekOfYear(new Date(that.start_date));
that.endWeekNum = that.getWeekOfYear(new Date(that.end_date));
let duration = that.endWeekNum - that.firstWeekNum + 1; let duration = that.endWeekNum - that.firstWeekNum + 1;
for (let i = 1; i <= duration; i++) { for (let i = 1; i <= duration; i++) {
that.xAxisOrigin.push('第' + i + '周'); that.xAxisOrigin.push('第' + i + '周');
@ -179,15 +178,13 @@ export default {
console.log(value) console.log(value)
this.queryDate = ''; this.queryDate = '';
}, },
getWeekOfYear(date) { getWeekOfYear(a,b,c) {
var target = new Date(date.getFullYear(), date.getMonth(), date.getDate()); // var date1 = new Date(a, parseInt(b) - 1, c), //  
var firstDayOfYear = new Date(target.getFullYear(), 0, 1); // date2 = new Date(a, 0, 1), //  
if (target.getTime() == firstDayOfYear.getTime()) { // d  
return 1; d = Math.round((date1.valueOf() - date2.valueOf()) / 86400000);
} else { // d + 7  
return Math.ceil((target - firstDayOfYear + 8 * (firstDayOfYear.getTimezoneOffset() / 480)) / 604800000); return Math.ceil((d + (date2.getDay() + 1 - 1)) / 7);
}
//
}, },
getDataHL() { getDataHL() {
let that = this; let that = this;
@ -286,38 +283,40 @@ export default {
}, },
handleQuery() { handleQuery() {
let that = this; let that = this;
if (this.queryType == '月') { if (that.queryType == '月') {
if (this.queryDate !== '' && this.queryDate !== null) { if (that.queryDate !== '' && that.queryDate !== null) {
this.start_date = this.queryDate + '-01'; let arr = that.queryDate.split('-');
let arr = this.queryDate.split('-'); let year = arr[0];
this.end_date = this.queryDate + '-' + new Date(arr[0], arr[1], 0).getDate(); let month = arr[1];
this.firstWeekNum = this.getWeekOfYear(new Date(this.start_date)); let days = new Date(year, month, 0).getDate();
this.endWeekNum = this.getWeekOfYear(new Date(this.end_date)); that.start_date = that.queryDate + '-01';
let duration = this.endWeekNum - this.firstWeekNum + 1; that.end_date = that.queryDate + '-' + days;
that.firstWeekNum = that.getWeekOfYear(year,month,1);
that.endWeekNum = that.getWeekOfYear(year,month,days);
let duration = that.endWeekNum - that.firstWeekNum + 1;
let xAxisData = []; let xAxisData = [];
for (let i = 1; i <= duration; i++) { for (let i = 1; i <= duration; i++) {
xAxisData.push('第' + i + '周'); xAxisData.push('第' + i + '周');
} }
that.xAxisData = xAxisData; that.xAxisData = xAxisData;
} else { } else {
this.start_date = this.currentYear + '-' + this.currentMonth + '-01'; that.start_date = that.currentYear + '-' + that.currentMonth + '-01';
this.end_date = this.currentYear + '-' + this.currentMonth + '-' + new Date(this.currentYear, this.currentMonth, 0).getDate(); that.end_date = that.currentYear + '-' + that.currentMonth + '-' + new Date(that.currentYear, that.currentMonth, 0).getDate();
let date = new Date(this.start_date); that.firstWeekNum = that.getWeekOfYear(that.currentYear,that.currentMonth,1);
this.firstWeekNum = this.getWeekOfYear(date); that.xAxisData = that.xAxisOrigin;
this.xAxisData = this.xAxisOrigin;
} }
} else { } else {
if (this.queryDate !== '' && this.queryDate !== null) { if (that.queryDate !== '' && that.queryDate !== null) {
this.start_date = this.queryDate + '-01-01'; that.start_date = that.queryDate + '-01-01';
this.end_date = this.queryDate + '-12-31'; that.end_date = that.queryDate + '-12-31';
} else { } else {
this.start_date = this.currentYear + '-01-01'; that.start_date = that.currentYear + '-01-01';
this.end_date = this.currentYear + '-12-31'; that.end_date = that.currentYear + '-12-31';
} }
that.xAxisData = that.monthList; that.xAxisData = that.monthList;
} }
this.getDataHL(); that.getDataHL();
this.getDataHLXH(); that.getDataHLXH();
}, },
handleExport(val) { handleExport(val) {
this.exportLoading = true; this.exportLoading = true;

View File

@ -258,18 +258,12 @@ export default {
let days = new Date(year, month, 0).getDate(); let days = new Date(year, month, 0).getDate();
that.currentYear = year; that.currentYear = year;
that.currentMonth = month; that.currentMonth = month;
that.firstWeekNum = that.getWeekOfYear(year,month,1);
that.endWeekNum = that.getWeekOfYear(year,month,days);
month = month < 10 ? "0" + month : month;
that.start_date = year + "-" + month + "-01"; that.start_date = year + "-" + month + "-01";
that.end_date = that.end_date =year + "-" + month + "-" + days;
year + "-" + month + "-" + new Date(year, month, 0).getDate(); that.queryDate = year + "-" + month;
let month1 = month;
if (month1 < 10) {
month1 = "0" + month1;
}
that.queryDate = year + "-" + month1;
that.firstWeekNum = that.getWeekOfYear(new Date(that.start_date));
that.endWeekNum = that.getWeekOfYear(new Date(that.end_date));
// console.log('that.firstWeekNum',that.firstWeekNum)
// console.log('that.endWeekNum',that.endWeekNum)
let duration = that.endWeekNum - that.firstWeekNum + 1; let duration = that.endWeekNum - that.firstWeekNum + 1;
for (let i = 1; i <= duration; i++) { for (let i = 1; i <= duration; i++) {
that.xAxisOrigin.push("第" + i + "周"); that.xAxisOrigin.push("第" + i + "周");
@ -280,8 +274,8 @@ export default {
that.rightHeight = height - 115; that.rightHeight = height - 115;
that.tableHeight = height - 140 - chartheight; that.tableHeight = height - 140 - chartheight;
that.setChart("bachart1", that.basicOption); that.setChart("bachart1", that.basicOption);
this.getInmOption(); that.getInmOption();
this.getTable(); that.getTable();
}, },
methods: { methods: {
setChart(name, option = null) { setChart(name, option = null) {
@ -300,23 +294,13 @@ export default {
} catch (error) {} } catch (error) {}
}, 500); }, 500);
}, },
getWeekOfYear(date) { getWeekOfYear(a,b,c) {
var target = new Date( var date1 = new Date(a, parseInt(b) - 1, c), //  
date.getFullYear(), date2 = new Date(a, 0, 1), //  
date.getMonth(), // d  
date.getDate() d = Math.round((date1.valueOf() - date2.valueOf()) / 86400000);
); // // d + 7  
var firstDayOfYear = new Date(target.getFullYear(), 0, 1); // return Math.ceil((d + (date2.getDay() + 1 - 1)) / 7);
if (target.getTime() == firstDayOfYear.getTime()) {
return 1;
} else {
return Math.ceil(
(target -
firstDayOfYear +
8 * (firstDayOfYear.getTimezoneOffset() / 480)) /
604800000
);
}
}, },
queryTypeChange(value) { queryTypeChange(value) {
console.log(value); console.log(value);
@ -402,18 +386,14 @@ export default {
let that = this; let that = this;
if (that.queryType == "月") { if (that.queryType == "月") {
if (that.queryDate !== "" && that.queryDate !== null) { if (that.queryDate !== "" && that.queryDate !== null) {
that.start_date = that.queryDate + "-01";
let arr = that.queryDate.split("-"); let arr = that.queryDate.split("-");
that.end_date = let year = arr[0];
that.queryDate + let month = arr[1];
"-" + let days = new Date(year, month, 0).getDate();
new Date(arr[0], arr[1], 0).getDate(); that.start_date = that.queryDate + "-01";
that.firstWeekNum = that.getWeekOfYear( that.end_date =that.queryDate +"-" +days;
new Date(that.start_date) that.firstWeekNum = that.getWeekOfYear(year,month,1);
); that.endWeekNum = that.getWeekOfYear(year,month,days);
that.endWeekNum = that.getWeekOfYear(
new Date(that.end_date)
);
let duration = that.endWeekNum - that.firstWeekNum + 1; let duration = that.endWeekNum - that.firstWeekNum + 1;
let xAxisData = []; let xAxisData = [];
for (let i = 1; i <= duration; i++) { for (let i = 1; i <= duration; i++) {
@ -421,20 +401,9 @@ export default {
} }
that.xAxisData = xAxisData; that.xAxisData = xAxisData;
} else { } else {
that.start_date = that.start_date =that.currentYear + "-" + that.currentMonth + "-01";
that.currentYear + "-" + that.currentMonth + "-01"; that.end_date =that.currentYear +"-" +that.currentMonth +"-" +new Date(that.currentYear,that.currentMonth,0).getDate();
that.end_date = that.firstWeekNum = that.getWeekOfYear(that.currentYear,that.currentMonth,1);
that.currentYear +
"-" +
that.currentMonth +
"-" +
new Date(
that.currentYear,
that.currentMonth,
0
).getDate();
let date = new Date(that.start_date);
that.firstWeekNum = that.getWeekOfYear(date);
that.xAxisData = that.xAxisOrigin; that.xAxisData = that.xAxisOrigin;
} }
} else { } else {

View File

@ -346,16 +346,12 @@ export default {
let days = new Date(year, month, 0).getDate(); let days = new Date(year, month, 0).getDate();
that.currentYear = year; that.currentYear = year;
that.currentMonth = month; that.currentMonth = month;
that.firstWeekNum = that.getWeekOfYear(year,month,1);
that.endWeekNum = that.getWeekOfYear(year,month,days);
month = month < 10 ? "0" + month : month;
that.start_date = year + "-" + month + "-01"; that.start_date = year + "-" + month + "-01";
that.end_date = that.end_date =year + "-" + month + "-" + days;
year + "-" + month + "-" + new Date(year, month, 0).getDate(); that.queryDate = year + "-" + month;
let month1 = month;
if (month1 < 10) {
month1 = "0" + month1;
}
that.queryDate = year + "-" + month1;
that.firstWeekNum = that.getWeekOfYear(new Date(that.start_date));
that.endWeekNum = that.getWeekOfYear(new Date(that.end_date));
let duration = that.endWeekNum - that.firstWeekNum + 1; let duration = that.endWeekNum - that.firstWeekNum + 1;
for (let i = 1; i <= duration; i++) { for (let i = 1; i <= duration; i++) {
that.xAxisOrigin.push("第" + i + "周"); that.xAxisOrigin.push("第" + i + "周");
@ -388,24 +384,13 @@ export default {
console.log(value); console.log(value);
this.queryDate = ""; this.queryDate = "";
}, },
getWeekOfYear(date) { getWeekOfYear(a,b,c) {
var target = new Date( var date1 = new Date(a, parseInt(b) - 1, c), //  
date.getFullYear(), date2 = new Date(a, 0, 1), //  
date.getMonth(), // d  
date.getDate() d = Math.round((date1.valueOf() - date2.valueOf()) / 86400000);
); // // d + 7  
var firstDayOfYear = new Date(target.getFullYear(), 0, 1); // return Math.ceil((d + (date2.getDay() + 1 - 1)) / 7);
if (target.getTime() == firstDayOfYear.getTime()) {
return 1;
} else {
return Math.ceil(
(target -
firstDayOfYear +
8 * (firstDayOfYear.getTimezoneOffset() / 480)) /
604800000
);
}
//
}, },
getData6() { getData6() {
let that = this; let that = this;
@ -612,57 +597,42 @@ export default {
}, },
handleQuery() { handleQuery() {
let that = this; let that = this;
if (this.queryType == "月") { if (that.queryType == "月") {
if (this.queryDate !== "" && this.queryDate !== null) { if (that.queryDate !== "" && that.queryDate !== null) {
this.start_date = this.queryDate + "-01"; let arr = that.queryDate.split("-");
let arr = this.queryDate.split("-"); let year = arr[0];
this.end_date = let month = arr[1];
this.queryDate + let days = new Date(year, month, 0).getDate();
"-" + that.start_date = that.queryDate + "-01";
new Date(arr[0], arr[1], 0).getDate(); that.end_date =that.queryDate +"-" +days;
this.firstWeekNum = this.getWeekOfYear( that.firstWeekNum = that.getWeekOfYear(year,month,1);
new Date(this.start_date) that.endWeekNum = that.getWeekOfYear(year,month,days);
); let duration = that.endWeekNum - that.firstWeekNum + 1;
this.endWeekNum = this.getWeekOfYear(
new Date(this.end_date)
);
let duration = this.endWeekNum - this.firstWeekNum + 1;
let xAxisData = []; let xAxisData = [];
for (let i = 1; i <= duration; i++) { for (let i = 1; i <= duration; i++) {
xAxisData.push("第" + i + "周"); xAxisData.push("第" + i + "周");
} }
that.xAxisData = xAxisData; that.xAxisData = xAxisData;
} else { } else {
this.start_date = that.start_date =that.currentYear + "-" + that.currentMonth + "-01";
this.currentYear + "-" + this.currentMonth + "-01"; that.end_date =that.currentYear +"-" +that.currentMonth +"-" +new Date(that.currentYear,that.currentMonth,0).getDate();
this.end_date = that.firstWeekNum = that.getWeekOfYear(that.currentYear,that.currentMonth,1);;
this.currentYear + that.xAxisData = that.xAxisOrigin;
"-" +
this.currentMonth +
"-" +
new Date(
this.currentYear,
this.currentMonth,
0
).getDate();
let date = new Date(this.start_date);
this.firstWeekNum = this.getWeekOfYear(date);
this.xAxisData = this.xAxisOrigin;
} }
} else { } else {
if (this.queryDate !== "" && this.queryDate !== null) { if (that.queryDate !== "" && that.queryDate !== null) {
this.start_date = this.queryDate + "-01-01"; that.start_date = that.queryDate + "-01-01";
this.end_date = this.queryDate + "-12-31"; that.end_date = that.queryDate + "-12-31";
} else { } else {
this.start_date = this.currentYear + "-01-01"; that.start_date = that.currentYear + "-01-01";
this.end_date = this.currentYear + "-12-31"; that.end_date = that.currentYear + "-12-31";
} }
that.xAxisData = that.monthList; that.xAxisData = that.monthList;
} }
this.getData6(); that.getData6();
this.getData7(); that.getData7();
this.getData10(); that.getData10();
this.getDataDAVG(); that.getDataDAVG();
}, },
handleExport(val) { handleExport(val) {
this.exportLoading = true; this.exportLoading = true;

View File

@ -75,12 +75,14 @@
</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)}}% <span v-if="scope.row.完成进度&&scope.row.完成进度>0">{{(scope.row.完成进度).toFixed(2)}}%</span>
<span v-else>{{scope.row.完成进度}}</span>
</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)}}% <span v-if="scope.row.合格率&&scope.row.合格率>0">{{(scope.row.合格率).toFixed(2)}}%</span>
<span v-else>{{scope.row.合格率}}</span>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -125,44 +127,7 @@ export default {
yAxis: { yAxis: {
type: "value", type: "value",
}, },
series: [ 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",
// },
],
}, },
processData: [], processData: [],
xAxisData: [], xAxisData: [],
@ -176,12 +141,11 @@ export default {
let month = date.getMonth() + 1; let month = date.getMonth() + 1;
let days = new Date(year, month, 0).getDate(); let days = new Date(year, month, 0).getDate();
that.currentYear = year; that.currentYear = year;
that.currentMonth = month > 9 ? month : "0" + month; that.currentMonth = month;
month = month > 9 ? month : "0" + month;
that.start_date = year + "-" + month + "-01"; that.start_date = year + "-" + month + "-01";
that.end_date = that.end_date =year + "-" + month + "-" + days;
year + "-" + month + "-" + new Date(year, month, 0).getDate(); that.queryDate = year + "-" + month;
let month1 = month > 9 ? month : "0" + month;
that.queryDate = year + "-" + month1;
that.tableHeight = document.getElementById("elMain").clientHeight - 40; that.tableHeight = document.getElementById("elMain").clientHeight - 40;
that.getData6(); that.getData6();
}, },
@ -214,7 +178,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 = [],nameData=[],seriesData=[],data2 = [],data1 = [],data0 = []; let xAxisData = [],nameData=[],seriesData=[];
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;
@ -246,20 +210,10 @@ export default {
let index = xAxisData.indexOf(item.工段); let index = xAxisData.indexOf(item.工段);
let indexY = nameData.indexOf(item.物料名); let indexY = nameData.indexOf(item.物料名);
seriesData[indexY].data[index] += 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 = seriesData; that.option.series = seriesData;
// that.option.series[0].data = data0;
// that.option.series[1].data = data1;
// that.option.series[2].data = data2;
}); });
}, },
handleQuery() { handleQuery() {
@ -267,10 +221,7 @@ export default {
if (this.queryType == "月") { if (this.queryType == "月") {
this.start_date = this.queryDate + "-01"; this.start_date = this.queryDate + "-01";
let arr = this.queryDate.split("-"); let arr = this.queryDate.split("-");
this.end_date = this.end_date =this.queryDate +"-" +new Date(arr[0], arr[1], 0).getDate();
this.queryDate +
"-" +
new Date(arr[0], arr[1], 0).getDate();
} else { } else {
this.start_date = this.queryDate + "-01-01"; this.start_date = this.queryDate + "-01-01";
this.end_date = this.queryDate + "-12-31"; this.end_date = this.queryDate + "-12-31";