Files
admin-govern/src/views/govern/device/control/tabs/event.vue

308 lines
12 KiB
Vue
Raw Normal View History

2024-07-03 19:31:43 +08:00
<template>
2024-09-27 10:27:33 +08:00
<div class="view">
2026-01-15 15:59:13 +08:00
<div v-show="!isWaveCharts">
2026-06-09 19:51:31 +08:00
<TableHeader datePicker showExport ref="headerRef" @onResetForm="onResetForm">
<template v-slot:operation>
<el-button type="primary" icon="el-icon-Operation" @click="openFilterDialog">事件筛选</el-button>
</template>
</TableHeader>
2026-01-15 15:59:13 +08:00
<Table ref="tableRef" />
2026-06-09 19:51:31 +08:00
<MultiCondition v-model:visible="filterVisible" :params="tableStore.table.params" ref="multiConditionRef"
@confirm="onFilterConfirm" />
2026-01-15 15:59:13 +08:00
</div>
2026-06-04 19:06:36 +08:00
<waveFormAnalysis v-loading="loading" v-if="isWaveCharts" ref="waveFormAnalysisRef"
@handleHideCharts="isWaveCharts = false" :wp="wp" />
2024-07-03 19:31:43 +08:00
</div>
</template>
<script lang="ts" setup>
2026-06-09 19:51:31 +08:00
import { ref, onMounted, provide, nextTick, } from 'vue'
2024-07-23 17:28:31 +08:00
import { getTabsDataByType } from '@/api/cs-device-boot/EquipmentDelivery'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
2026-06-09 19:51:31 +08:00
import MultiCondition from '@/views/govern/alarm/multiCondition.vue'
2024-09-25 16:31:45 +08:00
import TableHeader from '@/components/table/header/index.vue'
2024-07-23 17:28:31 +08:00
import waveFormAnalysis from './components/waveFormAnalysis.vue'
2025-10-24 11:17:18 +08:00
import { ArrowLeft, Message } from '@element-plus/icons-vue'
2024-10-30 14:24:15 +08:00
import { ElMessage } from 'element-plus'
2026-01-04 14:55:31 +08:00
import { analyseWave, getFileByEventId } from '@/api/common'
2025-01-03 12:45:54 +08:00
import { getFileZip } from '@/api/cs-harmonic-boot/datatrend'
2026-06-08 18:34:49 +08:00
import { useDictData } from '@/stores/dictData'
2026-06-09 19:51:31 +08:00
const emit=defineEmits(['fileRecall'])
2024-07-23 17:28:31 +08:00
const tableParams: any = ref({})
2024-07-31 10:42:04 +08:00
const refheader = ref()
const view = ref(true)
const view2 = ref(false)
2024-12-19 10:16:08 +08:00
const loading = ref(false)
2024-07-31 10:42:04 +08:00
const showBoxi = ref(true)
const bxactiveName = ref('ssbx')
2024-09-25 16:31:45 +08:00
const boxoList: any = ref([])
2024-07-31 10:42:04 +08:00
const wp = ref({})
const value = ref(1)
2024-08-01 10:55:08 +08:00
const waveFormAnalysisRef = ref()
2026-06-09 19:51:31 +08:00
const multiConditionRef = ref()
2025-10-21 16:27:49 +08:00
const props = defineProps({
2026-01-04 14:55:31 +08:00
deviceType: {
type: String,
default: '0'
}
})
2026-06-08 18:34:49 +08:00
const dictData = useDictData()
const ReasonList: any = dictData.getBasicData('Event_Reason')
const EventTypeList: any = dictData.getBasicData('Event_Type')
2024-07-23 17:28:31 +08:00
const tableStore: any = new TableStore({
url: '/cs-device-boot/csGroup/deviceDataByType',
2024-10-16 20:31:54 +08:00
publicHeight: 215,
2024-07-23 17:28:31 +08:00
method: 'POST',
2026-06-09 19:51:31 +08:00
exportName: '暂态事件',
2024-07-23 17:28:31 +08:00
column: [
// { width: '60', type: 'checkbox', fixed: 'left' },
2024-12-19 10:16:08 +08:00
{
2026-01-04 14:55:31 +08:00
title: '序号',
width: 80,
formatter: (row: any) => {
2024-12-19 10:16:08 +08:00
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
}
},
2026-06-08 18:34:49 +08:00
{ field: 'startTime', title: '发生时刻', minWidth: 180, sortable: true },
2026-06-04 19:06:36 +08:00
{
2026-06-04 19:06:36 +08:00
field: 'featureAmplitude',
2026-06-08 18:34:49 +08:00
title: '暂降幅值(%)',
minWidth: 120,
2026-06-04 19:06:36 +08:00
sortable: true,
formatter: (row: any) => {
2026-06-04 19:06:36 +08:00
//row.cellValue = row.cellValue + '' ? row.cellValue.toFixed(2) : '/'
2026-06-08 18:34:49 +08:00
row.cellValue = row.cellValue != null ? Number(row.cellValue).toFixed(2) : '-'
2026-06-04 19:06:36 +08:00
if (String(row.cellValue).split('.')[1] == '00') {
row.cellValue = String(row.cellValue).split('.')[0]
}
return row.cellValue
}
},
2026-06-04 19:06:36 +08:00
{
field: 'persistTime',
title: '持续时间(s)',
2026-01-14 13:30:23 +08:00
minWidth: 110,
formatter: (row: any) => {
2026-01-16 15:54:16 +08:00
// console.log('🚀 ~ row.cellValue:', row.cellValue)
2026-01-15 15:59:13 +08:00
2026-06-08 18:34:49 +08:00
return row.cellValue ? (row.cellValue - 0).toFixed(2) : '-'
2026-01-04 14:55:31 +08:00
},
sortable: true
},
{
2026-06-04 19:06:36 +08:00
field: 'phaseType',
title: '相别',
minWidth: 80,
formatter: (row: any) => {
2026-06-08 18:34:49 +08:00
return row.cellValue || '-'
}
},
2026-06-09 19:51:31 +08:00
{
title: '严重度', field: 'severity', minWidth: 80, align: 'center', sortable: true, formatter: (row: any) => {
return row.cellValue ? row.cellValue : '/'
}
},
{ field: 'showName', title: '触发类型', minWidth: 100 },
2026-06-08 18:34:49 +08:00
{
title: '暂降原因', field: 'advanceReason', minWidth: 100, align: 'center', formatter: (row: any) => {
2026-06-09 19:51:31 +08:00
return ReasonList.find((item: any) => item.id == row.cellValue)?.name || '未知'
2026-06-08 18:34:49 +08:00
}
},
{
title: '暂降类型', field: 'advanceType', minWidth: 100, align: 'center', formatter: (row: any) => {
2026-06-09 19:51:31 +08:00
return EventTypeList.find((item: any) => item.id == row.cellValue)?.name || '未知'
2026-06-08 18:34:49 +08:00
}
},
{ title: '电压等级(kV)', field: 'lineVoltage', minWidth: 120, align: 'center', sortable: true, },
{
title: '发生位置', field: 'sagSource', minWidth: 120, align: 'center', formatter: (row: any) => {
2026-06-04 19:06:36 +08:00
2026-06-08 18:34:49 +08:00
return row.cellValue == 1 ? '上游' : row.cellValue == 2 ? '下游' : '未知'
}
},
2026-06-04 19:06:36 +08:00
2024-07-23 17:28:31 +08:00
{
2026-01-15 15:59:13 +08:00
title: '操作',
fixed: 'right',
width: 180,
2024-07-23 17:28:31 +08:00
render: 'buttons',
2026-01-15 15:59:13 +08:00
2024-07-23 17:28:31 +08:00
buttons: [
{
name: 'edit',
2024-12-30 10:07:26 +08:00
title: '波形分析',
2024-07-23 17:28:31 +08:00
type: 'primary',
icon: 'el-icon-Check',
render: 'basicButton',
2024-12-19 10:16:08 +08:00
loading: 'loading1',
disabled: row => {
// && row.evtParamTm < 20
2024-10-30 14:24:15 +08:00
return !row.wavePath
},
2024-07-31 10:42:04 +08:00
click: async row => {
2024-10-31 14:36:09 +08:00
row.loading1 = true
2026-06-04 19:06:36 +08:00
2024-09-24 11:10:57 +08:00
await analyseWave(row.id)
2024-07-31 10:42:04 +08:00
.then(res => {
isWaveCharts.value = true
loading.value = true
2024-10-31 14:36:09 +08:00
row.loading1 = false
2024-07-31 10:42:04 +08:00
if (res != undefined) {
2024-08-01 10:55:08 +08:00
boxoList.value = row
2026-01-04 14:55:31 +08:00
boxoList.value.systemType = 'YPT'
boxoList.value.engineeringName = tableParams.value.engineeringName
2026-01-14 13:30:23 +08:00
boxoList.value.featureAmplitude =
row.featureAmplitude != null ? Number(row.featureAmplitude / 100) : '-'
boxoList.value.persistTime = row.persistTime ? row.persistTime.toFixed(2) : '-'
2024-07-31 10:42:04 +08:00
wp.value = res.data
view.value = false
view2.value = true
}
2024-12-19 10:16:08 +08:00
loading.value = false
2024-07-31 10:42:04 +08:00
})
.catch(() => {
2024-10-31 14:36:09 +08:00
row.loading1 = false
2024-12-19 10:16:08 +08:00
loading.value = false
2024-07-31 10:42:04 +08:00
})
2024-12-19 10:16:08 +08:00
2024-08-01 10:55:08 +08:00
nextTick(() => {
waveFormAnalysisRef.value && waveFormAnalysisRef.value.getWpData(wp.value, boxoList.value)
2026-01-16 15:54:16 +08:00
// waveFormAnalysisRef.value && waveFormAnalysisRef.value.setHeight(200, 345)
waveFormAnalysisRef.value && waveFormAnalysisRef.value.setHeight(350, 345)
2024-08-01 10:55:08 +08:00
})
2024-07-23 17:28:31 +08:00
}
2024-10-15 15:31:36 +08:00
},
2026-06-09 19:51:31 +08:00
// {
// name: 'edit',
// text: '暂无波形',
// type: 'info',
// icon: 'el-icon-DataLine',
// render: 'basicButton',
// disabled: row => {
// return row.wavePath
// }
// },
2024-10-30 14:24:15 +08:00
{
name: 'edit',
title: '波形下载',
type: 'primary',
2024-12-19 10:16:08 +08:00
loading: 'loading2',
2024-10-30 14:24:15 +08:00
icon: 'el-icon-Check',
render: 'basicButton',
disabled: row => {
// && row.evtParamTm < 20
return !row.wavePath
2024-10-15 15:31:36 +08:00
},
2024-10-30 14:24:15 +08:00
click: row => {
2026-06-08 18:34:49 +08:00
row.loading2 = true
2026-06-04 19:06:36 +08:00
ElMessage.info('下载中......')
2025-01-03 12:45:54 +08:00
getFileZip({ eventId: row.id }).then(res => {
let blob = new Blob([res], { type: 'application/zip' }) // console.log(blob) // var href = window.URL.createObjectURL(blob); //创建下载的链接
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a') // 创建a标签
link.href = url
link.download = row.wavePath.split('/')[2] || '波形文件' // 设置下载的文件名
document.body.appendChild(link)
link.click() //执行下载
document.body.removeChild(link) //释放标签
2026-06-04 19:06:36 +08:00
ElMessage.success('波形下载成功')
2026-06-08 18:34:49 +08:00
row.loading2 = false
}).catch(() => {
row.loading2 = false
2025-01-03 12:45:54 +08:00
})
2024-10-30 14:24:15 +08:00
}
2025-10-21 16:27:49 +08:00
},
{
2026-01-04 14:55:31 +08:00
name: 'edit',
title: '波形补召',
type: 'primary',
icon: 'el-icon-Check',
render: 'basicButton',
2026-06-09 19:51:31 +08:00
loading: 'loading3',
2026-01-04 14:55:31 +08:00
disabled: row => {
2026-06-09 19:51:31 +08:00
return !(row.wavePath == null)
2026-01-04 14:55:31 +08:00
},
click: row => {
2026-06-09 19:51:31 +08:00
if (props.deviceType == '2') {
row.loading3 = true
getFileByEventId(row.id).then(res => {
ElMessage.success(res.message)
tableStore.index()
row.loading3 = false
}).catch(() => {
row.loading3 = false
})
}else if(props.deviceType == '1'){
emit('fileRecall', row.id)
}
2026-01-04 14:55:31 +08:00
}
2024-07-23 17:28:31 +08:00
}
]
}
],
beforeSearchFun: () => {
tableStore.table.params.devId = tableParams.value.devId
tableStore.table.params.lineId = tableParams.value.lineId
tableStore.table.params.list = tableParams.value.list
tableStore.table.params.type = 3
},
2026-06-04 19:06:36 +08:00
loadCallback: () => { }
2024-07-23 17:28:31 +08:00
})
2026-06-09 19:51:31 +08:00
Object.assign(tableStore.table.params, {
featureAmplitudeMin: undefined,
featureAmplitudeMax: undefined,
evtParamTmMin: undefined,
evtParamTmMax: undefined,
severityMin: undefined,
severityMax: undefined,
fileFlag: ''
})
// 重置
const onResetForm = () => {
filterVisible.value = false
tableStore.table.params.cascader = ''
tableStore.table.params.deviceTypeId = ''
tableStore.table.params.engineeringid = ''
tableStore.table.params.projectId = ''
tableStore.table.params.deviceId = ''
tableStore.table.params.deviceTypeName = ''
multiConditionRef.value?.reset()
}
const filterVisible = ref(false)
2024-07-23 17:28:31 +08:00
provide('tableStore', tableStore)
const isWaveCharts = ref(false)
//获取请求参数
const getTableParams = (val: any) => {
tableParams.value = val
isWaveCharts.value = false
tableStore.index()
}
2026-06-09 19:51:31 +08:00
const onFilterConfirm = () => {
tableStore.onTableAction('search', {})
2024-07-23 17:28:31 +08:00
}
2026-06-09 19:51:31 +08:00
const openFilterDialog = () => {
filterVisible.value = true
}
2024-07-23 17:28:31 +08:00
defineExpose({ getTableParams })
2024-07-03 19:31:43 +08:00
onMounted(() => {
2026-05-28 15:10:40 +08:00
2026-06-09 19:51:31 +08:00
// tableStore.index()
2024-07-03 19:31:43 +08:00
})
</script>
2024-07-23 17:28:31 +08:00
<style lang="scss" scoped>
.header_btn {
2024-07-23 17:28:31 +08:00
width: 100%;
height: 30px;
display: flex;
justify-content: flex-end;
align-items: center;
}
2024-07-03 19:31:43 +08:00
</style>