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

150 lines
4.9 KiB
Vue

<template>
<div class="view">
<TableHeader datePicker ref="headerRef" v-if="!isWaveCharts"></TableHeader>
<Table ref="tableRef" v-if="!isWaveCharts" />
<waveFormAnalysis
v-if="isWaveCharts"
ref="waveFormAnalysisRef"
@handleHideCharts="isWaveCharts = false"
:wp="wp"
/>
<el-button v-if="isWaveCharts" type="primary" @click="handleBack" :icon="ArrowLeft">返回</el-button>
</div>
</template>
<script lang="ts" setup>
import { ref, onMounted, provide, nextTick, defineEmits } from 'vue'
import { getTabsDataByType } from '@/api/cs-device-boot/EquipmentDelivery'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue'
import waveFormAnalysis from './components/waveFormAnalysis.vue'
import { ArrowLeft } from '@element-plus/icons-vue'
import { analyseWave } from '@/api/common'
const tableParams: any = ref({})
const refheader = ref()
const view = ref(true)
const view2 = ref(false)
const showBoxi = ref(true)
const bxactiveName = ref('ssbx')
const boxoList: any = ref([])
const wp = ref({})
const value = ref(1)
const waveFormAnalysisRef = ref()
const headerRef = ref()
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: '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: 'featureAmplitude',
title: '暂降幅值(%)',
minWidth: 100,
formatter: (row: any) => {
row.cellValue = row.cellValue ? row.cellValue.toFixed(2) : '/'
return row.cellValue
}
},
{
title: '操作',
width: 180,
render: 'buttons',
fixed: 'right',
buttons: [
{
name: 'edit',
title: '波形解析',
type: 'primary',
icon: 'el-icon-Check',
render: 'basicButton',
disabled: row => {
// && row.evtParamTm < 20
return !row.wavePath
},
click: async row => {
row.loading = true
await analyseWave(row.id)
.then(res => {
row.loading = false
if (res != undefined) {
boxoList.value = row
wp.value = res.data
view.value = false
view2.value = true
}
})
.catch(() => {
row.loading = false
})
isWaveCharts.value = true
nextTick(() => {
waveFormAnalysisRef.value && waveFormAnalysisRef.value.getWpData(wp.value, boxoList.value)
})
}
}
]
}
],
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()
}
//返回
const handleBack = async () => {
isWaveCharts.value = false
console.log(6666666, isWaveCharts.value)
emit('activeTabsType', '')
await tableStore.index()
}
defineExpose({ getTableParams })
onMounted(() => {
tableStore.index()
})
</script>
<style lang="scss" scoped>
.header_btn {
width: 100%;
height: 30px;
display: flex;
justify-content: flex-end;
align-items: center;
}
</style>