diff --git a/src/views/statistics/hunliao.vue b/src/views/statistics/hunliao.vue
index f215c8b0..2c9f0cc5 100644
--- a/src/views/statistics/hunliao.vue
+++ b/src/views/statistics/hunliao.vue
@@ -144,13 +144,12 @@ export default {
let days = new Date(year, month, 0).getDate();
that.currentYear = year;
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.end_date = year + '-' + month + '-' + new Date(year, month, 0).getDate();
- 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));
+ that.end_date = year + '-' + month + '-' + days;
+ that.queryDate = year + '-' + month;
let duration = that.endWeekNum - that.firstWeekNum + 1;
for (let i = 1; i <= duration; i++) {
that.xAxisOrigin.push('第' + i + '周');
@@ -179,15 +178,13 @@ export default {
console.log(value)
this.queryDate = '';
},
- getWeekOfYear(date) {
- var target = new Date(date.getFullYear(), date.getMonth(), date.getDate()); // 创建目标日期对象
- var firstDayOfYear = new Date(target.getFullYear(), 0, 1); // 创建当前年份第一天的日期对象
- if (target.getTime() == firstDayOfYear.getTime()) {
- return 1;
- } else {
- return Math.ceil((target - firstDayOfYear + 8 * (firstDayOfYear.getTimezoneOffset() / 480)) / 604800000);
- }
- // 计算两者之间相隔的周数并返回结果
+ getWeekOfYear(a,b,c) {
+ var date1 = new Date(a, parseInt(b) - 1, c), //当前日期
+ date2 = new Date(a, 0, 1), //当年第一天
+ // d是当前日期是今年第多少天
+ d = Math.round((date1.valueOf() - date2.valueOf()) / 86400000);
+ // d + 当前年的第一天的周差距的和在除以7就是本年第几周
+ return Math.ceil((d + (date2.getDay() + 1 - 1)) / 7);
},
getDataHL() {
let that = this;
@@ -286,38 +283,40 @@ export default {
},
handleQuery() {
let that = this;
- if (this.queryType == '月') {
- if (this.queryDate !== '' && this.queryDate !== null) {
- this.start_date = this.queryDate + '-01';
- let arr = this.queryDate.split('-');
- this.end_date = this.queryDate + '-' + new Date(arr[0], arr[1], 0).getDate();
- this.firstWeekNum = this.getWeekOfYear(new Date(this.start_date));
- this.endWeekNum = this.getWeekOfYear(new Date(this.end_date));
- let duration = this.endWeekNum - this.firstWeekNum + 1;
+ if (that.queryType == '月') {
+ if (that.queryDate !== '' && that.queryDate !== null) {
+ let arr = that.queryDate.split('-');
+ let year = arr[0];
+ let month = arr[1];
+ let days = new Date(year, month, 0).getDate();
+ that.start_date = that.queryDate + '-01';
+ 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 = [];
for (let i = 1; i <= duration; i++) {
xAxisData.push('第' + i + '周');
}
that.xAxisData = xAxisData;
} else {
- this.start_date = this.currentYear + '-' + this.currentMonth + '-01';
- this.end_date = this.currentYear + '-' + 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;
+ that.start_date = that.currentYear + '-' + that.currentMonth + '-01';
+ that.end_date = that.currentYear + '-' + that.currentMonth + '-' + new Date(that.currentYear, that.currentMonth, 0).getDate();
+ that.firstWeekNum = that.getWeekOfYear(that.currentYear,that.currentMonth,1);
+ that.xAxisData = that.xAxisOrigin;
}
} else {
- if (this.queryDate !== '' && this.queryDate !== null) {
- this.start_date = this.queryDate + '-01-01';
- this.end_date = this.queryDate + '-12-31';
+ if (that.queryDate !== '' && that.queryDate !== null) {
+ that.start_date = that.queryDate + '-01-01';
+ that.end_date = that.queryDate + '-12-31';
} else {
- this.start_date = this.currentYear + '-01-01';
- this.end_date = this.currentYear + '-12-31';
+ that.start_date = that.currentYear + '-01-01';
+ that.end_date = that.currentYear + '-12-31';
}
that.xAxisData = that.monthList;
}
- this.getDataHL();
- this.getDataHLXH();
+ that.getDataHL();
+ that.getDataHLXH();
},
handleExport(val) {
this.exportLoading = true;
diff --git a/src/views/statistics/material_statistics.vue b/src/views/statistics/material_statistics.vue
index eb8ad266..89e1d1be 100644
--- a/src/views/statistics/material_statistics.vue
+++ b/src/views/statistics/material_statistics.vue
@@ -258,18 +258,12 @@ export default {
let days = new Date(year, month, 0).getDate();
that.currentYear = year;
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.end_date =
- year + "-" + month + "-" + new Date(year, month, 0).getDate();
- 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)
+ that.end_date =year + "-" + month + "-" + days;
+ that.queryDate = year + "-" + month;
let duration = that.endWeekNum - that.firstWeekNum + 1;
for (let i = 1; i <= duration; i++) {
that.xAxisOrigin.push("第" + i + "周");
@@ -280,8 +274,8 @@ export default {
that.rightHeight = height - 115;
that.tableHeight = height - 140 - chartheight;
that.setChart("bachart1", that.basicOption);
- this.getInmOption();
- this.getTable();
+ that.getInmOption();
+ that.getTable();
},
methods: {
setChart(name, option = null) {
@@ -300,24 +294,14 @@ export default {
} catch (error) {}
}, 500);
},
- getWeekOfYear(date) {
- var target = new Date(
- date.getFullYear(),
- date.getMonth(),
- date.getDate()
- ); //目标日期
- var firstDayOfYear = new Date(target.getFullYear(), 0, 1); // 当前年份第一天
- if (target.getTime() == firstDayOfYear.getTime()) {
- return 1;
- } else {
- return Math.ceil(
- (target -
- firstDayOfYear +
- 8 * (firstDayOfYear.getTimezoneOffset() / 480)) /
- 604800000
- );
- }
- },
+ getWeekOfYear(a,b,c) {
+ var date1 = new Date(a, parseInt(b) - 1, c), //当前日期
+ date2 = new Date(a, 0, 1), //当年第一天
+ // d是当前日期是今年第多少天
+ d = Math.round((date1.valueOf() - date2.valueOf()) / 86400000);
+ // d + 当前年的第一天的周差距的和在除以7就是本年第几周
+ return Math.ceil((d + (date2.getDay() + 1 - 1)) / 7);
+ },
queryTypeChange(value) {
console.log(value);
this.queryDate = "";
@@ -402,18 +386,14 @@ export default {
let that = this;
if (that.queryType == "月") {
if (that.queryDate !== "" && that.queryDate !== null) {
- that.start_date = that.queryDate + "-01";
let arr = that.queryDate.split("-");
- that.end_date =
- that.queryDate +
- "-" +
- new Date(arr[0], arr[1], 0).getDate();
- that.firstWeekNum = that.getWeekOfYear(
- new Date(that.start_date)
- );
- that.endWeekNum = that.getWeekOfYear(
- new Date(that.end_date)
- );
+ let year = arr[0];
+ let month = arr[1];
+ let days = new Date(year, month, 0).getDate();
+ that.start_date = that.queryDate + "-01";
+ 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 = [];
for (let i = 1; i <= duration; i++) {
@@ -421,20 +401,9 @@ export default {
}
that.xAxisData = xAxisData;
} else {
- that.start_date =
- that.currentYear + "-" + that.currentMonth + "-01";
- that.end_date =
- 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.start_date =that.currentYear + "-" + that.currentMonth + "-01";
+ that.end_date =that.currentYear +"-" +that.currentMonth +"-" +new Date(that.currentYear,that.currentMonth,0).getDate();
+ that.firstWeekNum = that.getWeekOfYear(that.currentYear,that.currentMonth,1);
that.xAxisData = that.xAxisOrigin;
}
} else {
diff --git a/src/views/statistics/pass_num.vue b/src/views/statistics/pass_num.vue
index 978a1795..0b3f5517 100644
--- a/src/views/statistics/pass_num.vue
+++ b/src/views/statistics/pass_num.vue
@@ -346,16 +346,12 @@ export default {
let days = new Date(year, month, 0).getDate();
that.currentYear = year;
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.end_date =
- year + "-" + month + "-" + new Date(year, month, 0).getDate();
- 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));
+ that.end_date =year + "-" + month + "-" + days;
+ that.queryDate = year + "-" + month;
let duration = that.endWeekNum - that.firstWeekNum + 1;
for (let i = 1; i <= duration; i++) {
that.xAxisOrigin.push("第" + i + "周");
@@ -388,25 +384,14 @@ export default {
console.log(value);
this.queryDate = "";
},
- getWeekOfYear(date) {
- var target = new Date(
- date.getFullYear(),
- date.getMonth(),
- date.getDate()
- ); // 创建目标日期对象
- var firstDayOfYear = new Date(target.getFullYear(), 0, 1); // 创建当前年份第一天的日期对象
- if (target.getTime() == firstDayOfYear.getTime()) {
- return 1;
- } else {
- return Math.ceil(
- (target -
- firstDayOfYear +
- 8 * (firstDayOfYear.getTimezoneOffset() / 480)) /
- 604800000
- );
- }
- // 计算两者之间相隔的周数并返回结果
- },
+ getWeekOfYear(a,b,c) {
+ var date1 = new Date(a, parseInt(b) - 1, c), //当前日期
+ date2 = new Date(a, 0, 1), //当年第一天
+ // d是当前日期是今年第多少天
+ d = Math.round((date1.valueOf() - date2.valueOf()) / 86400000);
+ // d + 当前年的第一天的周差距的和在除以7就是本年第几周
+ return Math.ceil((d + (date2.getDay() + 1 - 1)) / 7);
+ },
getData6() {
let that = this;
let option = deepCopy(that.basicOption);
@@ -612,57 +597,42 @@ export default {
},
handleQuery() {
let that = this;
- if (this.queryType == "月") {
- if (this.queryDate !== "" && this.queryDate !== null) {
- this.start_date = this.queryDate + "-01";
- let arr = this.queryDate.split("-");
- this.end_date =
- this.queryDate +
- "-" +
- new Date(arr[0], arr[1], 0).getDate();
- this.firstWeekNum = this.getWeekOfYear(
- new Date(this.start_date)
- );
- this.endWeekNum = this.getWeekOfYear(
- new Date(this.end_date)
- );
- let duration = this.endWeekNum - this.firstWeekNum + 1;
+ if (that.queryType == "月") {
+ if (that.queryDate !== "" && that.queryDate !== null) {
+ let arr = that.queryDate.split("-");
+ let year = arr[0];
+ let month = arr[1];
+ let days = new Date(year, month, 0).getDate();
+ that.start_date = that.queryDate + "-01";
+ 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 = [];
for (let i = 1; i <= duration; i++) {
xAxisData.push("第" + i + "周");
}
that.xAxisData = xAxisData;
} else {
- this.start_date =
- this.currentYear + "-" + this.currentMonth + "-01";
- this.end_date =
- this.currentYear +
- "-" +
- 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;
+ that.start_date =that.currentYear + "-" + that.currentMonth + "-01";
+ that.end_date =that.currentYear +"-" +that.currentMonth +"-" +new Date(that.currentYear,that.currentMonth,0).getDate();
+ that.firstWeekNum = that.getWeekOfYear(that.currentYear,that.currentMonth,1);;
+ that.xAxisData = that.xAxisOrigin;
}
} else {
- if (this.queryDate !== "" && this.queryDate !== null) {
- this.start_date = this.queryDate + "-01-01";
- this.end_date = this.queryDate + "-12-31";
+ if (that.queryDate !== "" && that.queryDate !== null) {
+ that.start_date = that.queryDate + "-01-01";
+ that.end_date = that.queryDate + "-12-31";
} else {
- this.start_date = this.currentYear + "-01-01";
- this.end_date = this.currentYear + "-12-31";
+ that.start_date = that.currentYear + "-01-01";
+ that.end_date = that.currentYear + "-12-31";
}
that.xAxisData = that.monthList;
}
- this.getData6();
- this.getData7();
- this.getData10();
- this.getDataDAVG();
+ that.getData6();
+ that.getData7();
+ that.getData10();
+ that.getDataDAVG();
},
handleExport(val) {
this.exportLoading = true;
diff --git a/src/views/statistics/ppass_num.vue b/src/views/statistics/ppass_num.vue
index 080c179b..da1d57ab 100644
--- a/src/views/statistics/ppass_num.vue
+++ b/src/views/statistics/ppass_num.vue
@@ -75,12 +75,14 @@
- {{(scope.row.完成进度).toFixed(2)}}%
+ {{(scope.row.完成进度).toFixed(2)}}%
+ {{scope.row.完成进度}}
- {{(scope.row.合格率).toFixed(2)}}%
+ {{(scope.row.合格率).toFixed(2)}}%
+ {{scope.row.合格率}}
@@ -125,44 +127,7 @@ export default {
yAxis: {
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",
- // },
- ],
+ series: [],
},
processData: [],
xAxisData: [],
@@ -176,12 +141,11 @@ export default {
let month = date.getMonth() + 1;
let days = new Date(year, month, 0).getDate();
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.end_date =
- year + "-" + month + "-" + new Date(year, month, 0).getDate();
- let month1 = month > 9 ? month : "0" + month;
- that.queryDate = year + "-" + month1;
+ that.end_date =year + "-" + month + "-" + days;
+ that.queryDate = year + "-" + month;
that.tableHeight = document.getElementById("elMain").clientHeight - 40;
that.getData6();
},
@@ -214,7 +178,7 @@ export default {
",EXTRACT ( MONTH FROM mlog.handle_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) => {
let data = res.data2.ds0;
that.tableData = data;
@@ -246,20 +210,10 @@ export default {
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 = seriesData;
- // that.option.series[0].data = data0;
- // that.option.series[1].data = data1;
- // that.option.series[2].data = data2;
});
},
handleQuery() {
@@ -267,10 +221,7 @@ export default {
if (this.queryType == "月") {
this.start_date = this.queryDate + "-01";
let arr = this.queryDate.split("-");
- this.end_date =
- this.queryDate +
- "-" +
- new Date(arr[0], arr[1], 0).getDate();
+ this.end_date =this.queryDate +"-" +new Date(arr[0], arr[1], 0).getDate();
} else {
this.start_date = this.queryDate + "-01-01";
this.end_date = this.queryDate + "-12-31";