From c32d4be6290ee261ac94b9878a32c5c388fc8129 Mon Sep 17 00:00:00 2001 From: licp <lichunping@guanfang.com.cn> Date: 星期四, 19 十二月 2024 10:30:12 +0800 Subject: [PATCH] 完成站点工时统计优化 --- src/components/view/b4-site-hours-statistics.vue | 13 +++++-------- src/components/view/b4-daily-business-statistics.vue | 7 ++++--- src/components/view/b4-inspection-item-statistics.vue | 7 ++++--- src/components/view/index-index.vue | 7 ++++--- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/components/view/b4-daily-business-statistics.vue b/src/components/view/b4-daily-business-statistics.vue index 19673d5..99b11f8 100644 --- a/src/components/view/b4-daily-business-statistics.vue +++ b/src/components/view/b4-daily-business-statistics.vue @@ -263,10 +263,10 @@ case '鏈�': const year = new Date(this.time.month).getFullYear(); const month = new Date(this.time.month).getMonth(); - + const day = new Date(year, month + 1, 0).getDate(); // // 璁剧疆璧峰鏃ユ湡鍜岀粨鏉熸棩鏈� - this.startTime = new Date(year, month, 1).toISOString().slice(0, 10); // 鏈堝垵 - this.endTime = new Date(year, month + 1, 0).toISOString().slice(0, 10); // 鏈堟湯 + this.startTime = `${year}-${month + 1}-01` + this.endTime = `${year}-${month + 1}-${day}` // 鏈堟湯 break; case '骞�': const year0 = new Date(this.time.year).getFullYear(); @@ -277,6 +277,7 @@ }else{ this.startTime = getYearAndMonthAndDays(new Date((new Date).getTime() - 24 * 60 * 60 * 1000)) this.endTime = getYearAndMonthAndDays(new Date((new Date).getTime() + 24 * 60 * 60 * 1000 * 5)) + this.time.week = new Date() } this.init() }, diff --git a/src/components/view/b4-inspection-item-statistics.vue b/src/components/view/b4-inspection-item-statistics.vue index 901b544..5654875 100644 --- a/src/components/view/b4-inspection-item-statistics.vue +++ b/src/components/view/b4-inspection-item-statistics.vue @@ -310,10 +310,10 @@ case '鏈�': const year = new Date(this.time.month).getFullYear(); const month = new Date(this.time.month).getMonth(); - + const day = new Date(year, month + 1, 0).getDate(); // // 璁剧疆璧峰鏃ユ湡鍜岀粨鏉熸棩鏈� - this.startTime = new Date(year, month, 1).toISOString().slice(0, 10); // 鏈堝垵 - this.endTime = new Date(year, month + 1, 0).toISOString().slice(0, 10); // 鏈堟湯 + this.startTime = `${year}-${month + 1}-01` + this.endTime = `${year}-${month + 1}-${day}` // 鏈堟湯 break; case '骞�': const year0 = new Date(this.time.year).getFullYear(); @@ -324,6 +324,7 @@ }else{ this.startTime = getYearAndMonthAndDays(new Date((new Date).getTime() - 24 * 60 * 60 * 1000)) this.endTime = getYearAndMonthAndDays(new Date((new Date).getTime() + 24 * 60 * 60 * 1000 * 5)) + this.time.week = new Date() } this.init() } diff --git a/src/components/view/b4-site-hours-statistics.vue b/src/components/view/b4-site-hours-statistics.vue index f14c36f..87f2526 100644 --- a/src/components/view/b4-site-hours-statistics.vue +++ b/src/components/view/b4-site-hours-statistics.vue @@ -247,12 +247,8 @@ } }, mounted(){ - const year = new Date().getFullYear(); - const month = new Date().getMonth(); - // 璁剧疆璧峰鏃ユ湡鍜岀粨鏉熸棩鏈� - this.startTime = new Date(year, month, 1).toISOString().slice(0, 10); // 鏈堝垵 - this.endTime = new Date(year, month + 1, 0).toISOString().slice(0, 10); // 鏈堟湯 - this.init() + this.month = new Date() + this.changeTime() }, methods:{ init(){ @@ -298,9 +294,10 @@ changeTime(){ const year = new Date(this.month).getFullYear(); const month = new Date(this.month).getMonth(); + const day = new Date(year, month + 1, 0).getDate(); // // 璁剧疆璧峰鏃ユ湡鍜岀粨鏉熸棩鏈� - this.startTime = new Date(year, month, 1).toISOString().slice(0, 10); // 鏈堝垵 - this.endTime = new Date(year, month + 1, 0).toISOString().slice(0, 10); // 鏈堟湯 + this.startTime = `${year}-${month + 1}-01` + this.endTime = `${year}-${month + 1}-${day}` // 鏈堟湯 this.siteList.forEach(item=>{ item.page.current = 1 }) diff --git a/src/components/view/index-index.vue b/src/components/view/index-index.vue index bfe5816..cc46e86 100644 --- a/src/components/view/index-index.vue +++ b/src/components/view/index-index.vue @@ -889,10 +889,10 @@ case '鏈�': const year = new Date(this.time.month).getFullYear(); const month = new Date(this.time.month).getMonth(); - + const day = new Date(year, month + 1, 0).getDate(); // // 璁剧疆璧峰鏃ユ湡鍜岀粨鏉熸棩鏈� - this.startTime = new Date(year, month, 1).toISOString().slice(0, 10); // 鏈堝垵 - this.endTime = new Date(year, month + 1, 0).toISOString().slice(0, 10); // 鏈堟湯 + this.startTime = `${year}-${month + 1}-01` + this.endTime = `${year}-${month + 1}-${day}` // 鏈堟湯 break; case '骞�': const year0 = new Date(this.time.year).getFullYear(); @@ -907,6 +907,7 @@ // 璁剧疆璧峰鏃ユ湡鍜岀粨鏉熸棩鏈� this.startTime = new Date(year, month, 1).toISOString().slice(0, 10); // 鏈堝垵 this.endTime = new Date(year, month + 1, 0).toISOString().slice(0, 10); // 鏈堟湯 + this.time.month = new Date() } this.initEchart() }, -- Gitblit v1.9.3