feat:采集设备-添加设备告警历史数据弹框

main
黄伟杰 1 week ago
parent 66799688e7
commit 65be06eaf9

@ -163,8 +163,15 @@ link :type="isRowConnected(scope.row) ? 'warning' : 'success'"
<!-- 子表的列表 -->
<ContentWrap>
<template v-if="attributeDeviceId">
<div class="mb-10px text-sm text-gray-500">
当前设备<span class="font-medium text-gray-700">{{ attributeDeviceName || '-' }}</span>
<div class="mb-10px flex items-center justify-between text-sm text-gray-500">
<div>
当前设备<span class="font-medium text-gray-700">{{ attributeDeviceName || '-' }}</span>
</div>
<div>
<el-button type="primary" link @click="handleShowDeviceAlarmHistory">
设备告警历史数据
</el-button>
</div>
</div>
<el-tabs v-model="deviceTabActive">
<el-tab-pane :label="deviceAttributeTabLabel" name="deviceAttribute">
@ -451,6 +458,25 @@ link :type="isRowConnected(scope.row) ? 'warning' : 'success'"
</template>
<el-empty v-else description="请点击设备列表的“点位”查看采集点和点位规则" />
</ContentWrap>
<Dialog title="设备告警历史数据" v-model="deviceAlarmDialogVisible" width="800px">
<el-table
:data="deviceAlarmList"
v-loading="deviceAlarmLoading"
:stripe="true"
:show-overflow-tooltip="true"
:max-height="700"
>
<el-table-column label="规则名称" align="center" prop="ruleName" />
<el-table-column label="点位名称" align="center" prop="modelName" />
<el-table-column label="点位值" align="center" prop="addressValue" />
<el-table-column label="告警等级" align="center" prop="alarmLevel">
<template #default="scope">
<dict-tag :type="DICT_TYPE.IOT_ALARM_REGISTRATION" :value="scope.row.alarmLevel" />
</template>
</el-table-column>
</el-table>
</Dialog>
</template>
<script setup lang="ts">
@ -1047,4 +1073,27 @@ onBeforeUnmount(() => {
stopDeviceTimer()
})
const deviceAlarmDialogVisible = ref(false)
const deviceAlarmLoading = ref(false)
const deviceAlarmList = ref<any[]>([])
const handleShowDeviceAlarmHistory = async () => {
if (!attributeDeviceId.value) {
message.error('请选择一个物联设备')
return
}
deviceAlarmDialogVisible.value = true
deviceAlarmLoading.value = true
try {
const res = await request.get({
url: '/iot/device-warinning-record/getList',
params: { deviceId: attributeDeviceId.value },
})
const data = (res as any)?.data ?? res
deviceAlarmList.value = Array.isArray(data) ? data : []
} finally {
deviceAlarmLoading.value = false
}
}
</script>

Loading…
Cancel
Save