大空间消毒机
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.

105 lines
3.1 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. import { defineStore } from 'pinia'
  2. import moment from 'moment'
  3. export const useSettingStore = defineStore({
  4. id: 'setting', // id必填,且需要唯一
  5. // state
  6. state: () => {
  7. return {
  8. // 设置当前日期
  9. currentDate: moment().format('YYYY-MM-DD').split('-'),
  10. // 设置当前时间
  11. currentTime: moment().utcOffset(8).format('HH:mm').split(':'),
  12. // 设置加液泵的参数
  13. addLiquidConfigVal: 0,
  14. // 设置喷液泵的参数
  15. sprayLiquidConfigVal: 0,
  16. max_humidity: 0,
  17. continued_satur: 0,
  18. stoped_satur: 0,
  19. pre_heat_time_s: 0,
  20. continued_gs: 0,
  21. stoped_gs: 0,
  22. // 首屏初始化
  23. initLoading: true,
  24. // 所有setting的对象数据
  25. allSettingList: [],
  26. deviceIp: '127.0.0.1',
  27. }
  28. },
  29. // actions
  30. actions: {
  31. updatePre_heat_time_s(pre_heat_time_s) {
  32. this.pre_heat_time_s = pre_heat_time_s
  33. },
  34. updateDeviceIp(deviceIp) {
  35. this.deviceIp = deviceIp
  36. },
  37. updateMaxHumidity(max_humidity) {
  38. this.max_humidity = max_humidity
  39. },
  40. updateContinuedSatur(continued_satur) {
  41. this.continued_satur = continued_satur
  42. },
  43. updateStopedSatur(stoped_satur) {
  44. this.stoped_satur = stoped_satur
  45. },
  46. updateContinuedGs(continued_gs) {
  47. this.continued_gs = continued_gs
  48. },
  49. updateStopedGs(stoped_gs) {
  50. this.stoped_gs = stoped_gs
  51. },
  52. updateAllSettingList(allSettingList) {
  53. const stoped_gsObj = allSettingList.filter(
  54. item => item.name == 'stoped_gs',
  55. )[0]
  56. const continued_gsObj = allSettingList.filter(
  57. item => item.name == 'continued_gs',
  58. )[0]
  59. const stoped_saturObj = allSettingList.filter(
  60. item => item.name == 'stoped_satur',
  61. )[0]
  62. const continued_saturObj = allSettingList.filter(
  63. item => item.name == 'continued_satur',
  64. )[0]
  65. const max_humidityObj = allSettingList.filter(
  66. item => item.name == 'max_humidity',
  67. )[0]
  68. const pre_heat_time_sOBj = allSettingList.filter(
  69. item => item.name == 'pre_heat_time_s',
  70. )[0]
  71. this.pre_heat_time_s = pre_heat_time_sOBj.val
  72. this.max_humidity = max_humidityObj.val
  73. this.continued_satur = continued_saturObj.val
  74. this.stoped_satur = stoped_saturObj.val
  75. this.continued_gs = continued_gsObj.val
  76. this.stoped_gs = stoped_gsObj.val
  77. // 对当前数组进行处理 赋予给泵参数
  78. const addLiquid = allSettingList.filter(
  79. item => item.name == 'drainage_pump_speed',
  80. )[0]
  81. const sprayLiquid = allSettingList.filter(
  82. item => item.name == 'injection_pump_speed',
  83. )[0]
  84. this.addLiquidConfigVal = addLiquid.val
  85. this.sprayLiquidConfigVal = sprayLiquid.val
  86. this.allSettingList = allSettingList
  87. },
  88. updateInitLoading() {
  89. this.initLoading = false
  90. },
  91. updateCurrentDate(currentDate) {
  92. this.currentDate = currentDate
  93. },
  94. updateCurrentTime(currentTime) {
  95. this.currentTime = currentTime
  96. },
  97. changeAddLiquidConfigVal(val) {
  98. this.addLiquidConfigVal = val
  99. },
  100. changeSprayLiquidConfigVal(val) {
  101. this.sprayLiquidConfigVal = val
  102. },
  103. },
  104. })