diff --git a/src/components/Operator.vue b/src/components/Operator.vue index 5a412fc..474f08e 100644 --- a/src/components/Operator.vue +++ b/src/components/Operator.vue @@ -117,7 +117,7 @@ const logVal = ref(1) const roomSize = ref(0) watch(() => { - roomSize.value = props.input.match(/\d+/g) + roomSize.value = props.input.match(/\d+/g)[0] }) const changeLogVal = val => { @@ -131,6 +131,7 @@ const startDisinfect = () => { if (roomSize.value == 0) { showFailToast('请调整房间大小设置,不能为0') } else { + console.log(roomSize.value) webSocketStore.sendCommandMsg( startDisinfectionJSON(logVal.value, roomSize.value), ) diff --git a/src/components/Progress.vue b/src/components/Progress.vue index 1f58ef2..dddb416 100644 --- a/src/components/Progress.vue +++ b/src/components/Progress.vue @@ -59,6 +59,7 @@ import { useOperatorStore, useWebSocketStore } from '@/store' import { stopDisinfectionJSON, getStateJSON, + continueDisinfectionJSON, pauseDisinfectionJSON, } from '@/mock/command' import { onMounted, onUnmounted, ref } from 'vue' @@ -66,7 +67,7 @@ import * as echarts from 'echarts' const binOption = ref({ legend: { - data: ['Email', 'Union Ads', 'Video Ads'], + data: ['温度', '湿度', '过氧化氢浓度'], }, grid: { left: '3%', @@ -84,19 +85,19 @@ const binOption = ref({ }, series: [ { - name: 'Email', + name: '温度', type: 'line', stack: 'Total', data: [120, 132, 101, 134, 90, 230, 210], }, { - name: 'Union Ads', + name: '湿度', type: 'line', stack: 'Total', data: [220, 182, 191, 234, 290, 330, 310], }, { - name: 'Video Ads', + name: '过氧化氢浓度', type: 'line', stack: 'Total', data: [150, 232, 201, 154, 190, 330, 410], @@ -104,8 +105,18 @@ const binOption = ref({ ], }) const envir1Option = ref({ + legend: { + data: ['温度', '湿度', '过氧化氢浓度'], + }, + grid: { + left: '3%', + right: '4%', + bottom: '3%', + containLabel: true, + }, xAxis: { type: 'category', + boundaryGap: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], }, yAxis: { @@ -113,14 +124,38 @@ const envir1Option = ref({ }, series: [ { - data: [150, 230, 224, 218, 135, 147, 260], + name: '温度', type: 'line', + stack: 'Total', + data: [120, 132, 101, 134, 90, 230, 210], + }, + { + name: '湿度', + type: 'line', + stack: 'Total', + data: [220, 182, 191, 234, 290, 330, 310], + }, + { + name: '过氧化氢浓度', + type: 'line', + stack: 'Total', + data: [150, 232, 201, 154, 190, 330, 410], }, ], }) const envir2Option = ref({ + legend: { + data: ['温度', '湿度', '过氧化氢浓度'], + }, + grid: { + left: '3%', + right: '4%', + bottom: '3%', + containLabel: true, + }, xAxis: { type: 'category', + boundaryGap: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], }, yAxis: { @@ -128,8 +163,22 @@ const envir2Option = ref({ }, series: [ { - data: [150, 230, 224, 218, 135, 147, 260], + name: '温度', + type: 'line', + stack: 'Total', + data: [120, 132, 101, 134, 90, 230, 210], + }, + { + name: '湿度', type: 'line', + stack: 'Total', + data: [220, 182, 191, 234, 290, 330, 310], + }, + { + name: '过氧化氢浓度', + type: 'line', + stack: 'Total', + data: [150, 232, 201, 154, 190, 330, 410], }, ], }) @@ -150,12 +199,21 @@ onMounted(() => { timer.value = setInterval(() => { webSocketStore.sendCommandMsg(getStateJSON) }, 1000) - var binCharts = echarts.init(document.getElementById('bin')) - binCharts.setOption(binOption.value) - var envir1Charts = echarts.init(document.getElementById('envir1')) - envir1Charts.setOption(envir1Option.value) - var envir2Charts = echarts.init(document.getElementById('envir2')) - envir2Charts.setOption(envir2Option.value) + let a = echarts.getInstanceByDom(document.getElementById('bin')) + if (a == undefined) { + var binCharts = echarts.init(document.getElementById('bin')) + binCharts.setOption(binOption.value) + } + let b = echarts.getInstanceByDom(document.getElementById('envir1')) + if (b == undefined) { + var envir1Charts = echarts.init(document.getElementById('envir1')) + envir1Charts.setOption(envir1Option.value) + } + let c = echarts.getInstanceByDom(document.getElementById('envir2')) + if (c == undefined) { + var envir2Charts = echarts.init(document.getElementById('envir2')) + envir2Charts.setOption(envir2Option.value) + } }) onUnmounted(() => { timer.value = null @@ -177,6 +235,7 @@ const stopDisinfect = () => { const continueDisinfect = () => { if (!operatorStore.disinfectStatus) { + webSocketStore.sendCommandMsg(continueDisinfectionJSON) operatorStore.updateDisinfectStatus(true) } } diff --git a/src/components/Setting/components/Admin.vue b/src/components/Setting/components/Admin.vue index 1b1941a..43d9853 100644 --- a/src/components/Setting/components/Admin.vue +++ b/src/components/Setting/components/Admin.vue @@ -66,9 +66,13 @@ diff --git a/src/components/Setting/components/User.vue b/src/components/Setting/components/User.vue index df83c58..875ac30 100644 --- a/src/components/Setting/components/User.vue +++ b/src/components/Setting/components/User.vue @@ -133,9 +133,19 @@ const updateUserPassword = () => { return } updateUserInfoTip.value = '' - webSocketStore.sendCommandMsg( - chpasswdJSON(userStore.operUser, updateUserNewPassword.value), + // 从userlist中筛选出当前user + const arr = userStore.allUserList.filter( + item => item.uid == userStore.operUser, ) + if (arr?.length > 0) { + webSocketStore.sendCommandMsg( + chpasswdJSON( + userStore.operUser, + updateUserNewPassword.value, + arr[0]?.passwd, + ), + ) + } } const handleAddPasswordShow = () => { diff --git a/src/mock/command.js b/src/mock/command.js index deb93a2..587a2b5 100644 --- a/src/mock/command.js +++ b/src/mock/command.js @@ -15,11 +15,12 @@ export const logoutJSON = { } // 改密码 -export const chpasswdJSON = (userId, passwd) => { +export const chpasswdJSON = (userId, newpasswd, passwd) => { return { command: 'chpasswd', messageId: 'chpasswd', userId, + newpasswd, passwd, } } @@ -41,6 +42,11 @@ export const startDisinfectionJSON = (loglevel, roomVolume) => { } } +export const continueDisinfectionJSON = { + command: 'continueDisinfection', + messageId: 'continueDisinfection', +} + // 停止消毒 export const stopDisinfectionJSON = { command: 'stopDisinfection', diff --git a/src/pages/Home.vue b/src/pages/Home.vue index f21736a..b03f415 100644 --- a/src/pages/Home.vue +++ b/src/pages/Home.vue @@ -120,7 +120,7 @@
设置
- - + />