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

112 lines
2.4 KiB

1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
3 weeks ago
  1. import { defineStore } from 'pinia'
  2. import { ref } from 'vue'
  3. import { syncSendCmd } from '@/apis/system'
  4. export const useSystemStore = defineStore('system', () => {
  5. const websocketConnected = ref(true)
  6. const systemUser = ref({
  7. username: '',
  8. })
  9. const loginForm = ref({
  10. name: import.meta.env.FT_NODE_ENV !== 'prod' ? 'admin' : '',
  11. pwd: import.meta.env.FT_NODE_ENV !== 'prod' ? '9973' : '',
  12. })
  13. const languages = [{
  14. name: '中文',
  15. value: 'zh-cn',
  16. }, {
  17. name: 'English',
  18. value: 'en',
  19. }]
  20. const menuExpand = true
  21. const isDebug = import.meta.env.FT_NODE_ENV !== 'prod'
  22. const streamVisible = false
  23. const systemList = ref([])
  24. const loading = ref(false)
  25. const updateLoading = (loadVal: boolean) => {
  26. loading.value = loadVal
  27. // setTimeout(() => {
  28. // loading.value = false
  29. // }, 1500)
  30. }
  31. const updateConnected = (isConnected: boolean) => {
  32. websocketConnected.value = isConnected
  33. }
  34. /**
  35. * @function subscribeDisinfectEvent
  36. * @desc
  37. */
  38. const subscribeDisinfectEvent = async () => {
  39. // 发起订阅
  40. const subParams = {
  41. className: 'DisinfectionCtrlServiceExt',
  42. fnName: 'startStateReport',
  43. }
  44. syncSendCmd(subParams)
  45. }
  46. /**
  47. * @function subscribeAddLiquidEvent
  48. * @desc
  49. */
  50. const subscribeAddLiquidEvent = async () => {
  51. // 发起订阅
  52. const subParams = {
  53. className: 'AddLiquidService',
  54. fnName: 'startStateReport',
  55. }
  56. syncSendCmd(subParams)
  57. }
  58. /**
  59. * @function subscribeDrainLiquidEvent
  60. * @desc
  61. */
  62. const subscribeDrainLiquidEvent = async () => {
  63. // 发起订阅
  64. const subParams = {
  65. className: 'DrainLiquidService',
  66. fnName: 'startStateReport',
  67. }
  68. syncSendCmd(subParams)
  69. }
  70. /**
  71. * @function subscribeSealEvent
  72. * @desc
  73. */
  74. const subscribeSealEvent = async () => {
  75. // 执行订阅
  76. const subParams = {
  77. className: 'AirLeakDetectTest',
  78. fnName: 'startStateReport',
  79. }
  80. syncSendCmd(subParams)
  81. }
  82. return {
  83. systemUser,
  84. loginForm,
  85. languages,
  86. menuExpand,
  87. isDebug,
  88. streamVisible,
  89. systemList,
  90. loading,
  91. websocketConnected,
  92. updateLoading,
  93. updateConnected,
  94. subscribeDisinfectEvent,
  95. subscribeAddLiquidEvent,
  96. subscribeDrainLiquidEvent,
  97. subscribeSealEvent,
  98. }
  99. })