消毒机设备
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.

50 lines
1.1 KiB

  1. import { sendCmd } from 'apis/system'
  2. import { defineStore } from 'pinia'
  3. import { ref } from 'vue'
  4. /**
  5. *
  6. * @module useHomeStore
  7. */
  8. interface gasPathSwitcher {
  9. gasPathSwitcher: gasPathSwitcher
  10. path: string
  11. }
  12. interface gasPathSwitcher {
  13. isOnline: boolean
  14. }
  15. export const useGasStore = defineStore('gas', () => {
  16. // 状态定义
  17. const channelSwitcherMap = ['degradation', 'disinfection', 'dehumidification']
  18. const isOnline = ref<true | false>(false)
  19. const currentChannel = ref<string | null>(null)
  20. /**
  21. *
  22. */
  23. const selectChannel = async (data: string) => {
  24. const defaultParams = {
  25. className: 'DMGasPathMgrService',
  26. fnName: 'selectChannel',
  27. params: {
  28. dmGasPath: data,
  29. },
  30. }
  31. return await sendCmd(defaultParams)
  32. }
  33. /**
  34. * 线
  35. */
  36. const updateChannelByReport = (data: gasPathSwitcher) => {
  37. isOnline.value = data.gasPathSwitcher.isOnline
  38. currentChannel.value = data.path
  39. }
  40. return {
  41. channelSwitcherMap,
  42. currentChannel,
  43. isOnline,
  44. selectChannel,
  45. updateChannelByReport,
  46. }
  47. })