增加最近按钮
This commit is contained in:
@@ -270,13 +270,19 @@ async function loadTrajectoryRange() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyTodayTrajectory() {
|
function applyRecentTrajectory(days: number) {
|
||||||
const today = toDateInputValue()
|
const end = new Date()
|
||||||
trajectoryStartDate.value = today
|
const start = new Date()
|
||||||
trajectoryEndDate.value = today
|
start.setDate(end.getDate() - days + 1)
|
||||||
|
trajectoryStartDate.value = toDateInputValue(start)
|
||||||
|
trajectoryEndDate.value = toDateInputValue(end)
|
||||||
loadTrajectoryRange()
|
loadTrajectoryRange()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function applyTodayTrajectory() {
|
||||||
|
applyRecentTrajectory(1)
|
||||||
|
}
|
||||||
|
|
||||||
async function loadInitialMessages() {
|
async function loadInitialMessages() {
|
||||||
const response = await getTextMessages(chatPageSize, 0, props.nodeId)
|
const response = await getTextMessages(chatPageSize, 0, props.nodeId)
|
||||||
messages.value = toChronological(response.items)
|
messages.value = toChronological(response.items)
|
||||||
@@ -639,6 +645,8 @@ onBeforeUnmount(() => {
|
|||||||
{{ trajectoryLoading ? '查询中...' : '查询轨迹' }}
|
{{ trajectoryLoading ? '查询中...' : '查询轨迹' }}
|
||||||
</button>
|
</button>
|
||||||
<button type="button" :disabled="trajectoryLoading" @click="applyTodayTrajectory">今天</button>
|
<button type="button" :disabled="trajectoryLoading" @click="applyTodayTrajectory">今天</button>
|
||||||
|
<button type="button" :disabled="trajectoryLoading" @click="applyRecentTrajectory(3)">最近三天</button>
|
||||||
|
<button type="button" :disabled="trajectoryLoading" @click="applyRecentTrajectory(7)">最近七天</button>
|
||||||
</div>
|
</div>
|
||||||
<p v-if="trajectoryError" class="error trajectory-status">{{ trajectoryError }}</p>
|
<p v-if="trajectoryError" class="error trajectory-status">{{ trajectoryError }}</p>
|
||||||
<p v-else-if="trajectoryTruncated" class="trajectory-status">轨迹点较多,仅显示前 {{ maxTrajectoryPoints }} 条,请缩小日期范围。</p>
|
<p v-else-if="trajectoryTruncated" class="trajectory-status">轨迹点较多,仅显示前 {{ maxTrajectoryPoints }} 条,请缩小日期范围。</p>
|
||||||
|
|||||||
Reference in New Issue
Block a user