Files
admin-govern/src/views/govern/analyze/DVR/index.vue

295 lines
11 KiB
Vue
Raw Normal View History

2024-01-12 14:05:36 +08:00
<template>
2024-01-18 15:50:17 +08:00
<div class="default-main">
2024-12-30 10:07:26 +08:00
<div class="analyze-dvr" v-show="!isWaveCharts" :style="{ height: pageHeight.height }" v-loading="loading">
2025-07-15 16:31:06 +08:00
<DeviceTree @node-click="nodeClick" @init="nodeClick" @deviceTypeChange="deviceTypeChange"></DeviceTree>
2024-01-29 14:57:49 +08:00
<div class="analyze-dvr-right" v-if="tableStore.table.params.deviceId">
2025-01-07 16:33:37 +08:00
<TableHeader datePicker showExport>
2025-01-03 12:45:54 +08:00
<template v-slot:select>
2025-01-06 21:01:49 +08:00
<el-form-item label="事件类型">
2025-07-15 16:31:06 +08:00
<el-select
v-model.trim="tableStore.table.params.eventType"
clearable
placeholder="请选择事件类型"
>
<el-option
v-for="item in eventList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
2025-01-06 21:01:49 +08:00
</el-select>
</el-form-item>
<el-form-item label="位置">
2025-07-15 16:31:06 +08:00
<el-select
v-model.trim="tableStore.table.params.location"
clearable
placeholder="请选择位置"
>
<el-option
v-for="item in locationList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
2025-01-06 21:01:49 +08:00
</el-select>
2025-01-03 12:45:54 +08:00
</el-form-item>
</template>
</TableHeader>
2024-01-18 15:50:17 +08:00
<Table v-if="view" ref="tableRef"></Table>
</div>
2024-01-29 14:57:49 +08:00
<el-empty v-else description="请选择设备" class="analyze-dvr-right" />
2024-01-18 15:50:17 +08:00
</div>
2025-07-15 16:31:06 +08:00
<waveFormAnalysis
v-loading="loading"
v-if="isWaveCharts"
ref="waveFormAnalysisRef"
@handleHideCharts="isWaveCharts = false"
:wp="wp"
style="padding: 10px"
/>
2024-12-30 10:07:26 +08:00
<!-- <div :style="{ height: pageHeight.height }" style="padding: 10px; overflow: hidden" v-if="!view">
2024-01-18 15:50:17 +08:00
<el-row>
<el-col :span="12">
2024-09-25 16:36:53 +08:00
<div v-if="view2" style="display: flex">
2024-12-25 10:53:07 +08:00
<el-radio-group v-model.trim="value" @change="changeView">
2024-12-17 20:57:07 +08:00
<el-radio-button label="一次值" :value="1" />
<el-radio-button label="二次值" :value="2" />
</el-radio-group>
2024-09-25 16:36:53 +08:00
</div>
2024-01-18 15:50:17 +08:00
</el-col>
<el-col :span="12">
2024-12-17 20:57:07 +08:00
<el-button v-if="view2" @click="backbxlb" class="el-icon-refresh-right" icon="el-icon-Back"
style="float: right">
2024-01-18 15:50:17 +08:00
返回
</el-button>
</el-col>
</el-row>
2024-12-25 10:53:07 +08:00
<el-tabs v-if="view2" class="default-main" v-model.trim="bxactiveName" @tab-click="bxhandleClick">
2024-09-25 16:36:53 +08:00
<el-tab-pane label="瞬时波形" name="ssbx" class="boxbx pt10 pb10"
:style="'height:' + bxecharts + ';overflow-y: scroll;'">
<shushiboxi v-if="bxactiveName == 'ssbx' && showBoxi" :value="value" :boxoList="boxoList" :wp="wp">
</shushiboxi>
2024-01-18 15:50:17 +08:00
</el-tab-pane>
2024-09-25 16:36:53 +08:00
<el-tab-pane label="RMS波形" class="boxbx pt10 pb10" name="rmsbx"
:style="'height:' + bxecharts + ';overflow-y: scroll;'">
<rmsboxi v-if="bxactiveName == 'rmsbx' && showBoxi" :value="value" :boxoList="boxoList" :wp="wp">
</rmsboxi>
2024-01-18 15:50:17 +08:00
</el-tab-pane>
</el-tabs>
2024-12-30 10:07:26 +08:00
</div> -->
2024-01-12 14:05:36 +08:00
</div>
</template>
<script setup lang="ts">
2024-12-30 10:07:26 +08:00
import { ref, nextTick, provide, onMounted } from 'vue'
2024-01-12 14:05:36 +08:00
import { mainHeight } from '@/utils/layout'
import DeviceTree from '@/components/tree/govern/deviceTree.vue'
2024-01-15 10:36:24 +08:00
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
2025-07-15 16:31:06 +08:00
import waveFormAnalysis from '@/views/govern/device/control/tabs/components/waveFormAnalysis.vue'
2024-01-18 15:50:17 +08:00
import { analyseWave } from '@/api/common'
2025-01-03 12:45:54 +08:00
import TableHeader from '@/components/table/header/index.vue'
import { getFileZip } from '@/api/cs-harmonic-boot/datatrend'
2024-12-30 10:07:26 +08:00
import { ElMessage } from 'element-plus'
2024-01-12 14:05:36 +08:00
defineOptions({
2025-07-15 16:31:06 +08:00
name: 'govern/analyze/DVR/index'
2024-01-12 14:05:36 +08:00
})
const pageHeight = mainHeight(20)
const loading = ref(false)
2024-01-18 15:50:17 +08:00
const view = ref(true)
const view2 = ref(false)
const showBoxi = ref(true)
2024-12-30 10:07:26 +08:00
const isWaveCharts = ref(false)
2024-01-18 15:50:17 +08:00
const bxactiveName = ref('ssbx')
2024-12-30 10:07:26 +08:00
const boxoList: any = ref({})
2024-01-18 15:50:17 +08:00
const wp = ref({})
2025-07-15 16:31:06 +08:00
const eventList = ref([
{
value: 'Evt_Sys_DipStr',
label: '电压暂降'
},
{
value: 'Evt_Sys_SwlStr',
label: '电压暂升'
},
{
value: 'Evt_Sys_IntrStr',
label: '电压中断'
}
])
const locationList = ref([
{
value: 'grid',
label: '电网侧'
},
{
value: 'load',
label: '负载侧'
}
])
2024-12-30 10:07:26 +08:00
const waveFormAnalysisRef = ref()
2025-01-06 21:01:49 +08:00
2024-01-15 10:36:24 +08:00
const tableStore = new TableStore({
2024-10-10 09:56:34 +08:00
url: '/cs-harmonic-boot/eventUser/queryEventpageWeb',
2024-01-15 10:36:24 +08:00
method: 'POST',
column: [
2025-07-15 16:31:06 +08:00
{ title: '事件描述', field: 'showName' },
2024-12-30 10:07:26 +08:00
{ title: '发生位置', field: 'evtParamPosition' },
2025-07-15 16:31:06 +08:00
{ title: '持续时间(s)', field: 'evtParamTm', sortable: true },
2025-01-07 16:33:37 +08:00
{
2025-07-15 16:31:06 +08:00
title: '暂降(聚升)幅值(%)',
field: 'evtParamVVaDepth',
formatter: (row: any) => {
2025-01-07 16:33:37 +08:00
let a = row.cellValue.split('%')[0] - 0
2025-07-15 16:31:06 +08:00
console.log('🚀 ~ a:', a)
2025-01-07 16:33:37 +08:00
return a ? a.toFixed(2) : '/'
2025-07-15 16:31:06 +08:00
}, sortable: true
2025-01-07 16:33:37 +08:00
},
2025-07-15 16:31:06 +08:00
{ title: '发生时刻', field: 'startTime', sortable: true },
2024-01-15 10:36:24 +08:00
{
title: '操作',
align: 'center',
2024-01-30 14:11:29 +08:00
width: '180',
2024-01-15 10:36:24 +08:00
render: 'buttons',
buttons: [
{
name: 'edit',
2024-01-18 15:50:17 +08:00
text: '波形分析',
2024-01-15 10:36:24 +08:00
type: 'primary',
icon: 'el-icon-DataLine',
2024-01-18 15:50:17 +08:00
render: 'basicButton',
disabled: row => {
return !row.wavePath && row.evtParamTm < 20
},
click: async row => {
2024-12-30 10:07:26 +08:00
row.loading1 = true
loading.value = true
isWaveCharts.value = true
2024-01-18 15:50:17 +08:00
await analyseWave(row.id)
.then(res => {
2024-12-30 10:07:26 +08:00
row.loading1 = false
2024-01-18 15:50:17 +08:00
if (res != undefined) {
2024-12-30 10:07:26 +08:00
boxoList.value = row
2025-07-15 16:31:06 +08:00
boxoList.value.featureAmplitude =
row.evtParamVVaDepth != '-' ? row.evtParamVVaDepth - 0 : null
2024-12-30 10:07:26 +08:00
// boxoList.value.systemType = 'WX'
2024-01-18 15:50:17 +08:00
wp.value = res.data
}
2024-12-30 10:07:26 +08:00
loading.value = false
2024-01-18 15:50:17 +08:00
})
.catch(() => {
2024-12-30 10:07:26 +08:00
row.loading1 = false
loading.value = false
2024-01-18 15:50:17 +08:00
})
2024-12-30 10:07:26 +08:00
nextTick(() => {
2025-07-15 16:31:06 +08:00
waveFormAnalysisRef.value &&
waveFormAnalysisRef.value.getWpData(wp.value, boxoList.value, true)
2024-12-30 10:07:26 +08:00
waveFormAnalysisRef.value && waveFormAnalysisRef.value.setHeight(false, 150)
})
2024-01-15 10:36:24 +08:00
}
2024-09-25 16:36:53 +08:00
},
{
name: 'edit',
text: '暂无波形',
type: 'info',
icon: 'el-icon-DataLine',
render: 'basicButton',
disabled: row => {
return !(!row.wavePath && row.evtParamTm < 20)
2025-07-15 16:31:06 +08:00
}
2024-12-30 10:07:26 +08:00
},
{
name: 'edit',
title: '波形下载',
type: 'primary',
icon: 'el-icon-Check',
loading: 'loading2',
render: 'basicButton',
disabled: row => {
// && row.evtParamTm < 20
return !row.wavePath
},
click: row => {
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) //释放标签
})
2024-12-30 10:07:26 +08:00
}
2025-07-15 16:31:06 +08:00
}
2024-01-15 10:36:24 +08:00
]
}
2024-01-18 15:50:17 +08:00
],
loadCallback: () => {
tableStore.table.data.forEach((item: any) => {
item.loading = false
item.evtParamTm = item.evtParamTm.split('s')[0]
})
}
2024-01-15 10:36:24 +08:00
})
2025-07-15 16:31:06 +08:00
const flag = ref(false)
2024-01-15 10:36:24 +08:00
tableStore.table.params.type = 0
2025-01-07 16:33:37 +08:00
tableStore.table.params.eventType = ''
tableStore.table.params.location = ''
2024-01-15 10:36:24 +08:00
provide('tableStore', tableStore)
2025-07-15 16:31:06 +08:00
const deviceTypeChange = (val: any, obj: any) => {
flag.value = true
nodeClick(obj)
}
2024-01-12 14:05:36 +08:00
const nodeClick = async (e: anyObj) => {
// console.log("🚀 ~ nodeClick ~ e:", e)
2025-07-15 16:31:06 +08:00
if (e.level == 2&& flag.value) {
2024-01-15 10:36:24 +08:00
loading.value = false
tableStore.table.params.deviceId = e.id
2025-01-06 21:01:49 +08:00
nextTick(() => {
tableStore.index()
})
2024-01-12 14:05:36 +08:00
}
}
2024-01-18 15:50:17 +08:00
const changeView = () => {
showBoxi.value = false
setTimeout(() => {
showBoxi.value = true
}, 0)
}
const bxhandleClick = (tab: any) => {
if (tab.name == 'ssbx') {
bxactiveName.value = 'ssbx'
} else if (tab.name == 'rmsbx') {
bxactiveName.value = 'rmsbx'
}
// console.log(tab, event);
}
const backbxlb = () => {
view.value = true
view2.value = false
}
const bxecharts = mainHeight(95).height as any
2024-01-12 14:05:36 +08:00
</script>
<style lang="scss">
.analyze-dvr {
display: flex;
&-right {
height: 100%;
overflow: hidden;
flex: 1;
padding: 10px 10px 10px 0;
display: flex;
flex-direction: column;
}
}
</style>