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

123 lines
3.7 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
  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. }
  32. },
  33. // actions
  34. actions: {
  35. updateStopedHumi(stoped_humi) {
  36. this.stoped_humi = stoped_humi
  37. },
  38. updateContinuedHumi(continued_humi) {
  39. this.continued_humi = continued_humi
  40. },
  41. updatePre_heat_time_s(pre_heat_time_s) {
  42. this.pre_heat_time_s = pre_heat_time_s
  43. },
  44. updateDeviceIp(deviceIp) {
  45. this.deviceIp = deviceIp
  46. },
  47. updateMaxHumidity(max_humidity) {
  48. this.max_humidity = max_humidity
  49. },
  50. updateContinuedSatur(continued_satur) {
  51. this.continued_satur = continued_satur
  52. },
  53. updateStopedSatur(stoped_satur) {
  54. this.stoped_satur = stoped_satur
  55. },
  56. updateContinuedGs(continued_gs) {
  57. this.continued_gs = continued_gs
  58. },
  59. updateStopedGs(stoped_gs) {
  60. this.stoped_gs = stoped_gs
  61. },
  62. updateAllSettingList(allSettingList) {
  63. const stoped_humiObj = allSettingList.filter(
  64. item => item.name == 'stoped_humi',
  65. )[0]
  66. const continued_humiObj = allSettingList.filter(
  67. item => item.name == 'continued_humi',
  68. )[0]
  69. this.stoped_humi = stoped_humiObj.val
  70. this.continued_humi = continued_humiObj.val
  71. const stoped_gsObj = allSettingList.filter(
  72. item => item.name == 'stoped_gs',
  73. )[0]
  74. const continued_gsObj = allSettingList.filter(
  75. item => item.name == 'continued_gs',
  76. )[0]
  77. const stoped_saturObj = allSettingList.filter(
  78. item => item.name == 'stoped_satur',
  79. )[0]
  80. const continued_saturObj = allSettingList.filter(
  81. item => item.name == 'continued_satur',
  82. )[0]
  83. const max_humidityObj = allSettingList.filter(
  84. item => item.name == 'max_humidity',
  85. )[0]
  86. const pre_heat_time_sOBj = allSettingList.filter(
  87. item => item.name == 'pre_heat_time_s',
  88. )[0]
  89. this.pre_heat_time_s = pre_heat_time_sOBj.val
  90. this.max_humidity = max_humidityObj.val
  91. this.continued_satur = continued_saturObj.val
  92. this.stoped_satur = stoped_saturObj.val
  93. this.continued_gs = continued_gsObj.val
  94. this.stoped_gs = stoped_gsObj.val
  95. // 对当前数组进行处理 赋予给泵参数
  96. const addLiquid = allSettingList.filter(
  97. item => item.name == 'drainage_pump_speed',
  98. )[0]
  99. const sprayLiquid = allSettingList.filter(
  100. item => item.name == 'injection_pump_speed',
  101. )[0]
  102. this.addLiquidConfigVal = addLiquid.val
  103. this.sprayLiquidConfigVal = sprayLiquid.val
  104. this.allSettingList = allSettingList
  105. },
  106. updateInitLoading() {
  107. this.initLoading = false
  108. },
  109. updateCurrentDate(currentDate) {
  110. this.currentDate = currentDate
  111. },
  112. updateCurrentTime(currentTime) {
  113. this.currentTime = currentTime
  114. },
  115. changeAddLiquidConfigVal(val) {
  116. this.addLiquidConfigVal = val
  117. },
  118. changeSprayLiquidConfigVal(val) {
  119. this.sprayLiquidConfigVal = val
  120. },
  121. },
  122. })