方案数据添加暂态事件页面

This commit is contained in:
GGJ
2024-12-19 10:16:08 +08:00
parent 8089fcb7de
commit b10854971d
16 changed files with 283 additions and 171 deletions

View File

@@ -1,25 +1,41 @@
<template>
<div>
<Table ref="tableRef" v-if="!isWaveCharts" />
<waveFormAnalysis v-loading="loading" v-if="isWaveCharts" ref="waveFormAnalysisRef"
@handleHideCharts="isWaveCharts = false" :wp="wp" />
</div>
<!-- <TableHeader :showReset="false">
</TableHeader> -->
<Table ref="tableRef" />
</template>
<script setup lang='ts'>
import { ref, provide, onMounted } from 'vue'
import { ref, provide, onMounted, nextTick } from 'vue'
import { getEventByItem } from '@/api/cs-device-boot/planData'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue'
import { ElMessage } from 'element-plus'
import waveFormAnalysis from '@/views/govern/device/control/tabs/components/waveFormAnalysis.vue';
import { analyseWave } from '@/api/common'
import { mainHeight } from '@/utils/layout'
const props = defineProps({
activeName: String
activeName: String,
activeColName: [Object, String]
})
const loading = ref(false)
const waveFormAnalysisRef = ref()
const isWaveCharts = ref(false)
const boxoList: any = ref([])
const wp = ref({})
const tableStore = new TableStore({
url: '/cs-harmonic-boot/data/getEventByItem',
method: 'POST',
paramsPOST: true,
showPage: false,
publicHeight: 365,
column: [
// { width: '60', type: 'checkbox', fixed: 'left' },
{
@@ -64,73 +80,77 @@ const tableStore = new TableStore({
width: 180,
render: 'buttons',
fixed: 'right',
// buttons: [
// {
// name: 'edit',
// title: '波形解析',
// type: 'primary',
// icon: 'el-icon-Check',
// render: 'basicButton',
// loading: 'loading1',
// disabled: row => {
// // && row.evtParamTm < 20
// return !row.wavePath
// },
// click: async row => {
// row.loading1 = true
buttons: [
{
name: 'edit',
title: '波形解析',
type: 'primary',
icon: 'el-icon-Check',
render: 'basicButton',
loading: 'loading1',
disabled: row => {
// && row.evtParamTm < 20
return !row.wavePath
},
click: async row => {
row.loading1 = true
loading.value = true
isWaveCharts.value = true
await analyseWave(row.id)
.then(res => {
row.loading1 = false
if (res != undefined) {
boxoList.value = row
boxoList.value.systemType = 'WX'
wp.value = res.data
// await analyseWave(row.id)
// .then(res => {
// row.loading1 = false
// if (res != undefined) {
// boxoList.value = row
// boxoList.value.systemType = 'WX'
// wp.value = res.data
// view.value = false
// view2.value = true
// }
// })
// .catch(() => {
// row.loading1 = false
// })
// isWaveCharts.value = true
// nextTick(() => {
// waveFormAnalysisRef.value && waveFormAnalysisRef.value.getWpData(wp.value, boxoList.value)
// })
// }
// },
// {
// name: 'edit',
// text: '暂无波形',
// type: 'info',
// icon: 'el-icon-DataLine',
// render: 'basicButton',
// disabled: row => {
// return row.wavePath
// }
// },
// {
// name: 'edit',
// title: '波形下载',
// type: 'primary',
// loading: 'loading2',
// icon: 'el-icon-Check',
// render: 'basicButton',
// disabled: row => {
// // && row.evtParamTm < 20
// return !row.wavePath
// },
// click: row => {
// row.loading2 = true
// const url = window.location.origin + '/api/cs-harmonic-boot/event/getFileZip?eventId=' + row.id
// window.open(url, '_self')
// setTimeout(() => {
// ElMessage.success('波形下载成功!')
// row.loading2 = false
// }, 1500)
// }
// }
// ]
}
loading.value = false
})
.catch(() => {
row.loading1 = false
loading.value = false
})
nextTick(() => {
waveFormAnalysisRef.value && waveFormAnalysisRef.value.getWpData(wp.value, boxoList.value, true)
setHeight()
})
}
},
{
name: 'edit',
text: '暂无波形',
type: 'info',
icon: 'el-icon-DataLine',
render: 'basicButton',
disabled: row => {
return row.wavePath
}
},
{
name: 'edit',
title: '波形下载',
type: 'primary',
loading: 'loading2',
icon: 'el-icon-Check',
render: 'basicButton',
disabled: row => {
// && row.evtParamTm < 20
return !row.wavePath
},
click: row => {
row.loading2 = true
const url = window.location.origin + '/api/cs-harmonic-boot/event/getFileZip?eventId=' + row.id
window.open(url, '_self')
setTimeout(() => {
ElMessage.success('波形下载成功!')
row.loading2 = false
}, 1500)
}
}
]
}
],
@@ -138,6 +158,16 @@ const tableStore = new TableStore({
}
})
const setHeight = () => {
if (props.activeColName == '0') {
waveFormAnalysisRef.value && waveFormAnalysisRef.value.setHeight(360, 495)
tableStore.table.height = mainHeight(385).height
} else {
waveFormAnalysisRef.value && waveFormAnalysisRef.value.setHeight(360, 360)
tableStore.table.height = mainHeight(250).height
}
}
provide('tableStore', tableStore)
const init = () => {
tableStore.table.params.id = props.activeName
@@ -149,7 +179,7 @@ const init = () => {
onMounted(() => {
})
defineExpose({ init })
defineExpose({ init, setHeight })
</script>
<style lang="scss" scoped></style>

View File

@@ -16,13 +16,13 @@
{{ deviceData.describe ? deviceData.describe : '/' }}
</el-descriptions-item>
</el-descriptions>
<el-collapse v-model="activeColName" @change="handleChange">
<el-collapse v-model="activeColName" @change="handleChange" accordion>
<el-collapse-item title="测试项信息" name="0">
<div class="monitor_info" v-if="deviceData.records && deviceData.records.length != 0">
<!-- <div class="history_title">
<p>测试项信息</p>
</div> -->
<el-tabs v-model="activeName" type="border-card" @click="handleClickTabs">
<el-tabs v-model="activeName" type="border-card" @tab-change="handleClickTabs">
<el-tab-pane v-for="(item, index) in deviceData?.records" :label="item.itemName"
:name="item.id" :key="index">
<template #label>
@@ -170,7 +170,7 @@
<el-empty :style="EcharHeight" v-else description="未绑定数据" />
</el-tab-pane>
<el-tab-pane label="暂态数据" name="1">
<transient :activeName='activeName' ref="transientRef" />
<transient :activeName='activeName' ref="transientRef" :activeColName="activeColName"/>
</el-tab-pane>
</el-tabs>
@@ -310,6 +310,7 @@ const handleClickTabs = () => {
schemeTreeRef.value.setCheckedNode(activeName.value)
setTimeout(() => {
init(true)
transientRef.value && transientRef.value.init()
}, 100)
}
const nodeClick = async (e: anyObj) => {
@@ -345,7 +346,7 @@ const nodeClick = async (e: anyObj) => {
// if (searchForm.value.index.length == 0) {
// searchForm.value.index = [indexOptions.value[0].id]
// }
schemeTreeRef.value.getPlanData(deviceData.value)
await setTimeout(() => {
loading.value = true
@@ -645,12 +646,15 @@ const init = (flag: boolean) => {
}
}
if (chartsList.length > 0) {
let yData: any = []
echartsData.value.yAxis = []
let setList = [...new Set(unitList)];
setList.forEach((item: any, index: any) => {
if (index > 2) {
echartsData.value.grid.right = (index - 1) * 80
}
yData.push([])
let right = {
position: 'right',
offset: (index - 1) * 80
@@ -667,13 +671,8 @@ const init = (flag: boolean) => {
})
})
// console.log("🚀 ~ result.forEach ~ result:", result)
let ABCName = [...new Set(chartsList.map((item: any) => { return item.anotherName == '电压负序分量' ? '电压不平衡' : item.anotherName == '电压正序分量' ? '电压不平衡' : item.anotherName == '电压零序分量' ? '电压不平衡' : item.anotherName }))];
// console.log("🚀 ~ result.forEach ~ result:", result)
result.forEach((item: any, index: any) => {
let yMethodList: any = []
@@ -701,20 +700,12 @@ const init = (flag: boolean) => {
ABCList.forEach((kk: any) => {
let colorName = kk[0].phase?.charAt(0).toUpperCase()
let lineS = ABCName.findIndex(item => item === (kk[0].anotherName == '电压负序分量' ? '电压不平衡' : kk[0].anotherName == '电压正序分量' ? '电压不平衡' : kk[0].anotherName == '电压零序分量' ? '电压不平衡' : kk[0].anotherName));
let seriesList: any = []
kk.forEach((cc: any) => {
if (cc.statisticalData !== null) {
yMethodList.push(cc.statisticalData?.toFixed(2))
yData[setList.indexOf(kk[0].unit)].push(cc.statisticalData?.toFixed(2))
}
seriesList.push([cc.time, cc.statisticalData?.toFixed(2), cc.unit, lineStyle[lineS].type])
})
@@ -732,12 +723,22 @@ const init = (flag: boolean) => {
})
})
let [min, max] = yMethod(yMethodList)
// let [min, max] = yMethod(yMethodList)
// echartsData.value.yAxis[index].min = min
// echartsData.value.yAxis[index].max = max
})
yData.forEach((item: any, index: any) => {
let [min, max] = yMethod(item)
echartsData.value.yAxis[index].min = min
echartsData.value.yAxis[index].max = max
})
}
loading.value = false
}
})
@@ -968,6 +969,7 @@ const selectChange = (e: boolean) => {
}
const handleChange = () => {
if (activeColName.value == '0') {
if (flag.value) {
EcharHeight.value = mainHeight(495)
@@ -981,6 +983,9 @@ const handleChange = () => {
EcharHeight.value = mainHeight(315)
}
}
setTimeout(() => {
transientRef.value && transientRef.value.setHeight()
}, 100);
}
watch(