This commit is contained in:
guanj
2025-12-04 09:37:58 +08:00
3 changed files with 60 additions and 34 deletions

View File

@@ -44,6 +44,7 @@ import { ref, onMounted, provide, reactive, watch, h } from 'vue'
import TableStore from '@/utils/tableStore'
import TableHeader from '@/components/table/header/index.vue'
import { dayjs } from 'element-plus'
import { getTime } from '@/utils/formatTime'
const prop = defineProps({
w: { type: [String, Number] },
@@ -51,7 +52,8 @@ const prop = defineProps({
width: { type: [String, Number] },
height: { type: [String, Number] },
timeKey: { type: [String, Number] },
timeValue: { type: Object }
timeValue: { type: Object },
interval: { type: Number }
})
const headerHeight = ref(57)
@@ -95,11 +97,16 @@ const tableStore: any = new TableStore({
method: 'POST',
showPage: false,
column: [],
// beforeSearchFun: () => {
// if (!fullscreen.value && prop.timeValue && Array.isArray(prop.timeValue)) {
// tableStore.table.params.searchBeginTime = prop.timeValue[0]
// tableStore.table.params.searchEndTime = prop.timeValue[1]
// }
// },
beforeSearchFun: () => {
if (!fullscreen.value && prop.timeValue && Array.isArray(prop.timeValue)) {
tableStore.table.params.searchBeginTime = prop.timeValue[0]
tableStore.table.params.searchEndTime = prop.timeValue[1]
}
const time = getTime(prop.interval ?? 0, prop.timeKey, prop.timeValue)
tableStore.table.params.searchBeginTime = time[0]
tableStore.table.params.searchEndTime = time[1]
},
loadCallback: () => {
value.value = tableStore.table.params.searchBeginTime
@@ -148,7 +155,14 @@ onMounted(() => {
TableHeaderRef.value.setDatePicker([{ label: '月份', value: 3 }])
}
if (fullscreen.value) {
TableHeaderRef.value.setInterval(3)
if (prop.interval == 3) {
const time = getTime(prop.interval ?? 0, prop.timeKey, prop.timeValue)
tableStore.table.params.searchBeginTime = time[0]
tableStore.table.params.searchEndTime = time[1]
TableHeaderRef.value.setTimeInterval(prop.timeValue)
} else {
TableHeaderRef.value.setInterval(3)
}
}
tableStore.index()
})
@@ -161,18 +175,14 @@ watch(
)
watch(
() => prop.timeValue,
// (newVal, oldVal) => {
// // 当外部时间值变化时,更新表格的时间参数
// if (newVal && (!oldVal || newVal[0] !== oldVal[0] || newVal[1] !== oldVal[1])) {
// tableStore.table.params.searchBeginTime = newVal[0]
// tableStore.table.params.searchEndTime = newVal[1]
// tableStore.index()
// }
// },
val => {
tableStore.index()
(newVal, oldVal) => {
// 当外部时间值变化时,更新表格的时间参数
if (newVal && (!oldVal || newVal[0] !== oldVal[0] || newVal[1] !== oldVal[1])) {
tableStore.table.params.searchBeginTime = newVal[0]
tableStore.table.params.searchEndTime = newVal[1]
tableStore.index()
}
},
{
deep: true
}

View File

@@ -22,7 +22,7 @@ import { ref, onMounted, provide, reactive, watch, nextTick } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue'
import { getTimeOfTheMonth } from '@/utils/formatTime'
import { getTime } from '@/utils/formatTime'
import OverLimitDetails from '@/components/cockpit/indicatorFittingChart/components/overLimitDetails.vue'
import { useRoute } from 'vue-router'
import { useTimeCacheStore } from '@/stores/timeCache'
@@ -33,7 +33,8 @@ const prop = defineProps({
width: { type: [String, Number] },
height: { type: [String, Number] },
timeKey: { type: [String, Number] },
timeValue: { type: Object }
timeValue: { type: Object },
interval: { type: Number }
})
const OverLimitDetailsRef = ref()
const headerHeight = ref(57)
@@ -103,8 +104,12 @@ const tableStore: any = new TableStore({
{ title: '主要存在的电能质量问题', field: 'problems', minWidth: '150', showOverflow: true }
],
beforeSearchFun: () => {
tableStore.table.params.searchBeginTime = tableStore.table.params.searchBeginTime || prop.timeValue?.[0]
tableStore.table.params.searchEndTime = tableStore.table.params.searchEndTime || prop.timeValue?.[1]
// tableStore.table.params.searchBeginTime = tableStore.table.params.searchBeginTime || prop.timeValue?.[0]
// tableStore.table.params.searchEndTime = tableStore.table.params.searchEndTime || prop.timeValue?.[1]
const time = getTime(prop.interval ?? 0, prop.timeKey, prop.timeValue)
tableStore.table.params.searchBeginTime = time[0]
tableStore.table.params.searchEndTime = time[1]
},
loadCallback: () => {
tableStore.table.height = `calc(${prop.height} - 80px)`