From 3a3cc473c33cb4a97399ace76a1b35e9ffd68525 Mon Sep 17 00:00:00 2001
From: songshankun <songshankun@foxmail.com>
Date: 星期一, 20 十一月 2023 16:45:17 +0800
Subject: [PATCH] feat: 无任务选中通道时从p[lc读取统计

---
 src/stores/plc.ts |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/stores/plc.ts b/src/stores/plc.ts
index 50e7926..88d0122 100644
--- a/src/stores/plc.ts
+++ b/src/stores/plc.ts
@@ -5,6 +5,7 @@
 import { useRequest } from 'vue-hooks-plus'
 import { useTasksStore } from '@/stores/tasks'
 import type { PLCResponse } from '@/api/plc'
+import { PLC_POLLING_DURATION } from '@/common/constants'
 
 // 鍏ㄥ眬 watcher ref 闃叉澶氭璋冪敤 usePLCStore 鏃堕噸澶嶆敞鍐屼睛鍚櫒
 const unwatch = ref()
@@ -26,12 +27,11 @@
   } = useRequest(
     () =>
       getProductProgress({
-        channel: taskStore.activeTask?.Channel,
-        procedureId: taskStore.activeTask?.Procedure.ID
+        channel: taskStore.activeChannel ?? 0
       } as ProductProgressParams),
     {
       manual: true,
-      pollingInterval: 6000,
+      pollingInterval: PLC_POLLING_DURATION,
       pollingWhenHidden: false
     }
   )
@@ -41,7 +41,7 @@
      * 濡傛灉鍒囨崲鍒板叾浠栭�氶亾鐨勪换鍔�,鍒欓噸鏂拌疆璇lc
      */
     unwatch.value = watch(
-      () => taskStore.activeTask?.Channel,
+      () => taskStore.activeChannel,
       () => {
         cancelPLCPolling()
         startPLCPolling()

--
Gitblit v1.8.0