Browse Source

导出记录

master
maochaoying 2 years ago
parent
commit
f62a0bdca7
  1. BIN
      src/assets/img/liquid/Thumbs.db
  2. BIN
      src/assets/img/operator/Thumbs.db
  3. 51
      src/components/Setting/components/ExportExcel.vue
  4. 2
      src/components/Setting/index.vue
  5. 20
      src/mock/command.js
  6. 9
      src/store/modules/setting.js
  7. 2
      src/store/modules/user.js
  8. 6
      src/store/modules/websocket.js

BIN
src/assets/img/liquid/Thumbs.db

BIN
src/assets/img/operator/Thumbs.db

51
src/components/Setting/components/ExportExcel.vue

@ -1,10 +1,53 @@
<template>
<div class="export_excel_container">
<div class="btn">导出消毒相关日志</div>
<div class="btn mb" @click="exportAudit">导出审计</div>
<div class="btn mb" @click="exportRecord">导出消毒记录</div>
<div class="btn mb" @click="clearAudit">清空审计</div>
<div class="btn" @click="clearRecord">清空消毒记录</div>
<van-overlay :show="settingStore.exportLoading" z-index="3">
<div class="wrapper" @click.stop>
<div class="block">
<van-loading />
<p class="shutdown_text">{{ settingStore.exportText }}</p>
</div>
</div>
</van-overlay>
</div>
</template>
<script setup></script>
<script setup>
import { ref } from 'vue'
import {
exportUserBehaviorRecordJSON,
exportDisinfectionRecordJSON,
cleanDisinfectionRecordJSON,
cleanUserBehaviorRecordJSON,
} from '@/mock/command'
import { useWebSocketStore, useSettingStore } from '@/store'
const webSocketStore = useWebSocketStore()
const settingStore = useSettingStore()
const exportAudit = () => {
settingStore.updateExportText('导出审计中')
settingStore.updateExportLoading(true)
webSocketStore.sendCommandMsg(exportUserBehaviorRecordJSON)
}
const exportRecord = () => {
settingStore.updateExportText('导出消毒记录中')
settingStore.updateExportLoading(true)
webSocketStore.sendCommandMsg(exportDisinfectionRecordJSON)
}
const clearAudit = () => {
webSocketStore.sendCommandMsg(cleanDisinfectionRecordJSON)
}
const clearRecord = () => {
webSocketStore.sendCommandMsg(cleanUserBehaviorRecordJSON)
}
</script>
<style lang="scss" scoped>
.export_excel_container {
@ -15,6 +58,7 @@
align-items: center;
justify-content: center;
box-sizing: border-box;
flex-direction: column;
.btn {
background: #06518b;
display: flex;
@ -30,5 +74,8 @@
letter-spacing: 0.1em;
color: #ffffff;
}
.mb {
margin-bottom: 16px;
}
}
</style>

2
src/components/Setting/index.vue

@ -23,7 +23,7 @@
</div>
<div class="tab_wrap" @click="changeActiveTab(5)">
<p class="active_line" v-show="activeTab == 5"></p>
<p :class="activeTab == 5 ? 'title active' : 'title'">操作日志导出</p>
<p :class="activeTab == 5 ? 'title active' : 'title'">数据导出</p>
<div :class="activeTab == 5 ? 'btn style-btn' : 'dis_btn'">导出</div>
</div>
<!-- <div class="tab_wrap" @click="changeActiveTab(6)">

20
src/mock/command.js

@ -212,3 +212,23 @@ export const updateUserPermissionLevelJSON = id => {
permission_level: 0,
}
}
export const exportUserBehaviorRecordJSON = {
command: 'exportUserBehaviorRecord',
messageId: 'exportUserBehaviorRecord',
}
export const exportDisinfectionRecordJSON = {
command: 'exportDisinfectionRecord',
messageId: 'exportDisinfectionRecord',
}
export const cleanDisinfectionRecordJSON = {
command: 'cleanDisinfectionRecord',
messageId: 'cleanDisinfectionRecord',
}
export const cleanUserBehaviorRecordJSON = {
command: 'cleanUserBehaviorRecord',
messageId: 'cleanUserBehaviorRecord',
}

9
src/store/modules/setting.js

@ -31,10 +31,19 @@ export const useSettingStore = defineStore({
chargingPumpRPM: 0,
sprinklerPumpRPM: 0,
sprinklerPumpGPM: 0,
// 导出记录的loading
exportLoading: false,
exportText: '',
}
},
// actions
actions: {
updateExportText(exportText) {
this.exportText = exportText
},
updateExportLoading(exportLoading) {
this.exportLoading = exportLoading
},
updateSprinklerPumpGPM(sprinklerPumpGPM) {
this.sprinklerPumpGPM = sprinklerPumpGPM
},

2
src/store/modules/user.js

@ -7,7 +7,7 @@ export const useUserStore = defineStore({
allUserList: [],
operUser: '',
loginUser: '',
loginUserPermission: 3,
loginUserPermission: 2,
}
},
// actions

6
src/store/modules/websocket.js

@ -168,6 +168,12 @@ export const useWebSocketStore = defineStore({
break
case 'stopDisinfection':
break
case 'exportUserBehaviorRecordJSON':
settingStore.updateExportLoading(false)
break
case 'exportDisinfectionRecordJSON':
settingStore.updateExportLoading(false)
break
case 'login':
if (ackcode == 0) {
window.location.href = 'http://127.0.0.1/'

Loading…
Cancel
Save