2026-05-18 12:39:57 +08:00
|
|
|
<script setup lang="ts">
|
2026-05-18 18:31:31 +08:00
|
|
|
import { computed, onMounted, ref } from 'vue'
|
2026-05-18 12:39:57 +08:00
|
|
|
import { usePlatformStore } from '../../stores/platform'
|
2026-05-18 18:31:31 +08:00
|
|
|
import {fetchChannelConfig} from '@/api/platform'
|
2026-05-18 12:39:57 +08:00
|
|
|
const { state, bootstrap } = usePlatformStore()
|
2026-05-18 18:31:31 +08:00
|
|
|
const channelConfig = ref<Record<number, { type: string; limit_low: number; limit_high: number; line_no: string }>>({})
|
2026-05-18 12:39:57 +08:00
|
|
|
|
|
|
|
|
const aiData = computed(() => {
|
2026-05-18 18:31:31 +08:00
|
|
|
const aiCollect = state.realtime?.ai_collect || {}
|
2026-05-18 12:39:57 +08:00
|
|
|
return Array.from({ length: 12 }, (_, i) => {
|
2026-05-18 18:31:31 +08:00
|
|
|
const ch = i + 1
|
|
|
|
|
const code = `ai${ch}`
|
|
|
|
|
const config = channelConfig.value[ch] || {}
|
2026-05-18 12:39:57 +08:00
|
|
|
return {
|
2026-05-18 18:31:31 +08:00
|
|
|
code,
|
|
|
|
|
line_no: config.line_no || '',
|
|
|
|
|
singal_type: '',
|
|
|
|
|
type: config.type || '',
|
|
|
|
|
limit_low: config.limit_low || 0,
|
|
|
|
|
limit_high: config.limit_high || 0,
|
|
|
|
|
rawValue: aiCollect[code] !== undefined ? aiCollect[code] : '',
|
|
|
|
|
ch
|
2026-05-18 12:39:57 +08:00
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
2026-05-18 18:31:31 +08:00
|
|
|
function formatTime(dateStr: string): string {
|
|
|
|
|
const date = new Date(dateStr)
|
|
|
|
|
const year = date.getFullYear()
|
|
|
|
|
const month = String(date.getMonth() + 1).padStart(2, '0')
|
|
|
|
|
const day = String(date.getDate()).padStart(2, '0')
|
|
|
|
|
const hours = String(date.getHours()).padStart(2, '0')
|
|
|
|
|
const minutes = String(date.getMinutes()).padStart(2, '0')
|
|
|
|
|
const seconds = String(date.getSeconds()).padStart(2, '0')
|
|
|
|
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
|
|
|
|
|
}
|
2026-05-18 12:39:57 +08:00
|
|
|
const tableData = computed(() => {
|
2026-05-18 18:31:31 +08:00
|
|
|
const list = state.alarms[state.alarms.length - 1] || {}
|
|
|
|
|
const arr = []
|
|
|
|
|
let reslist:any = {}
|
|
|
|
|
if(list.alarm_type == 'line_alarm'){
|
|
|
|
|
reslist.name = `线路${list?.no || 1}`
|
|
|
|
|
}else if(list.alarm_type == 'ai_alarm'){
|
|
|
|
|
reslist.name = `通道${list?.no || 1}`
|
|
|
|
|
} else if(list.alarm_type == 'operate_alarm'){
|
|
|
|
|
reslist.name = ''
|
|
|
|
|
}
|
|
|
|
|
reslist.typeName = list.type
|
|
|
|
|
reslist.content = list.content
|
|
|
|
|
reslist.time = list.time ? formatTime(list.time) : ''
|
|
|
|
|
reslist.level = list.level || ''
|
|
|
|
|
return [reslist]
|
2026-05-18 12:39:57 +08:00
|
|
|
})
|
2026-05-18 18:31:31 +08:00
|
|
|
function init(){
|
|
|
|
|
fetchChannelConfig().then(res => {
|
|
|
|
|
const list = res.ai_channel || []
|
|
|
|
|
list.forEach((item: any) => {
|
|
|
|
|
channelConfig.value[item.ch] = {
|
|
|
|
|
type: item.type,
|
|
|
|
|
limit_low: item.limit_low,
|
|
|
|
|
limit_high: item.limit_high,
|
|
|
|
|
line_no: item.line_no
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
2026-05-18 12:39:57 +08:00
|
|
|
onMounted(() => {
|
2026-05-18 18:31:31 +08:00
|
|
|
init()
|
2026-05-18 12:39:57 +08:00
|
|
|
void bootstrap()
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<div class="ai-container">
|
|
|
|
|
<div class="ai-container-top">
|
|
|
|
|
<div class="top-title">AI采集信息</div>
|
|
|
|
|
<div class="container-top-box">
|
|
|
|
|
<!-- 表格表头 -->
|
|
|
|
|
<div class="table-header">
|
|
|
|
|
<div class="header-cell" style="width: 90px;max-width: 90px;min-width: 90px;">通道号</div>
|
|
|
|
|
<div class="header-cell">原始值</div>
|
|
|
|
|
<div class="header-cell">所属路线</div>
|
|
|
|
|
<div class="header-cell">类别</div>
|
|
|
|
|
<div class="header-cell">低值</div>
|
2026-05-18 18:31:31 +08:00
|
|
|
<div class="header-cell">高值</div>
|
2026-05-18 12:39:57 +08:00
|
|
|
</div>
|
|
|
|
|
<!-- 表格内容 -->
|
|
|
|
|
<div class="table-body">
|
|
|
|
|
<div v-for="(item, index) in aiData" :key="index" class="table-row">
|
2026-05-18 18:31:31 +08:00
|
|
|
<div class="cell" style="width: 90px;max-width: 90px;min-width: 90px;color: #787878;">{{ item.ch }}
|
|
|
|
|
</div>
|
2026-05-18 12:39:57 +08:00
|
|
|
<div class="cell">{{ item.rawValue }}</div>
|
2026-05-18 18:31:31 +08:00
|
|
|
<div class="cell">线路{{ item.line_no }}</div>
|
|
|
|
|
<div class="cell">{{ item.type }}</div>
|
|
|
|
|
<div class="cell">{{ item.limit_low }}</div>
|
|
|
|
|
<div class="cell">{{ item.limit_high }}</div>
|
2026-05-18 12:39:57 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="ai-container-bottom">
|
|
|
|
|
<div class="top-title">报警信息</div>
|
|
|
|
|
<div class="container-bottom-box">
|
|
|
|
|
<div v-for="(item, index) in tableData" :key="index" class="container-bottom-box-line1">
|
|
|
|
|
<div style="width: 8%; text-align: center;">{{ index + 1 }}</div>
|
|
|
|
|
<div style="width: 23%; text-align: center;">{{ item.name }}</div>
|
|
|
|
|
<div style="width: 15%; text-align: center;">{{ item.typeName }}</div>
|
2026-05-18 18:31:31 +08:00
|
|
|
<div style="width: 10%; text-align: center;">{{ item.level }}</div>
|
2026-05-18 12:39:57 +08:00
|
|
|
<div style="width: 25%; text-align: center;">{{ item.content }}</div>
|
|
|
|
|
<div style="width: 20%; text-align: center;">{{ item.time }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
.ai-container {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
padding: 20px;
|
|
|
|
|
|
|
|
|
|
.top-title {
|
|
|
|
|
font-weight: 700;
|
|
|
|
|
font-style: normal;
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
color: #363636;
|
|
|
|
|
margin-bottom: 15px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.ai-container-top {
|
|
|
|
|
width: 100%;
|
|
|
|
|
margin-bottom: 25px;
|
|
|
|
|
|
|
|
|
|
.container-top-box {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 460px;
|
|
|
|
|
padding: 20px;
|
|
|
|
|
background: #ffffff;
|
|
|
|
|
box-shadow: 0px 0px 10px rgba(219, 225, 236, 1);
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
|
|
|
|
.table-header {
|
|
|
|
|
display: flex;
|
|
|
|
|
width: 100%;
|
|
|
|
|
margin-bottom: 5px;
|
|
|
|
|
gap: 5px;
|
|
|
|
|
|
|
|
|
|
.header-cell {
|
|
|
|
|
flex: 1;
|
|
|
|
|
height: 28px;
|
|
|
|
|
line-height: 28px;
|
|
|
|
|
background-color: #f8f9fc;
|
|
|
|
|
border: 1px solid #e8e8e8;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
color: #787878;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.table-body {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
gap: 5px;
|
2026-05-18 18:31:31 +08:00
|
|
|
|
2026-05-18 12:39:57 +08:00
|
|
|
.table-row {
|
|
|
|
|
display: flex;
|
|
|
|
|
width: 100%;
|
|
|
|
|
gap: 5px;
|
|
|
|
|
|
|
|
|
|
.cell {
|
|
|
|
|
flex: 1;
|
|
|
|
|
height: 28px;
|
|
|
|
|
line-height: 28px;
|
|
|
|
|
border: 1px solid #e8e8e8;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
color: #363636;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.ai-container-bottom {
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
|
|
|
|
.container-bottom-box {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: calc(100vh - 660px);
|
|
|
|
|
padding: 20px;
|
|
|
|
|
background: #ffffff;
|
|
|
|
|
box-shadow: 0px 0px 10px rgba(219, 225, 236, 1);
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
|
|
|
|
.container-bottom-box-line1 {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
color: #787878;
|
|
|
|
|
height: 40px;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
color: #505050;
|
|
|
|
|
border-bottom: 1px solid #f2f2f2;
|
|
|
|
|
|
|
|
|
|
&:last-child {
|
|
|
|
|
border-bottom: none;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|