暂态电能质量分析时间修改
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
@selectChange="selectChange"
|
||||
datePicker
|
||||
v-if="fullscreen"
|
||||
:timeCacheFlag="false"
|
||||
:timeKeyList="['3']"
|
||||
></TableHeader>
|
||||
<el-calendar
|
||||
v-model="value"
|
||||
@@ -61,6 +61,7 @@ import TableStore from '@/utils/tableStore'
|
||||
import { dayjs } from 'element-plus'
|
||||
import TransientList from './components/transientList.vue'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import { getTime } from '@/utils/formatTime'
|
||||
|
||||
const prop = defineProps({
|
||||
w: { type: [String, Number] },
|
||||
@@ -69,7 +70,7 @@ const prop = defineProps({
|
||||
height: { type: [String, Number] },
|
||||
timeKey: { type: [String, Number] },
|
||||
timeValue: { type: Object },
|
||||
interval: { type: [String, Number] }
|
||||
interval: { type: Number }
|
||||
})
|
||||
|
||||
const headerHeight = ref(57)
|
||||
@@ -120,15 +121,7 @@ const tableStore: any = new TableStore({
|
||||
column: [],
|
||||
|
||||
beforeSearchFun: () => {
|
||||
if (!fullscreen.value) {
|
||||
if (prop.interval == 3 && prop.timeValue && Array.isArray(prop.timeValue)) {
|
||||
tableStore.table.params.searchBeginTime = prop.timeValue[0]
|
||||
tableStore.table.params.searchEndTime = prop.timeValue[1]
|
||||
} else {
|
||||
tableStore.table.params.searchBeginTime = '2025-12-1'
|
||||
tableStore.table.params.searchEndTime = '2025-12-31'
|
||||
}
|
||||
}
|
||||
setTime()
|
||||
},
|
||||
|
||||
loadCallback: () => {
|
||||
@@ -154,50 +147,34 @@ provide('tableStore', tableStore)
|
||||
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
if (TableHeaderRef.value && typeof TableHeaderRef.value.setDatePicker === 'function') {
|
||||
TableHeaderRef.value.setDatePicker([{ label: '月份', value: 3 }])
|
||||
}
|
||||
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)
|
||||
}
|
||||
}
|
||||
tableStore.index()
|
||||
})
|
||||
})
|
||||
watch(
|
||||
() => prop.timeKey,
|
||||
val => {
|
||||
// tableStore.index()
|
||||
}
|
||||
)
|
||||
|
||||
watch(
|
||||
() => prop.interval,
|
||||
val => {
|
||||
if (val == 3) {
|
||||
tableStore.index()
|
||||
}
|
||||
const setTime = () => {
|
||||
const time = getTime(
|
||||
(TableHeaderRef.value?.datePickerRef.interval || prop.interval) ?? 0,
|
||||
prop.timeKey,
|
||||
fullscreen.value
|
||||
? [tableStore.table.params.searchBeginTime, tableStore.table.params.searchEndTime]
|
||||
: prop.timeValue
|
||||
)
|
||||
|
||||
if (Array.isArray(time)) {
|
||||
tableStore.table.params.searchBeginTime = time[0]
|
||||
tableStore.table.params.searchEndTime = time[1]
|
||||
TableHeaderRef.value?.setInterval(time[2] - 0)
|
||||
TableHeaderRef.value?.setTimeInterval([time[0], time[1]])
|
||||
} else {
|
||||
console.warn('获取时间失败,time 不是一个有效数组')
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
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 => {
|
||||
(newVal, oldVal) => {
|
||||
tableStore.index()
|
||||
},
|
||||
|
||||
{
|
||||
deep: true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user