diff --git a/src/components/DisinfectionSetting.vue b/src/components/DisinfectionSetting.vue index 1209ffd..893a530 100644 --- a/src/components/DisinfectionSetting.vue +++ b/src/components/DisinfectionSetting.vue @@ -1,11 +1,11 @@ diff --git a/src/components/UpdatePreSetting.vue b/src/components/UpdatePreSetting.vue index 0fab9de..b1a3199 100644 --- a/src/components/UpdatePreSetting.vue +++ b/src/components/UpdatePreSetting.vue @@ -734,7 +734,6 @@ onMounted(() => { document.addEventListener('click', e => { let box = document.getElementById('keyboard_formula') let room = document.getElementById('id_formula') - let fontBox = document.getElementsByClassName('hg-candidate-box') if (!box?.contains(e.target) && e.target != room) { showkeyboard.value = false } diff --git a/src/components/dialogs/ClearAuditModal.vue b/src/components/dialogs/ClearAuditModal.vue index 7940e17..f7c47b2 100644 --- a/src/components/dialogs/ClearAuditModal.vue +++ b/src/components/dialogs/ClearAuditModal.vue @@ -31,7 +31,7 @@ diff --git a/src/components/dialogs/ClearRecordModal.vue b/src/components/dialogs/ClearRecordModal.vue index 36dc6d8..85210bd 100644 --- a/src/components/dialogs/ClearRecordModal.vue +++ b/src/components/dialogs/ClearRecordModal.vue @@ -31,7 +31,7 @@ diff --git a/src/mock/command.js b/src/mock/command.js index f32cc71..6501f34 100644 --- a/src/mock/command.js +++ b/src/mock/command.js @@ -284,9 +284,14 @@ export const startFormulaJSON = id => { export const updateSettingInRunInfectionJSON = (column, val) => { return { - command: 'updateFormula', - messageId: 'updateFormula', + command: 'changeDisinfectionParameter', + messageId: 'changeDisinfectionParameter', column, val, } } + +export const getDisinfectionConfigJSON = { + command: 'getDisinfectionConfig', + messageId: 'getDisinfectionConfig', +} diff --git a/src/pages/Home.vue b/src/pages/Home.vue index ff03c35..8baccac 100644 --- a/src/pages/Home.vue +++ b/src/pages/Home.vue @@ -339,6 +339,7 @@ import { getStateJSON, getAllSettingJSON, getAllUserJSON, + getDisinfectionConfigJSON, } from '@/mock/command' import { useRouter } from 'vue-router' @@ -386,6 +387,7 @@ const onChange = a => { const changeTab = index => { if (index == 5) { // 判断是否为管理员登陆 如果为管理员直接显示, + webSocketStore.sendCommandMsg(getDisinfectionConfigJSON) if (userStore.loginUserPermission == 3) { // 非管理员 // 如果不为管理员 则弹出登陆框 diff --git a/src/store/index.js b/src/store/index.js index 4a87397..14e2bce 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -9,6 +9,7 @@ import { useEchartsStore } from './modules/echarts' import { usePreStore } from './modules/preinstall' import { useAuditStore } from './modules/audit' import { useFormulaStore } from './modules/formula' +import { useRunningStore } from './modules/running' const store = createPinia() export default store @@ -16,6 +17,7 @@ export { useTestStore, useFormulaStore, useAuditStore, + useRunningStore, useSettingStore, useOperatorStore, useWebSocketStore, diff --git a/src/store/modules/running.js b/src/store/modules/running.js new file mode 100644 index 0000000..1fcf05e --- /dev/null +++ b/src/store/modules/running.js @@ -0,0 +1,30 @@ +import { defineStore } from 'pinia' +export const useRunningStore = defineStore({ + id: 'running', // id必填,且需要唯一 + // state + state: () => { + return { + sprayLiquidConfigVal: '0', + stoped_humi: '0', + continued_humi: '0', + continued_satur: '0', + stoped_satur: '0', + continued_gs: '0', + stoped_gs: '0', + disinfectionConfig: {}, + } + }, + // actions + actions: { + updateDisinfectionConfig(disinfectionConfig) { + this.sprayLiquidConfigVal = disinfectionConfig.injection_pump_speed + '' + this.stoped_humi = disinfectionConfig.stoped_humi + '' + this.continued_humi = disinfectionConfig.continued_humi + '' + this.continued_satur = disinfectionConfig.continued_satur + '' + this.stoped_satur = disinfectionConfig.stoped_satur + '' + this.continued_gs = disinfectionConfig.continued_gs + '' + this.stoped_gs = disinfectionConfig.stoped_gs + '' + this.disinfectionConfig = disinfectionConfig + }, + }, +}) diff --git a/src/store/modules/websocket.js b/src/store/modules/websocket.js index 5b3f81a..526312e 100644 --- a/src/store/modules/websocket.js +++ b/src/store/modules/websocket.js @@ -9,6 +9,7 @@ import { useTestStore } from './test' import { useAuditStore } from './audit' import { useFormulaStore } from './formula' import { useEchartsStore } from './echarts' +import { useRunningStore } from './running' import { showSuccessToast, showFailToast } from 'vant' import { saveEchartsDataToLocal } from '@/utils' @@ -36,6 +37,7 @@ export const useWebSocketStore = defineStore({ const echartsStore = useEchartsStore() const auditStore = useAuditStore() const formulaStore = useFormulaStore() + const runningStore = useRunningStore() init.connect() init.ws.onmessage = function (ev) { const { ackcode, messageId, timeStamp } = JSON.parse(ev.data) @@ -85,6 +87,7 @@ export const useWebSocketStore = defineStore({ sprinklerPumpGPM, } = sensor_data const { nowlog } = disinfectionState || {} + deviceStore.updateNowLog(nowlog) if ([1, 2, 3, 4].includes(disinfectionWorkState)) { operatorStore.updateShowStartReady(false) @@ -194,6 +197,10 @@ export const useWebSocketStore = defineStore({ auditStore.updateTotal(total) auditStore.updatePage(page) break + case 'getDisinfectionConfig': + const { disinfectionConfig } = JSON.parse(ev.data) + runningStore.updateDisinfectionConfig(disinfectionConfig) + break case 'login': // if (ackcode == 0) { // window.location.href = 'http://127.0.0.1/'