Browse Source

审计记录

master
maochaoying 2 years ago
parent
commit
7c4b3620c9
  1. 34
      src/components/Audit.vue
  2. 9
      src/mock/command.js
  3. 8
      src/pages/Home.vue
  4. 2
      src/store/index.js
  5. 16
      src/store/modules/audit.js
  6. 11
      src/store/modules/websocket.js

34
src/components/Audit.vue

@ -6,12 +6,22 @@
<p>操作时间</p> <p>操作时间</p>
</div> </div>
<div <div
:class="dataList?.length == 0 ? 'content_wrap layout' : 'content_wrap'"
:class="
auditStore.auditInfoList?.length == 0
? 'content_wrap layout'
: 'content_wrap'
"
> >
<div class="line" v-for="item in dataList" :key="item">
<div class="username">Admin</div>
<div class="oper">修改注射泵速率</div>
<div class="time">2023-06-29 13:59</div>
<div
class="line"
v-for="item in auditStore.auditInfoList"
:key="item?.id"
>
<div class="username">{{ item?.uid }}</div>
<div class="oper">{{ item?.behaviorZH }}</div>
<div class="time">
{{ moment(item?.date).format('YYYY-MM-DD HH:mm:ss') }}
</div>
</div> </div>
<svg <svg
v-if="dataList?.length == 0" v-if="dataList?.length == 0"
@ -52,8 +62,18 @@
</template> </template>
<script setup> <script setup>
import { ref } from 'vue'
const dataList = ref([])
import { ref, onMounted } from 'vue'
import { useWebSocketStore, useAuditStore } from '@/store'
import { getUserBehaviorRecordDescJSON } from '@/mock/command'
import moment from 'moment'
const webSocketStore = useWebSocketStore()
const auditStore = useAuditStore()
onMounted(() => {
//
webSocketStore.sendCommandMsg(getUserBehaviorRecordDescJSON(0, 10))
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

9
src/mock/command.js

@ -232,3 +232,12 @@ export const cleanUserBehaviorRecordJSON = {
command: 'cleanUserBehaviorRecord', command: 'cleanUserBehaviorRecord',
messageId: 'cleanUserBehaviorRecord', messageId: 'cleanUserBehaviorRecord',
} }
export const getUserBehaviorRecordDescJSON = (page, page_size) => {
return {
command: 'getUserBehaviorRecordDescJson',
page,
page_size,
messageId: 'getUserBehaviorRecordDescJson',
}
}

8
src/pages/Home.vue

@ -78,7 +78,7 @@
</svg> </svg>
<p class="text">排液</p> <p class="text">排液</p>
</div> </div>
<!-- <div
<div
:class=" :class="
activeTab == 7 ? 'tab_btn style-btn active_btn' : 'style-btn tab_btn' activeTab == 7 ? 'tab_btn style-btn active_btn' : 'style-btn tab_btn'
" "
@ -103,7 +103,7 @@
</g> </g>
</svg> </svg>
<p class="text">配方管理</p> <p class="text">配方管理</p>
</div> -->
</div>
<div <div
:class=" :class="
activeTab == 4 ? 'tab_btn style-btn active_btn' : 'style-btn tab_btn' activeTab == 4 ? 'tab_btn style-btn active_btn' : 'style-btn tab_btn'
@ -163,7 +163,7 @@
</svg> </svg>
<p class="text">设置</p> <p class="text">设置</p>
</div> </div>
<!-- <div
<div
v-if=" v-if="
userStore.loginUserPermission != 3 && userStore.loginUserPermission != 3 &&
[0, 5].includes(operatorStore.disinfectStatus) [0, 5].includes(operatorStore.disinfectStatus)
@ -191,7 +191,7 @@
</g> </g>
</svg> </svg>
<p class="text">审计</p> <p class="text">审计</p>
</div> -->
</div>
</div> </div>
<Operator <Operator
v-if="activeTab == 1 && showOpertor" v-if="activeTab == 1 && showOpertor"

2
src/store/index.js

@ -7,11 +7,13 @@ import { useDeviceStore } from './modules/device'
import { useUserStore } from './modules/user' import { useUserStore } from './modules/user'
import { useEchartsStore } from './modules/echarts' import { useEchartsStore } from './modules/echarts'
import { usePreStore } from './modules/preinstall' import { usePreStore } from './modules/preinstall'
import { useAuditStore } from './modules/audit'
const store = createPinia() const store = createPinia()
export default store export default store
export { export {
useTestStore, useTestStore,
useAuditStore,
useSettingStore, useSettingStore,
useOperatorStore, useOperatorStore,
useWebSocketStore, useWebSocketStore,

16
src/store/modules/audit.js

@ -0,0 +1,16 @@
import { defineStore } from 'pinia'
export const useAuditStore = defineStore({
id: 'audit', // id必填,且需要唯一
// state
state: () => {
return {
auditInfoList: [],
}
},
// actions
actions: {
updateAuditList(auditInfoList) {
this.auditInfoList = auditInfoList
},
},
})

11
src/store/modules/websocket.js

@ -6,6 +6,7 @@ import { useUserStore } from './user'
import { useOperatorStore } from './operator' import { useOperatorStore } from './operator'
import { useDeviceStore } from './device' import { useDeviceStore } from './device'
import { useTestStore } from './test' import { useTestStore } from './test'
import { useAuditStore } from './audit'
import { useEchartsStore } from './echarts' import { useEchartsStore } from './echarts'
import { showSuccessToast, showFailToast } from 'vant' import { showSuccessToast, showFailToast } from 'vant'
import { saveEchartsDataToLocal } from '@/utils' import { saveEchartsDataToLocal } from '@/utils'
@ -32,6 +33,7 @@ export const useWebSocketStore = defineStore({
const deviceStore = useDeviceStore() const deviceStore = useDeviceStore()
const operatorStore = useOperatorStore() const operatorStore = useOperatorStore()
const echartsStore = useEchartsStore() const echartsStore = useEchartsStore()
const auditStore = useAuditStore()
init.connect() init.connect()
init.ws.onmessage = function (ev) { init.ws.onmessage = function (ev) {
const { ackcode, messageId, timeStamp } = JSON.parse(ev.data) const { ackcode, messageId, timeStamp } = JSON.parse(ev.data)
@ -171,12 +173,17 @@ export const useWebSocketStore = defineStore({
break break
case 'stopDisinfection': case 'stopDisinfection':
break break
case 'exportUserBehaviorRecordJSON':
case 'exportUserBehaviorRecord':
settingStore.updateExportLoading(false) settingStore.updateExportLoading(false)
break break
case 'exportDisinfectionRecordJSON':
case 'exportDisinfectionRecord':
settingStore.updateExportLoading(false) settingStore.updateExportLoading(false)
break break
case 'getUserBehaviorRecordDescJson':
const { records } = JSON.parse(ev.data) || {}
const { iterms } = records || {}
auditStore.updateAuditList(iterms || [])
break
case 'login': case 'login':
if (ackcode == 0) { if (ackcode == 0) {
window.location.href = 'http://127.0.0.1/' window.location.href = 'http://127.0.0.1/'

Loading…
Cancel
Save