Merge pull request '광고통계 - 빠른검색 (날짜 지정) 추가' (#64) from test into main
Reviewed-on: #64
This commit is contained in:
commit
d5c01d8d23
|
@ -11,19 +11,51 @@
|
|||
<v-container>
|
||||
<v-row>
|
||||
<v-spacer />
|
||||
<v-col cols="2">
|
||||
<v-col>
|
||||
<v-btn
|
||||
block
|
||||
color="#3bb9f1"
|
||||
dark
|
||||
depressed
|
||||
@click="getTodayStatistics"
|
||||
>
|
||||
오늘
|
||||
</v-btn>
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-btn
|
||||
block
|
||||
color="#3bb9f1"
|
||||
dark
|
||||
depressed
|
||||
@click="getYesterdayStatistics"
|
||||
>
|
||||
어제
|
||||
</v-btn>
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-btn
|
||||
block
|
||||
color="#3bb9f1"
|
||||
dark
|
||||
depressed
|
||||
@click="getWeekStatistics"
|
||||
>
|
||||
7일 전
|
||||
</v-btn>
|
||||
</v-col>
|
||||
<v-spacer />
|
||||
<v-col>
|
||||
<datetime
|
||||
v-model="start_date"
|
||||
class="datepicker"
|
||||
format="YYYY-MM-DD"
|
||||
/>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="1">
|
||||
~
|
||||
</v-col>
|
||||
|
||||
<v-col cols="2">
|
||||
<v-col>
|
||||
<datetime
|
||||
v-model="end_date"
|
||||
class="datepicker"
|
||||
|
@ -31,8 +63,6 @@
|
|||
/>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="1" />
|
||||
|
||||
<v-col cols="2">
|
||||
<v-btn
|
||||
block
|
||||
|
@ -230,25 +260,7 @@ export default {
|
|||
},
|
||||
|
||||
async created() {
|
||||
const date = new Date();
|
||||
const firstDate = new Date(date.getFullYear(), date.getMonth(), 1);
|
||||
const lastDate = new Date(date.getFullYear(), date.getMonth() + 1, 0);
|
||||
|
||||
let firstDateMonth = (firstDate.getMonth() + 1).toString()
|
||||
if (firstDateMonth.length < 2) {
|
||||
firstDateMonth = '0' + firstDateMonth
|
||||
}
|
||||
|
||||
|
||||
let lastDateMonth = (lastDate.getMonth() + 1).toString()
|
||||
if (lastDateMonth.length < 2) {
|
||||
lastDateMonth = '0' + lastDateMonth
|
||||
}
|
||||
|
||||
this.start_date = firstDate.getFullYear() + '-' + firstDateMonth + '-0' + firstDate.getDate()
|
||||
this.end_date = lastDate.getFullYear() + '-' + lastDateMonth + '-' + lastDate.getDate()
|
||||
|
||||
await this.getStatistics()
|
||||
await this.getTodayStatistics();
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
@ -264,6 +276,10 @@ export default {
|
|||
return this.items.reduce((a, b) => a + (b[key] || 0), 0)
|
||||
},
|
||||
|
||||
formatDate(date) {
|
||||
return date.toISOString().split('T')[0];
|
||||
},
|
||||
|
||||
async next() {
|
||||
await this.getStatistics()
|
||||
},
|
||||
|
@ -293,6 +309,36 @@ export default {
|
|||
this.is_loading = false
|
||||
}
|
||||
},
|
||||
|
||||
async getTodayStatistics() {
|
||||
const today = new Date();
|
||||
|
||||
this.start_date = this.formatDate(today);
|
||||
this.end_date = this.formatDate(today);
|
||||
|
||||
await this.getStatistics()
|
||||
},
|
||||
|
||||
async getYesterdayStatistics() {
|
||||
const yesterday = new Date();
|
||||
yesterday.setDate(yesterday.getDate() - 1);
|
||||
|
||||
this.start_date = this.formatDate(yesterday);
|
||||
this.end_date = this.formatDate(yesterday);
|
||||
await this.getStatistics()
|
||||
},
|
||||
|
||||
async getWeekStatistics() {
|
||||
const week = new Date();
|
||||
week.setDate(week.getDate() - 8);
|
||||
|
||||
const yesterday = new Date();
|
||||
yesterday.setDate(yesterday.getDate() - 1);
|
||||
|
||||
this.start_date = this.formatDate(week);
|
||||
this.end_date = this.formatDate(yesterday);
|
||||
await this.getStatistics()
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue