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

159 lines
5.1 KiB
Vue
Raw Normal View History

2024-07-03 19:31:43 +08:00
<template>
2024-07-23 17:28:31 +08:00
<div class="header_btn">
2024-07-31 10:42:04 +08:00
<!-- <el-button type="primary" size="small" @click="handleWaveFormAnalysis(0)" v-if="!isWaveCharts">
波形解析
2024-07-31 10:42:04 +08:00
</el-button> -->
<el-button type="primary" size="small" @click="handleBack" v-if="isWaveCharts" :icon="ArrowLeft">
返回
</el-button>
2024-07-23 17:28:31 +08:00
</div>
2024-07-03 19:31:43 +08:00
<div class="view">
2024-07-23 17:28:31 +08:00
<Table ref="tableRef" v-if="!isWaveCharts" />
2024-07-31 10:42:04 +08:00
<waveFormAnalysis ref="waveFormAnalysisRef" v-if="isWaveCharts" :wp="wp" />
2024-07-03 19:31:43 +08:00
</div>
</template>
<script lang="ts" setup>
2024-07-23 17:28:31 +08:00
import { ref, onMounted, provide } from 'vue'
import { getTabsDataByType } from '@/api/cs-device-boot/EquipmentDelivery'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import waveFormAnalysis from './components/waveFormAnalysis.vue'
import { ArrowLeft } from '@element-plus/icons-vue'
2024-07-31 10:42:04 +08:00
import { analyseWave } from '@/api/common'
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)
const showBoxi = ref(true)
const bxactiveName = ref('ssbx')
const boxoList = ref({})
const wp = ref({})
const value = ref(1)
2024-07-23 17:28:31 +08:00
const tableStore: any = new TableStore({
url: '/cs-device-boot/csGroup/deviceDataByType',
publicHeight: 210,
method: 'POST',
column: [
// { width: '60', type: 'checkbox', fixed: 'left' },
{ title: '序号', type: 'seq', width: 80 },
{ field: 'startTime', title: '发生时刻', minWidth: 170 },
{
field: 'gcName',
title: '工程名称',
minWidth: 170,
formatter: (row: any) => {
row.cellValue = row.cellValue ? row.cellValue : '/'
return row.cellValue
}
},
{ field: 'projectName', title: '项目名称', minWidth: 170 },
{ field: 'itemName', title: '测试项名称', minWidth: 170 },
{ field: 'showName', title: '事件描述', minWidth: 170 },
{
field: 'phaseType',
title: '相别',
minWidth: 100,
formatter: (row: any) => {
row.cellValue = row.cellValue ? row.cellValue : '/'
return row.cellValue
}
},
{
field: 'persistTime',
title: '持续时间(s)',
minWidth: 100,
formatter: (row: any) => {
row.cellValue = row.cellValue ? row.cellValue : '/'
return row.cellValue
}
},
{
field: 'amplitude',
title: '暂降幅值(%)',
minWidth: 100,
formatter: (row: any) => {
row.cellValue = row.cellValue ? row.cellValue : '/'
return row.cellValue
}
},
2024-07-23 17:28:31 +08:00
{
title: '操作',
width: 180,
2024-07-23 17:28:31 +08:00
render: 'buttons',
fixed: 'right',
2024-07-23 17:28:31 +08:00
buttons: [
{
name: 'edit',
title: '波形解析',
type: 'primary',
icon: 'el-icon-Check',
render: 'basicButton',
2024-07-31 10:42:04 +08:00
// disabled: row => {
// return !row.wavePath && row.evtParamTm < 20
// },
click: async row => {
row.loading = true
boxoList.value = row
await analyseWave(row.eventId)
.then(res => {
row.loading = false
if (res != undefined) {
wp.value = res.data
view.value = false
view2.value = true
}
})
.catch(() => {
row.loading = false
})
handleWaveFormAnalysis(wp.value)
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
},
loadCallback: () => {}
})
provide('tableStore', tableStore)
const isWaveCharts = ref(false)
//获取请求参数
const getTableParams = (val: any) => {
tableParams.value = val
console.log(tableParams.value, '暂态时间表格请求参数')
isWaveCharts.value = false
tableStore.index()
}
//波形解析组件
2024-07-31 10:42:04 +08:00
const waveFormAnalysisRef = ref()
2024-07-23 17:28:31 +08:00
const handleWaveFormAnalysis = (val: any) => {
console.log(val, '波形解析')
isWaveCharts.value = true
2024-07-31 10:42:04 +08:00
waveFormAnalysisRef.value.getWpData(val)
2024-07-23 17:28:31 +08:00
}
//返回
const handleBack = () => {
isWaveCharts.value = false
2024-07-23 17:28:31 +08:00
tableStore.index()
}
defineExpose({ getTableParams })
2024-07-03 19:31:43 +08:00
onMounted(() => {
2024-07-23 17:28: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>