2025-10-20 13:25:30 +08:00
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<!--电网侧指标越限统计 -->
|
2025-11-07 10:32:55 +08:00
|
|
|
<TableHeader :showReset="false" @selectChange="selectChange" datePicker v-if="fullscreen"></TableHeader>
|
2025-10-20 13:25:30 +08:00
|
|
|
<my-echart
|
|
|
|
|
class="tall"
|
|
|
|
|
:options="echartList"
|
2025-11-07 10:32:55 +08:00
|
|
|
:style="{
|
|
|
|
|
width: prop.width,
|
|
|
|
|
height: `calc(${prop.height} / 2 - ${headerHeight / 2}px + ${fullscreen ? 0 : 28}px )`
|
|
|
|
|
}"
|
2025-10-20 13:25:30 +08:00
|
|
|
/>
|
2025-11-07 10:32:55 +08:00
|
|
|
<Table
|
|
|
|
|
ref="tableRef"
|
|
|
|
|
@cell-click="cellClickEvent"
|
|
|
|
|
:height="`calc(${prop.height} / 2 - ${headerHeight / 2}px + ${fullscreen ? 0 : 28}px )`"
|
|
|
|
|
isGroup
|
|
|
|
|
></Table>
|
2025-10-20 13:25:30 +08:00
|
|
|
<!-- 指标越限详情 -->
|
|
|
|
|
<OverLimitDetails ref="OverLimitDetailsRef" />
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { ref, onMounted, provide, reactive, watch, h } from 'vue'
|
|
|
|
|
import TableStore from '@/utils/tableStore'
|
|
|
|
|
import Table from '@/components/table/index.vue'
|
|
|
|
|
import MyEchart from '@/components/echarts/MyEchart.vue'
|
|
|
|
|
import { getTimeOfTheMonth } from '@/utils/formatTime'
|
|
|
|
|
import OverLimitDetails from '@/components/cockpit/listOfMainMonitoringPoints/components/overLimitDetails.vue'
|
2025-11-07 10:32:55 +08:00
|
|
|
import TableHeader from '@/components/table/header/index.vue'
|
|
|
|
|
import { useRoute } from 'vue-router'
|
|
|
|
|
import { useTimeCacheStore } from '@/stores/timeCache'
|
|
|
|
|
|
2025-10-20 13:25:30 +08:00
|
|
|
const prop = defineProps({
|
2025-11-07 10:32:55 +08:00
|
|
|
w: { type: String },
|
|
|
|
|
h: { type: String },
|
2025-10-20 13:25:30 +08:00
|
|
|
width: { type: String },
|
|
|
|
|
height: { type: String },
|
|
|
|
|
timeKey: { type: String },
|
|
|
|
|
timeValue: { type: Object }
|
|
|
|
|
})
|
2025-11-07 10:32:55 +08:00
|
|
|
|
|
|
|
|
const headerHeight = ref(57)
|
|
|
|
|
|
|
|
|
|
const route = useRoute()
|
|
|
|
|
const timeCacheStore = useTimeCacheStore()
|
|
|
|
|
|
|
|
|
|
const selectChange = (showSelect: any, height: any, datePickerValue?: any) => {
|
|
|
|
|
headerHeight.value = height
|
|
|
|
|
|
|
|
|
|
// 如果有传入 datePicker 的值
|
|
|
|
|
if (datePickerValue) {
|
|
|
|
|
// 更新表格参数
|
|
|
|
|
tableStore.table.params.searchBeginTime = datePickerValue.timeValue?.[0]
|
|
|
|
|
tableStore.table.params.searchEndTime = datePickerValue.timeValue?.[1]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 计算是否全屏展示
|
|
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
})
|
2025-10-20 13:25:30 +08:00
|
|
|
const echartList = ref({
|
|
|
|
|
title: {
|
|
|
|
|
text: '指标越限占比'
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
xAxis: {
|
|
|
|
|
// name: '(区域)',
|
|
|
|
|
data: ['闪变', '谐波电压', '谐波电流', '电压偏差', '三相不平衡']
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
yAxis: {
|
|
|
|
|
name: '%', // 给X轴加单位
|
|
|
|
|
interval: 20
|
|
|
|
|
},
|
|
|
|
|
grid: {
|
|
|
|
|
left: '10px',
|
|
|
|
|
right: '20px'
|
|
|
|
|
},
|
|
|
|
|
options: {
|
|
|
|
|
series: [
|
|
|
|
|
{
|
|
|
|
|
// name: '暂降次数',
|
|
|
|
|
type: 'bar',
|
|
|
|
|
name: '越限占比',
|
|
|
|
|
data: [0, 45, 22, 0, 70],
|
2025-11-07 10:32:55 +08:00
|
|
|
barMaxWidth: 30
|
2025-10-20 13:25:30 +08:00
|
|
|
|
|
|
|
|
// label: {
|
|
|
|
|
// show: true,
|
|
|
|
|
// position: 'top',
|
|
|
|
|
// textStyle: {
|
|
|
|
|
// //数值样式
|
|
|
|
|
// color: '#000'
|
|
|
|
|
// },
|
|
|
|
|
// fontSize: 12
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
const OverLimitDetailsRef = ref()
|
|
|
|
|
const tableStore: any = new TableStore({
|
|
|
|
|
url: '/user-boot/dept/deptTree',
|
|
|
|
|
method: 'POST',
|
|
|
|
|
|
|
|
|
|
showPage: false,
|
|
|
|
|
|
|
|
|
|
column: [
|
|
|
|
|
{
|
|
|
|
|
field: 'index',
|
|
|
|
|
title: '序号',
|
2025-10-21 16:11:00 +08:00
|
|
|
width: '80',
|
2025-10-20 13:25:30 +08:00
|
|
|
formatter: (row: any) => {
|
|
|
|
|
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '名称',
|
|
|
|
|
field: 'name',
|
|
|
|
|
minWidth: '90'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '越限占比(%)',
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
title: '闪变',
|
|
|
|
|
field: 'type',
|
|
|
|
|
minWidth: '70',
|
|
|
|
|
render: 'customTemplate',
|
|
|
|
|
customTemplate: (row: any) => {
|
|
|
|
|
return `<span style='cursor: pointer;text-decoration: underline;'>${row.type}</span>`
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '谐波电压',
|
|
|
|
|
field: 'type1',
|
|
|
|
|
minWidth: '80',
|
|
|
|
|
render: 'customTemplate',
|
|
|
|
|
customTemplate: (row: any) => {
|
|
|
|
|
return `<span style='cursor: pointer;text-decoration: underline;'>${row.type1}</span>`
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '谐波电流',
|
|
|
|
|
field: 'type2',
|
|
|
|
|
minWidth: '80',
|
|
|
|
|
render: 'customTemplate',
|
|
|
|
|
customTemplate: (row: any) => {
|
|
|
|
|
return `<span style='cursor: pointer;text-decoration: underline;'>${row.type2}</span>`
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '电压偏差',
|
|
|
|
|
field: 'type3',
|
|
|
|
|
minWidth: '80',
|
|
|
|
|
render: 'customTemplate',
|
|
|
|
|
customTemplate: (row: any) => {
|
|
|
|
|
return `<span style='cursor: pointer;text-decoration: underline;'>${row.type3}</span>`
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '三相不平衡',
|
|
|
|
|
field: 'type4',
|
|
|
|
|
minWidth: '90',
|
|
|
|
|
render: 'customTemplate',
|
|
|
|
|
customTemplate: (row: any) => {
|
|
|
|
|
return `<span style='cursor: pointer;text-decoration: underline;'>${row.type4}</span>`
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
beforeSearchFun: () => {
|
2025-11-07 10:32:55 +08:00
|
|
|
// 尝试从缓存获取时间值
|
|
|
|
|
let beginTime, endTime
|
|
|
|
|
|
|
|
|
|
if (fullscreen.value) {
|
|
|
|
|
const cached = timeCacheStore.getCache(route.path)
|
|
|
|
|
if (cached && cached.timeValue) {
|
|
|
|
|
beginTime = cached.timeValue[0]
|
|
|
|
|
endTime = cached.timeValue[1]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 如果缓存中没有则使用默认值
|
|
|
|
|
tableStore.table.params.searchBeginTime = beginTime || prop.timeValue?.[0] || getTimeOfTheMonth(prop.timeKey)[0]
|
|
|
|
|
|
|
|
|
|
tableStore.table.params.searchEndTime = endTime || prop.timeValue?.[1] || getTimeOfTheMonth(prop.timeKey)[1]
|
2025-10-20 13:25:30 +08:00
|
|
|
},
|
|
|
|
|
loadCallback: () => {
|
|
|
|
|
tableStore.table.data = [
|
|
|
|
|
{
|
|
|
|
|
name: '1#变压器电网侧',
|
|
|
|
|
type: '0',
|
|
|
|
|
type1: '45',
|
|
|
|
|
type2: '22',
|
|
|
|
|
type3: '0',
|
|
|
|
|
type4: '70'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
tableStore.table.height = `calc(${prop.height} - 80px)`
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const tableRef = ref()
|
|
|
|
|
provide('tableRef', tableRef)
|
|
|
|
|
|
|
|
|
|
provide('tableStore', tableStore)
|
|
|
|
|
|
|
|
|
|
// 点击行
|
|
|
|
|
const cellClickEvent = ({ row, column }: any) => {
|
|
|
|
|
if (column.field != 'name') {
|
|
|
|
|
console.log(row)
|
|
|
|
|
OverLimitDetailsRef.value.open(row)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
tableStore.index()
|
|
|
|
|
})
|
|
|
|
|
watch(
|
|
|
|
|
() => prop.timeKey,
|
|
|
|
|
val => {
|
|
|
|
|
tableStore.index()
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
watch(
|
|
|
|
|
() => prop.timeValue, // 监听的目标(函数形式避免直接传递 props 导致的警告)
|
|
|
|
|
(newVal, oldVal) => {
|
|
|
|
|
tableStore.index()
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
deep: true // 若 timeValue 是对象/数组,需开启深度监听
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const addMenu = () => {}
|
|
|
|
|
</script>
|
|
|
|
|
<style lang="scss" scoped></style>
|