| | |
| | | import { computed, onUnmounted } from 'vue' |
| | | import { computed } from 'vue' |
| | | import { defineStore } from 'pinia' |
| | | import { getDeviceList } from '@/api' |
| | | import { useRequest } from 'vue-hooks-plus' |
| | |
| | | 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 |
| | | }) |
| | | |
| | | /** |
| | |
| | | startDevicePolling() |
| | | } |
| | | |
| | | onUnmounted(() => { |
| | | cancelDevicePolling() |
| | | }) |
| | | |
| | | return { deviceInfo, startPollingDevice } |
| | | return { deviceInfo, startPollingDevice, currentDeviceAllowNoParams } |
| | | }) |