From 7ebf9752b95f98865bf94469b58c5abb302a69dd Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期六, 09 十二月 2023 14:45:45 +0800
Subject: [PATCH] 点击当前工序完成的时增加当前时间和任务详情中实际开始时间对比,如果小于60s增加提示并且不请求接口

---
 src/stores/devices.ts |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/stores/devices.ts b/src/stores/devices.ts
index 4c74113..e0f81ef 100644
--- a/src/stores/devices.ts
+++ b/src/stores/devices.ts
@@ -1,12 +1,21 @@
-import { computed, onUnmounted } from 'vue'
+import { computed } from 'vue'
 import { defineStore } from 'pinia'
 import { getDeviceList } from '@/api'
 import { useRequest } from 'vue-hooks-plus'
 import type { Devices } from '@/api/device'
+import { DEVICE_INFO_POLLING_DURATION } from '@/common/constants'
 
 export const useDevicesStore = defineStore('device', () => {
   const deviceInfo = computed(() => {
     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
   })
 
   /**
@@ -18,7 +27,7 @@
     cancel: cancelDevicePolling
   } = useRequest(getDeviceList, {
     manual: true,
-    pollingInterval: 6000,
+    pollingInterval: DEVICE_INFO_POLLING_DURATION,
     pollingWhenHidden: false
   })
 
@@ -27,9 +36,5 @@
     startDevicePolling()
   }
 
-  onUnmounted(() => {
-    cancelDevicePolling()
-  })
-
-  return { deviceInfo, startPollingDevice }
+  return { deviceInfo, startPollingDevice, currentDeviceAllowNoParams }
 })

--
Gitblit v1.8.0