charles
2024-04-29 c7f3fd5215399b37d0511b3bd555150ff1b13507
src/stores/devices.ts
@@ -7,10 +7,15 @@
export const useDevicesStore = defineStore('device', () => {
  const deviceInfo = computed(() => {
    if (deviceInfo?.value) {
      deviceRes.value.data.currentDeviceID = 'wwwwwwww222222'
    }
    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
  })
  /**
@@ -20,16 +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()
  }
  return { deviceInfo, startPollingDevice }
  return { deviceInfo, startPollingDevice, currentDeviceAllowNoParams }
})