From f4e6a890da2884777281031a9c736c7659c2a74a Mon Sep 17 00:00:00 2001
From: dongyukun <1208714201@qq.com>
Date: 星期四, 02 一月 2025 14:20:04 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/views/data/channel/opcda/tag/index.vue |   53 +++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 51 insertions(+), 2 deletions(-)

diff --git a/src/views/data/channel/opcda/tag/index.vue b/src/views/data/channel/opcda/tag/index.vue
index cfd1c01..fc11b57 100644
--- a/src/views/data/channel/opcda/tag/index.vue
+++ b/src/views/data/channel/opcda/tag/index.vue
@@ -1,7 +1,7 @@
 <template>
   <el-drawer
     v-model="drawer"
-    size="50%"
+    size="60%"
     title="OpcDA Tag"
     :direction="direction"
     :before-close="handleClose"
@@ -58,6 +58,12 @@
             <Icon icon="ep:download" />导出
           </el-button>
         </el-form-item>
+        <el-form-item label="更新当前值" label-width="100px">
+          <el-switch
+            v-model="queryParams.currentValue"
+            active-color="#13ce66"
+            inactive-color="#ff4949"/>
+        </el-form-item>
       </el-form>
     </ContentWrap>
     <!-- 列表 -->
@@ -87,6 +93,27 @@
             <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"
+          min-width="100"
+          :formatter="(row) => {if (row.dataValue === -2.0) {return '--';}return row.dataValue;}"
+        />
+        <el-table-column
+          prop="dataTime"
+          label="数据时间"
+          header-align="center"
+          align="center"
+          min-width="150"
+        />
+        <el-table-column
+          prop="dataQuality"
+          label="数据质量"
+          header-align="center"
+          align="center"
+        />
         <el-table-column label="操作" align="center" min-width="110" fixed="right">
           <template #default="scope">
             <el-button
@@ -128,6 +155,7 @@
   import download from "@/utils/download";
   import {ref,reactive} from "vue";
   import TagImportForm from '../../common/tag/TagImportForm.vue'
+  import {onBeforeUnmount, onMounted} from "vue";
 
   defineOptions({name: 'ModBusTag'})
 
@@ -144,10 +172,12 @@
     pageSize: 10,
     serverId: undefined,
     tagName: undefined,
-    serverName: undefined
+    serverName: undefined,
+    currentValue:false,
   })
   const queryFormRef = ref() // 搜索的表单
   const exportLoading = ref(false) // 导出的加载中
+
   /** 查询列表 */
   const getList = async () => {
     loading.value = true
@@ -238,4 +268,23 @@
       exportLoading.value = false
     }
   }
+  let intervalId;
+
+  onMounted(async () => {
+    // 创建定时器
+    intervalId = setInterval(async () => {
+      if(queryParams.currentValue){
+        const page = await OpcDaTagApi.getOpcdaTagPage(queryParams)
+        list.value = page.list
+        total.value = page.total
+      }
+    }, 10000);
+  });
+
+  // 在组件卸载时清除定时器
+  onBeforeUnmount(() => {
+    if (intervalId) {
+      clearInterval(intervalId);
+    }
+  });
 </script>

--
Gitblit v1.9.3