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

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