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

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>