2025-10-20 13:25:30 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<!--暂态事件明细 -->
|
2025-11-25 13:44:26 +08:00
|
|
|
|
<TableHeader
|
|
|
|
|
|
:showReset="false"
|
|
|
|
|
|
ref="TableHeaderRef"
|
|
|
|
|
|
@selectChange="selectChange"
|
|
|
|
|
|
datePicker
|
|
|
|
|
|
v-if="fullscreen"
|
2025-11-26 09:31:32 +08:00
|
|
|
|
:timeCacheFlag="false"
|
2025-11-25 13:44:26 +08:00
|
|
|
|
></TableHeader>
|
2025-11-14 14:09:34 +08:00
|
|
|
|
<el-calendar
|
|
|
|
|
|
v-model="value"
|
|
|
|
|
|
:style="{
|
|
|
|
|
|
height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px )`,
|
|
|
|
|
|
overflow: 'auto'
|
|
|
|
|
|
}"
|
2025-11-26 09:31:32 +08:00
|
|
|
|
v-loading="tableStore.table.loading"
|
2025-11-14 14:09:34 +08:00
|
|
|
|
>
|
2025-10-20 13:25:30 +08:00
|
|
|
|
<template #date-cell="{ data }">
|
2025-11-26 09:31:32 +08:00
|
|
|
|
<div
|
|
|
|
|
|
style="padding: 8px"
|
|
|
|
|
|
:style="{
|
|
|
|
|
|
background: setBackground(data.day),
|
|
|
|
|
|
height: `calc((${prop.height} - 100px - ${headerHeight}px + ${fullscreen ? 0 : 56}px) / 5 )`
|
|
|
|
|
|
}"
|
|
|
|
|
|
>
|
2025-10-20 13:25:30 +08:00
|
|
|
|
<p :class="data.isSelected ? 'is-selected' : ''">
|
|
|
|
|
|
{{ data.day.split('-').slice(2).join('-') }}
|
|
|
|
|
|
</p>
|
2025-11-25 13:44:26 +08:00
|
|
|
|
<el-tooltip effect="dark" placement="top" :hide-after="0" v-if="hasEventData(data.day)">
|
2025-10-20 13:25:30 +08:00
|
|
|
|
<template #content>
|
|
|
|
|
|
<!-- <span v-html="list?.filter(item => item.time == data.day)[0]?.type || ''"></span> -->
|
2025-11-25 11:38:34 +08:00
|
|
|
|
<div v-for="item in list?.filter((item:any) => item.name == data.day)">
|
|
|
|
|
|
<div>电压暂降:{{ item.eventDown || 0 }}</div>
|
|
|
|
|
|
<div>电压中断:{{ item.eventOff || 0 }}</div>
|
|
|
|
|
|
<div>电压暂升:{{ item.eventUp || 0 }}</div>
|
2025-10-20 13:25:30 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<div
|
2025-10-28 11:23:17 +08:00
|
|
|
|
style="text-decoration: underline"
|
2025-11-26 09:31:32 +08:00
|
|
|
|
class="details"
|
2025-11-25 11:38:34 +08:00
|
|
|
|
v-for="item in list?.filter((item:any) => item.name == data.day)"
|
2025-10-20 13:25:30 +08:00
|
|
|
|
>
|
2025-11-25 11:38:34 +08:00
|
|
|
|
<div @click="descentClick">电压暂降:{{ item.eventDown || 0 }}</div>
|
|
|
|
|
|
<div>电压中断:{{ item.eventOff || 0 }}</div>
|
|
|
|
|
|
<div>电压暂升:{{ item.eventUp || 0 }}</div>
|
2025-10-20 13:25:30 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</el-tooltip>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-calendar>
|
2025-10-28 11:23:17 +08:00
|
|
|
|
<!-- 暂态事件列表 -->
|
2025-11-14 14:09:34 +08:00
|
|
|
|
<TransientList ref="transientListRef" />
|
2025-10-20 13:25:30 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
2025-11-25 13:44:26 +08:00
|
|
|
|
import { ref, onMounted, provide, reactive, watch, nextTick } from 'vue'
|
2025-10-20 13:25:30 +08:00
|
|
|
|
import TableStore from '@/utils/tableStore'
|
|
|
|
|
|
import { dayjs } from 'element-plus'
|
2025-10-28 11:23:17 +08:00
|
|
|
|
import TransientList from './components/transientList.vue'
|
2025-11-07 11:28:24 +08:00
|
|
|
|
import TableHeader from '@/components/table/header/index.vue'
|
2025-10-20 13:25:30 +08:00
|
|
|
|
|
|
|
|
|
|
const prop = defineProps({
|
2025-11-14 14:09:34 +08:00
|
|
|
|
w: { type: [String, Number] },
|
|
|
|
|
|
h: { type: [String, Number] },
|
|
|
|
|
|
width: { type: [String, Number] },
|
|
|
|
|
|
height: { type: [String, Number] },
|
|
|
|
|
|
timeKey: { type: [String, Number] },
|
2025-10-20 13:25:30 +08:00
|
|
|
|
timeValue: { type: Object }
|
|
|
|
|
|
})
|
2025-10-28 11:23:17 +08:00
|
|
|
|
|
2025-11-07 11:28:24 +08:00
|
|
|
|
const headerHeight = ref(57)
|
|
|
|
|
|
|
2025-11-25 13:44:26 +08:00
|
|
|
|
const TableHeaderRef = ref()
|
|
|
|
|
|
|
2025-11-25 11:38:34 +08:00
|
|
|
|
const hasEventData = (day: string) => {
|
2025-11-25 13:44:26 +08:00
|
|
|
|
const item = list.value?.find((item: any) => item.name == day)
|
|
|
|
|
|
if (!item) return false
|
|
|
|
|
|
|
|
|
|
|
|
return (item.eventDown || item.eventOff || item.eventUp) > 0
|
2025-11-25 11:38:34 +08:00
|
|
|
|
}
|
2025-11-07 11:28:24 +08:00
|
|
|
|
|
|
|
|
|
|
const selectChange = (showSelect: any, height: any, datePickerValue?: any) => {
|
|
|
|
|
|
headerHeight.value = height
|
|
|
|
|
|
|
2025-11-26 09:31:32 +08:00
|
|
|
|
if (datePickerValue && datePickerValue.timeValue) {
|
|
|
|
|
|
// 更新时间参数
|
|
|
|
|
|
tableStore.table.params.searchBeginTime = datePickerValue.timeValue[0]
|
|
|
|
|
|
tableStore.table.params.searchEndTime = datePickerValue.timeValue[1]
|
|
|
|
|
|
}
|
2025-11-07 11:28:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 计算是否全屏展示
|
|
|
|
|
|
const fullscreen = computed(() => {
|
|
|
|
|
|
const w = Number(prop.w)
|
|
|
|
|
|
const h = Number(prop.h)
|
|
|
|
|
|
if (!isNaN(w) && !isNaN(h) && w === 12 && h === 6) {
|
|
|
|
|
|
// 执行相应逻辑
|
|
|
|
|
|
return true
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return false
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
dayjs.en.weekStart = 1 //设置日历的周起始日为星期一
|
|
|
|
|
|
const value = ref(new Date())
|
|
|
|
|
|
|
2025-10-28 11:23:17 +08:00
|
|
|
|
const transientListRef = ref()
|
2025-11-25 11:38:34 +08:00
|
|
|
|
const list = ref()
|
2025-11-25 13:44:26 +08:00
|
|
|
|
|
2025-10-20 13:25:30 +08:00
|
|
|
|
const tableStore: any = new TableStore({
|
2025-11-25 11:38:34 +08:00
|
|
|
|
url: '/cs-harmonic-boot/csevent/getEventDate',
|
2025-10-20 13:25:30 +08:00
|
|
|
|
method: 'POST',
|
|
|
|
|
|
|
|
|
|
|
|
showPage: false,
|
|
|
|
|
|
|
|
|
|
|
|
column: [],
|
2025-11-07 11:28:24 +08:00
|
|
|
|
|
2025-11-14 14:09:34 +08:00
|
|
|
|
beforeSearchFun: () => {
|
2025-11-26 09:31:32 +08:00
|
|
|
|
if (!fullscreen.value && prop.timeValue && Array.isArray(prop.timeValue)) {
|
2025-11-25 14:22:30 +08:00
|
|
|
|
tableStore.table.params.searchBeginTime = prop.timeValue[0]
|
|
|
|
|
|
tableStore.table.params.searchEndTime = prop.timeValue[1]
|
|
|
|
|
|
}
|
2025-10-20 13:25:30 +08:00
|
|
|
|
},
|
2025-11-14 14:09:34 +08:00
|
|
|
|
|
2025-10-20 13:25:30 +08:00
|
|
|
|
loadCallback: () => {
|
2025-11-26 09:31:32 +08:00
|
|
|
|
value.value = tableStore.table.params.searchBeginTime
|
2025-11-25 11:38:34 +08:00
|
|
|
|
list.value = tableStore.table.data
|
2025-10-20 13:25:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const setBackground = (value: string) => {
|
|
|
|
|
|
let data = []
|
2025-11-25 11:38:34 +08:00
|
|
|
|
data = list.value?.filter((item: any) => item.name == value)
|
2025-10-20 13:25:30 +08:00
|
|
|
|
|
|
|
|
|
|
if (data && data?.length > 0) {
|
2025-11-25 11:38:34 +08:00
|
|
|
|
if (data[0].eventDown > 0 || data[0].eventOff > 0 || data[0].eventUp > 0) {
|
2025-10-20 13:25:30 +08:00
|
|
|
|
return '#Ff660090'
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return '#fff'
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
provide('tableStore', tableStore)
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
2025-11-25 14:22:30 +08:00
|
|
|
|
nextTick(() => {
|
|
|
|
|
|
if (TableHeaderRef.value && typeof TableHeaderRef.value.setDatePicker === 'function') {
|
|
|
|
|
|
TableHeaderRef.value.setDatePicker([{ label: '月份', value: 3 }])
|
|
|
|
|
|
}
|
|
|
|
|
|
if (fullscreen.value) {
|
|
|
|
|
|
TableHeaderRef.value.setInterval(3)
|
|
|
|
|
|
}
|
|
|
|
|
|
tableStore.index()
|
|
|
|
|
|
})
|
2025-10-20 13:25:30 +08:00
|
|
|
|
})
|
|
|
|
|
|
watch(
|
|
|
|
|
|
() => prop.timeKey,
|
|
|
|
|
|
val => {
|
|
|
|
|
|
tableStore.index()
|
|
|
|
|
|
}
|
|
|
|
|
|
)
|
2025-11-25 14:22:30 +08:00
|
|
|
|
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()
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
deep: true
|
|
|
|
|
|
}
|
|
|
|
|
|
)
|
2025-10-20 13:25:30 +08:00
|
|
|
|
|
2025-10-28 11:23:17 +08:00
|
|
|
|
// 电压暂降点击事件
|
|
|
|
|
|
const descentClick = () => {
|
|
|
|
|
|
transientListRef.value.open()
|
|
|
|
|
|
}
|
2025-10-20 13:25:30 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
:deep(.el-calendar) {
|
2025-11-26 09:31:32 +08:00
|
|
|
|
.el-calendar__button-group {
|
2025-10-20 13:25:30 +08:00
|
|
|
|
display: none;
|
|
|
|
|
|
}
|
|
|
|
|
|
.el-calendar__body {
|
|
|
|
|
|
padding: 0px !important;
|
2025-11-26 09:31:32 +08:00
|
|
|
|
height: calc(100% - 46px);
|
2025-10-20 13:25:30 +08:00
|
|
|
|
.el-calendar-table {
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
.el-calendar-day {
|
2025-11-26 09:31:32 +08:00
|
|
|
|
// height: calc(912px / 5 );
|
2025-10-20 13:25:30 +08:00
|
|
|
|
height: 100%;
|
|
|
|
|
|
padding: 0px;
|
|
|
|
|
|
overflow: hidden;
|
2025-11-26 09:31:32 +08:00
|
|
|
|
.details {
|
|
|
|
|
|
height: calc(100% - 20px);
|
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
|
}
|
2025-10-20 13:25:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
.el-calendar-table__row {
|
|
|
|
|
|
.next {
|
|
|
|
|
|
pointer-events: none;
|
|
|
|
|
|
}
|
|
|
|
|
|
.prev {
|
|
|
|
|
|
pointer-events: none;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
.el-calendar-table .el-calendar-day:hover {
|
|
|
|
|
|
background-color: #ffffff00;
|
|
|
|
|
|
}
|
|
|
|
|
|
.el-calendar-table td.is-selected {
|
|
|
|
|
|
background-color: #ffffff00;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// /*calendar_class 是el-calendar所在父标签的css*/
|
|
|
|
|
|
// .calendar_class >>> .el-calendar-table:not(.is-range) td.next {
|
|
|
|
|
|
// pointer-events: none;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// .calendar_class >>> .el-calendar-table:not(.is-range) td.prev {
|
|
|
|
|
|
// pointer-events: none;
|
|
|
|
|
|
// }
|
|
|
|
|
|
</style>
|