消毒机设备
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.5 KiB

1 month ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
  1. import { defineStore } from 'pinia'
  2. import { ref } from 'vue'
  3. import { DEVICE_STATES } from '@/libs/utils'
  4. const initDeviceInfo = {
  5. appVersion: '',
  6. deviceId: '',
  7. deviceType: '',
  8. deviceTypeInited: '',
  9. ip: '',
  10. projectType: '',
  11. }
  12. const initState = {
  13. appEvents: [],
  14. loginUser: {
  15. isLogin: true,
  16. name: '',
  17. roleType: '',
  18. },
  19. state: DEVICE_STATES.IDLE,
  20. }
  21. const deviceTypeMap = {
  22. LargeSpaceDM: 'DT600N', // 大空间
  23. SmallSpaceDM: 'DT300N', // 小空间
  24. PipeDM: 'DT300W', // 管道式
  25. DrawBarDM: 'DT100N', // 拉杆箱
  26. LargeSpaceDM_B: 'DT600B', // 大空间标准(低成本)
  27. }
  28. export const useDeviceStore = defineStore('device', () => {
  29. const deviceInfo = ref<Device.DeviceInfo>(initDeviceInfo)
  30. // 使用deviceType区分是什么消毒机。低成本消毒机部署在移动pad,不显示软件键盘的开关。 拉杆消毒机是上位机显示软键盘
  31. // 暂时使用 deviceType : ture 表示 为低成本。
  32. const deviceState = ref<Device.State>(initState) // 设备状态
  33. /**
  34. * @function setDeviceState
  35. * @desc
  36. * @param info
  37. */
  38. const updateDeviceInfo = (info: Device.DeviceInfo) => {
  39. deviceInfo.value = info
  40. }
  41. /**
  42. * @function setDeviceState
  43. * @desc
  44. * @param state
  45. */
  46. const setDeviceState = (state: Device.State) => {
  47. deviceState.value = state
  48. }
  49. return {
  50. deviceTypeMap,
  51. deviceInfo,
  52. deviceState,
  53. updateDeviceInfo,
  54. setDeviceState,
  55. }
  56. })