2025-10-20 13:25:30 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<!--指标越限程度 -->
|
2025-12-04 19:47:31 +08:00
|
|
|
|
<TableHeader
|
|
|
|
|
|
ref="TableHeaderRef"
|
|
|
|
|
|
:showReset="false"
|
|
|
|
|
|
@selectChange="selectChange"
|
|
|
|
|
|
datePicker
|
|
|
|
|
|
v-if="fullscreen"
|
|
|
|
|
|
></TableHeader>
|
2025-10-20 13:25:30 +08:00
|
|
|
|
<my-echart
|
|
|
|
|
|
class="tall"
|
|
|
|
|
|
:options="echartList"
|
|
|
|
|
|
:style="{ width: prop.width, height: `calc(${prop.height} / 2 )` }"
|
|
|
|
|
|
/>
|
2025-11-13 14:11:26 +08:00
|
|
|
|
<Table
|
|
|
|
|
|
ref="tableRef"
|
|
|
|
|
|
@cell-click="cellClickEvent"
|
|
|
|
|
|
:height="`calc(${prop.height} / 2 - ${headerHeight}px + ${fullscreen ? 0 : 56}px )`"
|
|
|
|
|
|
isGroup
|
|
|
|
|
|
></Table>
|
2025-10-27 08:50:03 +08:00
|
|
|
|
<!-- 指标日趋势图 -->
|
2025-11-17 09:51:31 +08:00
|
|
|
|
<DailyTrendChart v-if="dialogTrendChart" ref="dailyTrendChartRef" @close="dialogTrendChart = false" />
|
2025-10-20 13:25:30 +08:00
|
|
|
|
</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'
|
2025-11-06 16:11:12 +08:00
|
|
|
|
import TableHeader from '@/components/table/header/index.vue'
|
2025-10-20 13:25:30 +08:00
|
|
|
|
import MyEchart from '@/components/echarts/MyEchart.vue'
|
|
|
|
|
|
import { getTimeOfTheMonth } from '@/utils/formatTime'
|
2025-10-27 08:50:03 +08:00
|
|
|
|
import DailyTrendChart from '@/components/cockpit/exceedanceLevel/components/dailyTrendChart.vue'
|
2025-12-04 19:47:31 +08:00
|
|
|
|
import { getTime } from '@/utils/formatTime'
|
2025-11-06 16:11:12 +08:00
|
|
|
|
|
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-12-04 19:47:31 +08:00
|
|
|
|
timeValue: { type: Object },
|
|
|
|
|
|
interval: { type: Number }
|
2025-10-20 13:25:30 +08:00
|
|
|
|
})
|
2025-11-06 16:11:12 +08:00
|
|
|
|
|
2025-12-04 19:47:31 +08:00
|
|
|
|
const TableHeaderRef = ref()
|
|
|
|
|
|
|
2025-11-06 16:11:12 +08:00
|
|
|
|
const headerHeight = ref(57)
|
|
|
|
|
|
|
2025-11-17 09:51:31 +08:00
|
|
|
|
const dialogTrendChart = ref(false)
|
2025-11-06 16:11:12 +08:00
|
|
|
|
|
|
|
|
|
|
const selectChange = (showSelect: any, height: any, datePickerValue?: any) => {
|
|
|
|
|
|
headerHeight.value = height
|
|
|
|
|
|
|
2025-11-14 14:09:34 +08:00
|
|
|
|
if (datePickerValue && datePickerValue.timeValue) {
|
|
|
|
|
|
// 更新时间参数
|
|
|
|
|
|
tableStore.table.params.searchBeginTime = datePickerValue.timeValue[0]
|
|
|
|
|
|
tableStore.table.params.searchEndTime = datePickerValue.timeValue[1]
|
2025-11-06 16:11:12 +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
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
2025-11-13 14:11:26 +08:00
|
|
|
|
const echartList = ref()
|
|
|
|
|
|
|
2025-10-27 08:50:03 +08:00
|
|
|
|
const dailyTrendChartRef = ref()
|
2025-10-20 13:25:30 +08:00
|
|
|
|
const tableStore: any = new TableStore({
|
2025-12-01 09:33:12 +08:00
|
|
|
|
url: '/cs-harmonic-boot/limitRateDetailD/limitExtentData',
|
2025-10-20 13:25:30 +08:00
|
|
|
|
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: '越限最大值',
|
2025-11-13 14:11:26 +08:00
|
|
|
|
field: 'maxValue',
|
2025-10-20 13:25:30 +08:00
|
|
|
|
minWidth: '60',
|
|
|
|
|
|
render: 'customTemplate',
|
|
|
|
|
|
customTemplate: (row: any) => {
|
2025-11-14 16:18:38 +08:00
|
|
|
|
const extentValue =
|
|
|
|
|
|
row.maxValue !== null && row.maxValue !== undefined && row.maxValue !== ''
|
|
|
|
|
|
? Math.floor(row.maxValue * 100) / 100
|
|
|
|
|
|
: '/'
|
|
|
|
|
|
return `<span style='cursor: pointer;text-decoration: underline;'>${extentValue}</span>`
|
2025-10-20 13:25:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: '国标限值',
|
2025-11-13 14:11:26 +08:00
|
|
|
|
field: 'internationalValue',
|
2025-10-20 13:25:30 +08:00
|
|
|
|
minWidth: '60'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: '越限程度(%)',
|
2025-11-13 14:11:26 +08:00
|
|
|
|
field: 'extent',
|
2025-11-14 16:18:38 +08:00
|
|
|
|
minWidth: '60',
|
|
|
|
|
|
render: 'customTemplate',
|
|
|
|
|
|
customTemplate: (row: any) => {
|
|
|
|
|
|
// 保留两个小数
|
|
|
|
|
|
const extentValue =
|
|
|
|
|
|
row.extent !== null && row.extent !== undefined && row.extent !== ''
|
|
|
|
|
|
? Math.floor(row.extent * 100) / 100
|
|
|
|
|
|
: '/'
|
|
|
|
|
|
return `<span>${extentValue}</span>`
|
|
|
|
|
|
}
|
2025-10-20 13:25:30 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2025-11-18 14:54:52 +08:00
|
|
|
|
title: '越限时间',
|
2025-11-13 14:11:26 +08:00
|
|
|
|
field: 'time',
|
2025-11-14 09:34:39 +08:00
|
|
|
|
minWidth: '60',
|
|
|
|
|
|
render: 'customTemplate',
|
|
|
|
|
|
customTemplate: (row: any) => {
|
2025-11-14 14:09:34 +08:00
|
|
|
|
if (row.time !== null && row.time !== undefined && row.time !== '') {
|
2025-11-14 09:34:39 +08:00
|
|
|
|
return `<span>${row.time}</span>`
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return `<span>/</span>`
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-10-20 13:25:30 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: '越限最高监测点',
|
2025-11-13 14:11:26 +08:00
|
|
|
|
field: 'lineName',
|
2025-11-14 09:34:39 +08:00
|
|
|
|
minWidth: '90',
|
|
|
|
|
|
render: 'customTemplate',
|
|
|
|
|
|
customTemplate: (row: any) => {
|
|
|
|
|
|
if (row.lineName !== null && row.lineName !== undefined && row.lineName !== '') {
|
|
|
|
|
|
return `<span>${row.lineName}</span>`
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return `<span>/</span>`
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-10-20 13:25:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
],
|
2025-11-13 14:11:26 +08:00
|
|
|
|
beforeSearchFun: () => {
|
2025-12-04 19:47:31 +08:00
|
|
|
|
setTime()
|
2025-10-20 13:25:30 +08:00
|
|
|
|
},
|
|
|
|
|
|
loadCallback: () => {
|
2025-11-13 14:11:26 +08:00
|
|
|
|
// 定义 x 轴标签顺序
|
|
|
|
|
|
const xAxisLabels = ['闪变', '谐波电压', '谐波电流', '电压偏差', '三相不平衡']
|
|
|
|
|
|
|
2025-11-14 09:34:39 +08:00
|
|
|
|
// 根据指标名称顺序提取对应的 extent 数据
|
2025-11-13 14:11:26 +08:00
|
|
|
|
const chartData = xAxisLabels.map(label => {
|
|
|
|
|
|
// 在表格数据中查找对应指标名称的数据项
|
|
|
|
|
|
const item = tableStore.table.data.find((row: any) => row.name === label)
|
2025-11-14 16:18:38 +08:00
|
|
|
|
// 如果找到对应项,则返回 extent 值,否则返回 0,并保留两位小数
|
|
|
|
|
|
const extentValue = item ? item.extent || 0 : 0
|
|
|
|
|
|
return Math.round(extentValue * 100) / 100
|
2025-11-13 14:11:26 +08:00
|
|
|
|
})
|
|
|
|
|
|
echartList.value = {
|
|
|
|
|
|
title: {
|
|
|
|
|
|
text: '指标越限严重度'
|
2025-10-20 13:25:30 +08:00
|
|
|
|
},
|
2025-11-13 14:11:26 +08:00
|
|
|
|
|
|
|
|
|
|
xAxis: {
|
|
|
|
|
|
data: xAxisLabels
|
2025-10-20 13:25:30 +08:00
|
|
|
|
},
|
2025-11-13 14:11:26 +08:00
|
|
|
|
|
|
|
|
|
|
yAxis: {
|
2025-11-14 09:34:39 +08:00
|
|
|
|
name: '%' // 给X轴加单位
|
|
|
|
|
|
// interval: 20
|
2025-10-20 13:25:30 +08:00
|
|
|
|
},
|
2025-11-13 14:11:26 +08:00
|
|
|
|
grid: {
|
|
|
|
|
|
left: '10px',
|
|
|
|
|
|
right: '20px'
|
2025-10-20 13:25:30 +08:00
|
|
|
|
},
|
2025-11-13 14:11:26 +08:00
|
|
|
|
options: {
|
|
|
|
|
|
series: [
|
|
|
|
|
|
{
|
|
|
|
|
|
type: 'bar',
|
|
|
|
|
|
name: '越限占比',
|
|
|
|
|
|
data: chartData,
|
|
|
|
|
|
barMaxWidth: 30
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
2025-10-20 13:25:30 +08:00
|
|
|
|
}
|
2025-11-13 14:11:26 +08:00
|
|
|
|
}
|
2025-10-20 13:25:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const tableRef = ref()
|
|
|
|
|
|
provide('tableRef', tableRef)
|
|
|
|
|
|
|
|
|
|
|
|
provide('tableStore', tableStore)
|
|
|
|
|
|
|
|
|
|
|
|
// 点击行
|
|
|
|
|
|
const cellClickEvent = ({ row, column }: any) => {
|
2025-11-17 09:51:31 +08:00
|
|
|
|
dialogTrendChart.value = true
|
2025-11-14 09:34:39 +08:00
|
|
|
|
if (column.field == 'maxValue' && row.lineId) {
|
2025-11-17 09:51:31 +08:00
|
|
|
|
nextTick(() => {
|
|
|
|
|
|
dailyTrendChartRef.value.open(row)
|
|
|
|
|
|
})
|
2025-10-20 13:25:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-12-04 19:47:31 +08:00
|
|
|
|
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 不是一个有效数组')
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-20 13:25:30 +08:00
|
|
|
|
onMounted(() => {
|
|
|
|
|
|
tableStore.index()
|
|
|
|
|
|
})
|
|
|
|
|
|
watch(
|
|
|
|
|
|
() => prop.timeKey,
|
|
|
|
|
|
val => {
|
|
|
|
|
|
tableStore.index()
|
|
|
|
|
|
}
|
|
|
|
|
|
)
|
|
|
|
|
|
watch(
|
2025-11-14 14:09:34 +08:00
|
|
|
|
() => prop.timeValue,
|
2025-10-20 13:25:30 +08:00
|
|
|
|
(newVal, oldVal) => {
|
2025-12-04 19:47:31 +08:00
|
|
|
|
tableStore.index()
|
2025-10-20 13:25:30 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2025-11-14 14:09:34 +08:00
|
|
|
|
deep: true
|
2025-10-20 13:25:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
const addMenu = () => {}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped></style>
|