新型管道消毒机前端代码
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.

135 lines
4.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
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. stoped_humi: '0',
  24. // 消毒继续相对湿度
  25. continued_humi: '0',
  26. // 首屏初始化
  27. initLoading: true,
  28. // 所有setting的对象数据
  29. allSettingList: [],
  30. deviceIp: '127.0.0.1',
  31. chargingPumpRPM: 0,
  32. sprinklerPumpRPM: 0,
  33. sprinklerPumpGPM: 0,
  34. }
  35. },
  36. // actions
  37. actions: {
  38. updateSprinklerPumpGPM(sprinklerPumpGPM) {
  39. this.sprinklerPumpGPM = sprinklerPumpGPM
  40. },
  41. updateChargingPumpRPM(chargingPumpRPM) {
  42. this.chargingPumpRPM = chargingPumpRPM
  43. },
  44. updateSprinklerPumpRPM(sprinklerPumpRPM) {
  45. this.sprinklerPumpRPM = sprinklerPumpRPM
  46. },
  47. updateStopedHumi(stoped_humi) {
  48. this.stoped_humi = stoped_humi
  49. },
  50. updateContinuedHumi(continued_humi) {
  51. this.continued_humi = continued_humi
  52. },
  53. updatePre_heat_time_s(pre_heat_time_s) {
  54. this.pre_heat_time_s = pre_heat_time_s
  55. },
  56. updateDeviceIp(deviceIp) {
  57. this.deviceIp = deviceIp
  58. },
  59. updateMaxHumidity(max_humidity) {
  60. this.max_humidity = max_humidity
  61. },
  62. updateContinuedSatur(continued_satur) {
  63. this.continued_satur = continued_satur
  64. },
  65. updateStopedSatur(stoped_satur) {
  66. this.stoped_satur = stoped_satur
  67. },
  68. updateContinuedGs(continued_gs) {
  69. this.continued_gs = continued_gs
  70. },
  71. updateStopedGs(stoped_gs) {
  72. this.stoped_gs = stoped_gs
  73. },
  74. updateAllSettingList(allSettingList) {
  75. const stoped_humiObj = allSettingList.filter(
  76. item => item.name == 'stoped_humi',
  77. )[0]
  78. const continued_humiObj = allSettingList.filter(
  79. item => item.name == 'continued_humi',
  80. )[0]
  81. this.stoped_humi = stoped_humiObj.val
  82. this.continued_humi = continued_humiObj.val
  83. const stoped_gsObj = allSettingList.filter(
  84. item => item.name == 'stoped_gs',
  85. )[0]
  86. const continued_gsObj = allSettingList.filter(
  87. item => item.name == 'continued_gs',
  88. )[0]
  89. const stoped_saturObj = allSettingList.filter(
  90. item => item.name == 'stoped_satur',
  91. )[0]
  92. const continued_saturObj = allSettingList.filter(
  93. item => item.name == 'continued_satur',
  94. )[0]
  95. const max_humidityObj = allSettingList.filter(
  96. item => item.name == 'max_humidity',
  97. )[0]
  98. const pre_heat_time_sOBj = allSettingList.filter(
  99. item => item.name == 'pre_heat_time_s',
  100. )[0]
  101. this.pre_heat_time_s = pre_heat_time_sOBj.val
  102. this.max_humidity = max_humidityObj.val
  103. this.continued_satur = continued_saturObj.val
  104. this.stoped_satur = stoped_saturObj.val
  105. this.continued_gs = continued_gsObj.val
  106. this.stoped_gs = stoped_gsObj.val
  107. // 对当前数组进行处理 赋予给泵参数
  108. const addLiquid = allSettingList.filter(
  109. item => item.name == 'drainage_pump_speed',
  110. )[0]
  111. const sprayLiquid = allSettingList.filter(
  112. item => item.name == 'injection_pump_speed',
  113. )[0]
  114. this.addLiquidConfigVal = addLiquid.val
  115. this.sprayLiquidConfigVal = sprayLiquid.val
  116. this.allSettingList = allSettingList
  117. },
  118. updateInitLoading() {
  119. this.initLoading = false
  120. },
  121. updateCurrentDate(currentDate) {
  122. this.currentDate = currentDate
  123. },
  124. updateCurrentTime(currentTime) {
  125. this.currentTime = currentTime
  126. },
  127. changeAddLiquidConfigVal(val) {
  128. this.addLiquidConfigVal = val
  129. },
  130. changeSprayLiquidConfigVal(val) {
  131. this.sprayLiquidConfigVal = val
  132. },
  133. },
  134. })