内部时间组件设置默认值

This commit is contained in:
stt
2025-11-06 14:24:15 +08:00
parent b5aff1a837
commit 593f2e2c66
4 changed files with 205 additions and 19 deletions

View File

@@ -3,7 +3,7 @@
<TableHeader :showSearch="false" v-if="flag">
<template v-slot:select>
<el-form-item label="日期">
<DatePicker ref="datePickerRef" :nextFlag="false" :theCurrentTime="true"></DatePicker>
<DatePicker ref="datePickerRef" :nextFlag="false" :theCurrentTime="true" @change="handleDatePickerChange"></DatePicker>
</el-form-item>
</template>
<template v-slot:operation>
@@ -42,6 +42,7 @@
:height="rowHeight * item.h - seRowHeight(item.h) + 'px'"
:width="rowWidth * item.w - 30 + 'px'"
:timeKey="(item as LayoutItem).timeKey"
:interval="datePickerRef?.interval"
:w="item.w"
:h="item.h"
/>
@@ -63,10 +64,13 @@ import DatePicker from '@/components/form/datePicker/index.vue'
import { useDebounceFn } from '@vueuse/core'
import { queryActivatePage, queryByPagePath } from '@/api/system-boot/csstatisticalset'
import RoutingConfig from '@/views/pqs/cockpit/homePage/components/routingConfig.vue'
import { useRouter } from 'vue-router'
import { useRouter,useRoute } from 'vue-router'
import { useTimeCacheStore } from '@/stores/timeCache'
const { push } = useRouter()
const datePickerRef = ref()
const router = useRouter()
const route = useRoute()
const timeCacheStore = useTimeCacheStore()
defineOptions({
// name: 'dashboard/index'
@@ -225,6 +229,21 @@ const editd = (e: any) => {
const settings = () => {
RoutingConfigRef.value.open()
}
// 处理 DatePicker 值变化事件
const handleDatePickerChange = (value: any) => {
console.log('DatePicker value changed111:', value)
// 将值缓存到 timeCache
if (value) {
timeCacheStore.setCache(
route.path,
value.interval,
value.timeValue
)
}
}
// 生命周期钩子
onMounted(() => {
// initRowHeight()