fix: 将"近两周"时间范围选项改为"上周数据"
修改时间范围选项从"近两周"变为"上周数据",并调整对应的日期计算逻辑,使其准确获取上周一到上周日的数据
This commit is contained in:
@@ -46,21 +46,21 @@
|
|||||||
:class="{ active: timeRange === 'daily' }"
|
:class="{ active: timeRange === 'daily' }"
|
||||||
@click="setTimeRange('daily')"
|
@click="setTimeRange('daily')"
|
||||||
>
|
>
|
||||||
每日
|
本日
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="switch-option"
|
class="switch-option"
|
||||||
:class="{ active: timeRange === 'weekly' }"
|
:class="{ active: timeRange === 'weekly' }"
|
||||||
@click="setTimeRange('weekly')"
|
@click="setTimeRange('weekly')"
|
||||||
>
|
>
|
||||||
每周
|
本周
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="switch-option"
|
class="switch-option"
|
||||||
:class="{ active: timeRange === 'twoweekly' }"
|
:class="{ active: timeRange === 'lastWeek' }"
|
||||||
@click="setTimeRange('twoweekly')"
|
@click="setTimeRange('lastWeek')"
|
||||||
>
|
>
|
||||||
近两周
|
上周
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -309,10 +309,10 @@ export default {
|
|||||||
// 本周(周一到周日)- 设置周起始日为周一
|
// 本周(周一到周日)- 设置周起始日为周一
|
||||||
this.search.startTime = today.startOf("week", { weekStart: 1 }).toDate();
|
this.search.startTime = today.startOf("week", { weekStart: 1 }).toDate();
|
||||||
this.search.endTime = today.endOf("week", { weekStart: 1 }).toDate();
|
this.search.endTime = today.endOf("week", { weekStart: 1 }).toDate();
|
||||||
} else if (type === "twoweekly") {
|
} else if (type === "lastWeek") {
|
||||||
// 近两周(当前日期向前推14天)
|
// 上周(上周周一到上周周日)- 设置周起始日为周一
|
||||||
this.search.startTime = today.subtract(14, 'day').startOf('day').toDate();
|
this.search.startTime = today.subtract(1, "week").startOf("week", { weekStart: 1 }).toDate();
|
||||||
this.search.endTime = today.endOf('day').toDate();
|
this.search.endTime = today.subtract(1, "week").endOf("week", { weekStart: 1 }).toDate();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重新查询数据
|
// 重新查询数据
|
||||||
|
|||||||
Reference in New Issue
Block a user