2025-10-20 13:25:30 +08:00
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<!--敏感负荷列表 -->
|
2025-11-07 11:28:24 +08:00
|
|
|
<TableHeader :showReset="false" @selectChange="selectChange" datePicker v-if="fullscreen"></TableHeader>
|
2025-11-25 09:30:49 +08:00
|
|
|
<Table ref="tableRef" @cell-click="cellClickEvent" :height="`calc(${prop.height} - ${headerHeight}px + ${fullscreen ? -58 : 56}px )`" isGroup></Table>
|
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-07 11:28:24 +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-14 09:51:18 +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-11-07 11:28:24 +08:00
|
|
|
const headerHeight = ref(57)
|
|
|
|
|
|
|
|
|
|
const route = useRoute()
|
|
|
|
|
const timeCacheStore = useTimeCacheStore()
|
|
|
|
|
|
|
|
|
|
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-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
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
2025-10-20 13:25:30 +08:00
|
|
|
const OverLimitDetailsRef = ref()
|
|
|
|
|
const tableStore: any = new TableStore({
|
2025-11-25 09:30:49 +08:00
|
|
|
url: '/cs-harmonic-boot/pqSensitiveUser/getList',
|
2025-10-20 13:25:30 +08:00
|
|
|
method: 'POST',
|
2025-11-25 09:30:49 +08:00
|
|
|
showPage: fullscreen.value ? true : false,
|
2025-10-20 13:25:30 +08:00
|
|
|
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-25 09:30:49 +08:00
|
|
|
field: 'loadType',
|
2025-10-20 13:25:30 +08:00
|
|
|
minWidth: '70'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '是否监测',
|
2025-11-25 09:30:49 +08:00
|
|
|
field: 'isMonitor',
|
2025-10-20 13:25:30 +08:00
|
|
|
minWidth: '80'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '是否治理',
|
2025-11-25 09:30:49 +08:00
|
|
|
field: 'isGovern',
|
2025-10-20 13:25:30 +08:00
|
|
|
minWidth: '80'
|
|
|
|
|
}
|
|
|
|
|
],
|
2025-11-14 14:09:34 +08:00
|
|
|
beforeSearchFun: () => {
|
|
|
|
|
tableStore.table.params.searchBeginTime = tableStore.table.params.searchBeginTime || prop.timeValue?.[0]
|
|
|
|
|
tableStore.table.params.searchEndTime = 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: () => {
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
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(() => {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
tableStore.index()
|
|
|
|
|
}, 500)
|
|
|
|
|
})
|
|
|
|
|
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-11-14 14:09:34 +08:00
|
|
|
// 当外部时间值变化时,更新表格的时间参数
|
|
|
|
|
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()
|
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
<style lang="scss" scoped></style>
|