2025-10-20 13:25:30 +08:00
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<!--主要监测点列表 -->
|
2025-11-05 14:45:56 +08:00
|
|
|
<TableHeader :showReset="false" datePicker @selectChange="selectChange" v-if="fullscreen">
|
2025-10-20 13:25:30 +08:00
|
|
|
<template v-slot:select>
|
|
|
|
|
<el-form-item label="关键词">
|
|
|
|
|
<el-input v-model="tableStore.table.params.searchValue" clearable placeholder="请输关键字" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</template>
|
|
|
|
|
</TableHeader>
|
2025-11-05 14:45:56 +08:00
|
|
|
<Table ref="tableRef" @cell-click="cellClickEvent" :height="`calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px )`"></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 TableHeader from '@/components/table/header/index.vue'
|
|
|
|
|
import { useDictData } from '@/stores/dictData'
|
|
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
|
|
import { getTimeOfTheMonth } from '@/utils/formatTime'
|
|
|
|
|
import { ElTag } from 'element-plus'
|
|
|
|
|
import OverLimitDetails from '@/components/cockpit/listOfMainMonitoringPoints/components/overLimitDetails.vue'
|
|
|
|
|
const prop = defineProps({
|
2025-11-05 14:45:56 +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 }
|
|
|
|
|
})
|
|
|
|
|
const dictData = useDictData()
|
|
|
|
|
const OverLimitDetailsRef = ref()
|
2025-11-05 14:45:56 +08:00
|
|
|
const headerHeight = ref(57)
|
|
|
|
|
const selectChange = (showSelect: any, height: any) => {
|
|
|
|
|
headerHeight.value = height
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 计算是否全屏展示
|
|
|
|
|
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 tableStore: any = new TableStore({
|
|
|
|
|
url: '/user-boot/role/selectRoleDetail?id=0',
|
|
|
|
|
method: 'POST',
|
|
|
|
|
|
|
|
|
|
showPage: false,
|
|
|
|
|
exportName: '主要监测点列表',
|
|
|
|
|
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',
|
|
|
|
|
|
|
|
|
|
render: 'customTemplate',
|
|
|
|
|
customTemplate: (row: any) => {
|
|
|
|
|
return `<span style='cursor: pointer;text-decoration: underline;'>${row.name}</span>`
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
title: '监测对象类型',
|
|
|
|
|
field: 'type',
|
|
|
|
|
minWidth: '90'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '是否治理',
|
|
|
|
|
field: 'whetherToGovern',
|
|
|
|
|
minWidth: '70'
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ title: '主要存在的电能质量问题', field: 'question', minWidth: '150' }
|
|
|
|
|
],
|
|
|
|
|
beforeSearchFun: () => {
|
|
|
|
|
tableStore.table.params.searchBeginTime = prop.timeValue?.[0] || getTimeOfTheMonth(prop.timeKey)[0]
|
|
|
|
|
tableStore.table.params.searchEndTime = prop.timeValue?.[1] || getTimeOfTheMonth(prop.timeKey)[1]
|
|
|
|
|
},
|
|
|
|
|
loadCallback: () => {
|
|
|
|
|
|
|
|
|
|
tableStore.table.data = [
|
|
|
|
|
{
|
|
|
|
|
name: '10kV1#电动机',
|
|
|
|
|
type: '电动机',
|
|
|
|
|
whetherToGovern: '否',
|
|
|
|
|
question: '3次谐波电压、5次谐波电流、电压不平衡度超标'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: '10kV2#(治理后)',
|
|
|
|
|
type: '电焊机',
|
|
|
|
|
whetherToGovern: '100A APF',
|
|
|
|
|
question: '所有指标均合格'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: '380V电焊机(治理前)',
|
|
|
|
|
type: '电焊机',
|
|
|
|
|
whetherToGovern: '100A APF',
|
|
|
|
|
question: '5次谐波电流、电压不平衡度超标'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: '380V水泵机',
|
|
|
|
|
type: '电动机',
|
|
|
|
|
whetherToGovern: '否',
|
|
|
|
|
question: '所有指标均合格'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
tableStore.table.height = `calc(${prop.height} - 80px)`
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const tableRef = ref()
|
|
|
|
|
provide('tableRef', tableRef)
|
|
|
|
|
tableStore.table.params.type = ''
|
|
|
|
|
tableStore.table.params.searchValue = ''
|
|
|
|
|
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>
|