Browse Source

设置

master
maochaoying 2 years ago
parent
commit
4df385c0d1
  1. 51
      src/components/Setting/components/Device.vue
  2. 41
      src/store/modules/setting.js

51
src/components/Setting/components/Device.vue

@ -139,15 +139,56 @@ const setAddliquidVal = () => {
showSuccessToast('设置成功') showSuccessToast('设置成功')
} }
const setStopedGsVal = () => {}
const setStopedGsVal = () => {
const val = parseInt(stoped_gs.value.substring(0, stoped_gs.value.length - 2))
settingStore.updateStopedGs(val)
webSocketStore.sendCommandMsg(setSettingValJSON('stoped_gs', stoped_gs.value))
showSuccessToast('设置成功')
}
const setcontinuedGsVal = () => {}
const setcontinuedGsVal = () => {
const val = parseInt(
continued_gs.value.substring(0, continued_gs.value.length - 2),
)
settingStore.updateContinuedGs(val)
webSocketStore.sendCommandMsg(
setSettingValJSON('continued_gs', continued_gs.value),
)
showSuccessToast('设置成功')
}
const setstopedSaturVal = () => {}
const setstopedSaturVal = () => {
const val = parseInt(
stoped_satur.value.substring(0, stoped_satur.value.length - 2),
)
settingStore.updateStopedSatur(val)
webSocketStore.sendCommandMsg(
setSettingValJSON('stoped_satur', stoped_satur.value),
)
showSuccessToast('设置成功')
}
const setContinuedSaturVal = () => {}
const setContinuedSaturVal = () => {
const val = parseInt(
continued_satur.value.substring(0, continued_satur.value.length - 2),
)
settingStore.updateContinuedSatur(val)
webSocketStore.sendCommandMsg(
setSettingValJSON('continued_satur', continued_satur.value),
)
showSuccessToast('设置成功')
}
const setMaxHumidityVal = () => {}
const setMaxHumidityVal = () => {
const val = parseInt(
max_humidity.value.substring(0, max_humidity.value.length - 2),
)
settingStore.updateMaxHumidity(val)
webSocketStore.sendCommandMsg(
setSettingValJSON('max_humidity', max_humidity.value),
)
showSuccessToast('设置成功')
}
const setSprayLiquidVal = () => { const setSprayLiquidVal = () => {
const val = parseInt( const val = parseInt(

41
src/store/modules/setting.js

@ -12,6 +12,11 @@ export const useSettingStore = defineStore({
addLiquidConfigVal: 0, addLiquidConfigVal: 0,
// 设置喷液泵的参数 // 设置喷液泵的参数
sprayLiquidConfigVal: 0, sprayLiquidConfigVal: 0,
max_humidity: 0,
continued_satur: 0,
stoped_satur: 0,
continued_gs: 0,
stoped_gs: 0,
// 首屏初始化 // 首屏初始化
initLoading: true, initLoading: true,
// 所有setting的对象数据 // 所有setting的对象数据
@ -20,7 +25,42 @@ export const useSettingStore = defineStore({
}, },
// actions // actions
actions: { actions: {
updateMaxHumidity(max_humidity) {
this.max_humidity = max_humidity
},
updateContinuedSatur(continued_satur) {
this.continued_satur = continued_satur
},
updateStopedSatur(stoped_satur) {
this.stoped_satur = stoped_satur
},
updateContinuedGs(continued_gs) {
this.continued_gs = continued_gs
},
updateStopedGs(stoped_gs) {
this.stoped_gs = stoped_gs
},
updateAllSettingList(allSettingList) { updateAllSettingList(allSettingList) {
const stoped_gsObj = allSettingList.filter(
item => item.name == 'stoped_gs',
)[0]
const continued_gsObj = allSettingList.filter(
item => item.name == 'continued_gs',
)[0]
const stoped_saturObj = allSettingList.filter(
item => item.name == 'stoped_satur',
)[0]
const continued_saturObj = allSettingList.filter(
item => item.name == 'continued_satur',
)[0]
const max_humidityObj = allSettingList.filter(
item => item.name == 'max_humidity',
)[0]
this.max_humidity = max_humidityObj.val
this.continued_satur = continued_saturObj.val
this.stoped_satur = stoped_saturObj.val
this.continued_gs = continued_gsObj.val
this.stoped_gs = stoped_gsObj.val
// 对当前数组进行处理 赋予给泵参数 // 对当前数组进行处理 赋予给泵参数
const addLiquid = allSettingList.filter( const addLiquid = allSettingList.filter(
item => item.name == 'drainage_pump_speed', item => item.name == 'drainage_pump_speed',
@ -28,6 +68,7 @@ export const useSettingStore = defineStore({
const sprayLiquid = allSettingList.filter( const sprayLiquid = allSettingList.filter(
item => item.name == 'injection_pump_speed', item => item.name == 'injection_pump_speed',
)[0] )[0]
this.addLiquidConfigVal = addLiquid.val this.addLiquidConfigVal = addLiquid.val
this.sprayLiquidConfigVal = sprayLiquid.val this.sprayLiquidConfigVal = sprayLiquid.val
this.allSettingList = allSettingList this.allSettingList = allSettingList

Loading…
Cancel
Save