fix:修改日期选择器默认时间

This commit is contained in:
zhongzm
2024-11-06 15:25:23 +08:00
parent 8283523327
commit f75719ca37
2 changed files with 39 additions and 32 deletions

View File

@@ -250,7 +250,6 @@ const chartStates: Record<AllChartType, ReturnType<typeof createChartState>> = O
//日期选择器
interface RangePicker extends Record<AllChartType, [string, string]> {
placeholder: [string, string];
ranges: Record<string, [Dayjs, Dayjs]>;
}
// 日期选择器状态
@@ -258,17 +257,11 @@ const rangePicker = reactive<RangePicker>({
...Object.fromEntries(networkElementTypes.value.map(type => [
type,
[
dayjs().startOf('day').valueOf().toString(), // 0 点 0 分 0 秒
dayjs().valueOf().toString() // 此时
dayjs().startOf('hour').valueOf().toString(), // 当前小时内
dayjs().endOf('hour').valueOf().toString()
]
])) as Record<AllChartType, [string, string]>,
placeholder: [t('views.monitor.monitor.startTime'), t('views.monitor.monitor.endTime')] as [string, string],
ranges: {
[t('views.monitor.monitor.yesterday')]: [dayjs().subtract(1, 'day').startOf('day'), dayjs().subtract(1, 'day').endOf('day')],
[t('views.monitor.monitor.today')]: [dayjs().startOf('day'), dayjs()],
[t('views.monitor.monitor.week')]: [dayjs().startOf('week'), dayjs().endOf('week')],
[t('views.monitor.monitor.month')]: [dayjs().startOf('month'), dayjs().endOf('month')],
} as Record<string, [Dayjs, Dayjs]>,
});
// 可复用的图表初始化函数
@@ -896,7 +889,6 @@ const applyTwoColumnLayout = () => {
format="YYYY-MM-DD HH:mm:ss"
value-format="x"
:placeholder="rangePicker.placeholder"
:ranges="rangePicker.ranges"
style="width: 360px"
@change="() => fetchData(item.i)"
class="no-drag"