日历只月的时候调接口

This commit is contained in:
stt
2025-12-03 13:26:03 +08:00
parent aa07112605
commit bcb1535d4d

View File

@@ -68,7 +68,8 @@ const prop = defineProps({
width: { type: [String, Number] }, width: { type: [String, Number] },
height: { type: [String, Number] }, height: { type: [String, Number] },
timeKey: { type: [String, Number] }, timeKey: { type: [String, Number] },
timeValue: { type: Object } timeValue: { type: Object },
interval: { type: [String, Number] }
}) })
const headerHeight = ref(57) const headerHeight = ref(57)
@@ -119,9 +120,14 @@ const tableStore: any = new TableStore({
column: [], column: [],
beforeSearchFun: () => { beforeSearchFun: () => {
if (!fullscreen.value && prop.timeValue && Array.isArray(prop.timeValue)) { if (!fullscreen.value) {
if (prop.interval == 3 && prop.timeValue && Array.isArray(prop.timeValue)) {
tableStore.table.params.searchBeginTime = prop.timeValue[0] tableStore.table.params.searchBeginTime = prop.timeValue[0]
tableStore.table.params.searchEndTime = prop.timeValue[1] tableStore.table.params.searchEndTime = prop.timeValue[1]
} else {
tableStore.table.params.searchBeginTime = '2025-12-1'
tableStore.table.params.searchEndTime = '2025-12-31'
}
} }
}, },
@@ -152,16 +158,31 @@ onMounted(() => {
TableHeaderRef.value.setDatePicker([{ label: '月份', value: 3 }]) TableHeaderRef.value.setDatePicker([{ label: '月份', value: 3 }])
} }
if (fullscreen.value) { if (fullscreen.value) {
if (prop.interval == 3 && prop.timeValue && Array.isArray(prop.timeValue)) {
tableStore.table.params.searchBeginTime = prop.timeValue[0] || tableStore.table.params.searchBeginTime
tableStore.table.params.searchEndTime = prop.timeValue[1] || tableStore.table.params.searchEndTime
TableHeaderRef.value.setTimeInterval(prop.timeValue)
} else {
TableHeaderRef.value.setInterval(3) TableHeaderRef.value.setInterval(3)
} }
}
tableStore.index() tableStore.index()
}) })
}) })
watch( watch(
() => prop.timeKey, () => prop.timeKey,
val => { val => {
// tableStore.index()
}
)
watch(
() => prop.interval,
val => {
if (val == 3) {
tableStore.index() tableStore.index()
} }
}
) )
watch( watch(
() => prop.timeValue, () => prop.timeValue,
@@ -183,7 +204,7 @@ watch(
) )
// 电压暂降点击事件 // 电压暂降点击事件
const descentClick = (item:any) => { const descentClick = (item: any) => {
transientListRef.value.open(item.name) transientListRef.value.open(item.name)
} }
</script> </script>