#feature: some update

This commit is contained in:
2026-08-12 18:00:09 +08:00
parent ba916f5ce1
commit 103340536b
39 changed files with 2916 additions and 227 deletions
+49 -7
View File
@@ -87,6 +87,18 @@
>
查询今天数据
</button>
<button
@click="setQuickDateRange('previousDay')"
class="px-4 py-2 text-sm font-medium rounded-md bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors"
>
前一天
</button>
<button
@click="setQuickDateRange('nextDay')"
class="px-4 py-2 text-sm font-medium rounded-md bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors"
>
后一天
</button>
<button
@click="clearQuickSelect()"
v-if="workLogs.activeQuickSelect"
@@ -378,8 +390,8 @@ export default {
const monday = new Date(today);
monday.setDate(today.getDate() + mondayOffset);
this.workLogs.startDate = monday.toISOString().split('T')[0];
this.workLogs.endDate = today.toISOString().split('T')[0];
this.workLogs.startDate = this.formatDate(monday);
this.workLogs.endDate = this.formatDate(today);
},
setLastWeekDateRange() {
@@ -394,28 +406,50 @@ export default {
const lastSunday = new Date(today);
lastSunday.setDate(today.getDate() + lastSundayOffset);
this.workLogs.startDate = lastMonday.toISOString().split('T')[0];
this.workLogs.endDate = lastSunday.toISOString().split('T')[0];
this.workLogs.startDate = this.formatDate(lastMonday);
this.workLogs.endDate = this.formatDate(lastSunday);
},
setYesterdayDateRange() {
const yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
const dateStr = yesterday.toISOString().split('T')[0];
const dateStr = this.formatDate(yesterday);
this.workLogs.startDate = dateStr;
this.workLogs.endDate = dateStr;
},
setTodayDateRange() {
const today = new Date();
const dateStr = today.toISOString().split('T')[0];
const dateStr = this.formatDate(today);
this.workLogs.startDate = dateStr;
this.workLogs.endDate = dateStr;
},
setQuickDateRange(type) {
shiftDateRange(days) {
const startDate = new Date(`${this.workLogs.startDate}T00:00:00`);
const endDate = new Date(`${this.workLogs.endDate}T00:00:00`);
if (Number.isNaN(startDate.getTime()) || Number.isNaN(endDate.getTime())) {
this.setTodayDateRange();
return;
}
startDate.setDate(startDate.getDate() + days);
endDate.setDate(endDate.getDate() + days);
this.workLogs.startDate = this.formatDate(startDate);
this.workLogs.endDate = this.formatDate(endDate);
},
formatDate(date) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
},
async setQuickDateRange(type) {
this.workLogs.activeQuickSelect = type;
switch (type) {
@@ -428,7 +462,15 @@ export default {
case 'today':
this.setTodayDateRange();
break;
case 'previousDay':
this.shiftDateRange(-1);
break;
case 'nextDay':
this.shiftDateRange(1);
break;
}
await this.getWorkLogs();
},
clearQuickSelect() {