From c7f3fd5215399b37d0511b3bd555150ff1b13507 Mon Sep 17 00:00:00 2001
From: charles <981744753@qq.com>
Date: 星期一, 29 四月 2024 10:39:30 +0800
Subject: [PATCH] fix:回退原先版本

---
 src/stores/devices.ts |   29 ++++++++++++++++++-----------
 1 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/src/stores/devices.ts b/src/stores/devices.ts
index fb0fd53..0b71784 100644
--- a/src/stores/devices.ts
+++ b/src/stores/devices.ts
@@ -1,4 +1,4 @@
-import { computed, onUnmounted } from 'vue'
+import { computed } from 'vue'
 import { defineStore } from 'pinia'
 import { getDeviceList } from '@/api'
 import { useRequest } from 'vue-hooks-plus'
@@ -10,6 +10,14 @@
     return deviceRes?.value?.data as Devices
   })
 
+  // 褰撳墠璁惧鍦ㄧ己灏戝伐鑹哄弬鏁扮殑鏃跺�欐槸鍚﹀厑璁镐笅鍙戠敓浜�
+  const currentDeviceAllowNoParams = computed(() => {
+    const currentDeviceInfo = deviceInfo.value.deviceList?.find((ele) => {
+      return ele.deviceID === deviceInfo.value.currentDeviceID
+    })
+    return !currentDeviceInfo?.needSetProcessParams
+  })
+
   /**
    * 濡傛灉浠诲姟鐘舵�佹槸杩涜涓�, 鍒欒疆璇� plc 鍙栬繘搴�
    */
@@ -17,20 +25,19 @@
     data: deviceRes,
     run: startDevicePolling,
     cancel: cancelDevicePolling
-  } = useRequest(getDeviceList, {
-    manual: true,
-    pollingInterval: DEVICE_INFO_POLLING_DURATION,
-    pollingWhenHidden: false
-  })
+  } = useRequest(
+    getDeviceList
+    //   {
+    //   manual: true,
+    //   pollingInterval: DEVICE_INFO_POLLING_DURATION,
+    //   pollingWhenHidden: false
+    // }
+  )
 
   function startPollingDevice() {
     cancelDevicePolling()
     startDevicePolling()
   }
 
-  onUnmounted(() => {
-    cancelDevicePolling()
-  })
-
-  return { deviceInfo, startPollingDevice }
+  return { deviceInfo, startPollingDevice, currentDeviceAllowNoParams }
 })

--
Gitblit v1.8.0