From 233cfaa19011f49947677bc3794e7fc1dbae40c5 Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期五, 08 十一月 2024 10:34:49 +0800 Subject: [PATCH] 计划数据集 --- src/views/data/channel/opcua/tag/index.vue | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 44 insertions(+), 2 deletions(-) diff --git a/src/views/data/channel/opcua/tag/index.vue b/src/views/data/channel/opcua/tag/index.vue index 3f48f5b..524f4b5 100644 --- a/src/views/data/channel/opcua/tag/index.vue +++ b/src/views/data/channel/opcua/tag/index.vue @@ -108,6 +108,24 @@ <el-tag v-else size="small" type="danger">否</el-tag> </template> </el-table-column> + <el-table-column + prop="dataValue" + label="数据值" + header-align="center" + align="center" + :formatter="(row) => {if (row.dataValue === -2.0) {return '--';}return row.dataValue;}" + /> + <el-table-column + prop="quality" + label="数据质量" + header-align="center" + align="center" + > + <template #default="scope"> + <el-tag v-if="scope.row.dataValue === Number(-2.0)" type="danger" size="small">bad</el-tag> + <el-tag v-else size="small">good</el-tag> + </template> + </el-table-column> <el-table-column label="操作" align="center" min-width="110" fixed="right"> <template #default="scope"> <el-button @@ -147,8 +165,9 @@ import * as OpcUaTagApi from "@/api/data/channel/opcua/tag"; import TagForm from './TagForm.vue' import download from "@/utils/download"; - import {ref,reactive} from "vue"; + import {ref, reactive, onMounted, onBeforeUnmount} from "vue"; import TagImportForm from '../../common/tag/TagImportForm.vue' + import * as OpcdaTagApi from "@/api/data/channel/opcda/tag"; defineOptions({name: 'OpcuaTag'}) @@ -164,7 +183,9 @@ pageNo: 1, pageSize: 10, device: undefined, + deviceId: undefined, tagName: undefined, + currentValue:false, address: undefined }) const queryFormRef = ref() // 搜索的表单 @@ -215,10 +236,11 @@ } /** 打开弹窗 */ - const open = async (device?: string) => { + const open = async (deviceId?: string,device?: string) => { resetForm() drawer.value = true queryParams.device = device + queryParams.deviceId = deviceId if (device) { getList() } @@ -260,4 +282,24 @@ exportLoading.value = false } } + + let intervalId; + + onMounted(async () => { + // 创建定时器 + intervalId = setInterval(async () => { + if(queryParams.currentValue){ + const page = await OpcUaTagApi.getOpcuaTagPage(queryParams) + list.value = page.list + total.value = page.total + } + }, 10000); + }); + + // 在组件卸载时清除定时器 + onBeforeUnmount(() => { + if (intervalId) { + clearInterval(intervalId); + } + }); </script> -- Gitblit v1.9.3