wms_web_nantong_yachi/src/views/HomeView.vue

195 lines
4.3 KiB
Vue
Raw Normal View History

2025-03-08 10:02:56 +08:00
<template>
<el-container class="wms-home">
<el-header class="header">
<div class="icon-img">
<el-image :src="icon_img_url" :fit="'fill'" />
</div>
<div class="title">
<span style="font-size: 15px;font-weight: bold; color: black;">WMS仓库管理系统</span>
</div>
<div class="stand">
<span style="font-size: 15px;font-weight: bold; color: black;">{{ standId }}</span>
</div>
<el-dropdown @command="handleCommand" class="user">
<span style="font-size: 15px; font-weight: bold; color: black;">
用户名{{ userName }}
</span>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="1">重启系统</el-dropdown-item>
<el-dropdown-item command="2" divided>重载配置</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</el-header>
<el-container class="content">
<el-aside class="aside">
<el-scrollbar style="height: max-content;">
<sideMenu></sideMenu>
</el-scrollbar>
</el-aside>
<el-container class="view-container">
<el-header class="tag">
<appTag></appTag>
</el-header>
<el-main class="view-main">
<!-- 路由占位符 -->
<el-scrollbar>
<router-view v-slot="{ Component }">
<!-- // TODO keepAlive配置 -->
<keep-alive>
<component :is="Component" />
</keep-alive>
</router-view>
</el-scrollbar>
</el-main>
</el-container>
</el-container>
<!-- <el-footer class="footer">© 1970- 江苏菲达宝开电气股份有限公司</el-footer> -->
</el-container>
</template>
<script setup>
// @ is an alias to /src
import sideMenu from '@/components/sideMenu.vue'
import appTag from '@/components/appTag.vue'
import store from '@/store'
import { ElMessage } from 'element-plus'
import { restartSystem, reloadConfig } from '@/api/config.js'
const icon_img_url = require('@/assets/fdbk_log.png')
</script>
<script>
export default {
name: 'HomeView',
components: {
sideMenu,
appTag
},
computed: {
userName() {
return store.getters.getUserName
},
standId() {
return store.getters.getStandId
}
},
methods: {
handleCommand: (command) => {
const param = {
roleId: store.getters.getUser.roleId,
userName: store.getters.getUser.userName
}
if (command == 1) {
restartSystem(param).then(res => {
if (res.data.code == 0) {
ElMessage({
message: '重启系统成功',
type: 'success',
})
} else {
ElMessage.error(res.data.message)
}
}).catch(err => {
console.log(err)
ElMessage.error('发生错误')
})
} else if (command == 2) {
reloadConfig(param).then(res => {
if (res.data.code == 0) {
ElMessage({
message: '重载配置成功',
type: 'success',
})
} else {
ElMessage.error(res.data.message)
}
}).catch(err => {
console.log(err)
ElMessage.error('发生错误')
})
}
}
}
}
</script>
<style scoped>
.wms-home {
height: calc(100vh);
width: calc(100vw);
background-color: #CCCCCC;
}
.content {
height: 92%;
background-color: #FFFFFF;
}
.header {
background-color: #D9E3EE;
display: flex;
align-items: center;
height: 5%;
padding-left: 5px;
/* font-size: 15px; */
}
.aside {
background-color: #fff;
height: 100%;
width: 10%;
border-right: 1px solid #66CCFF;
}
.footer {
background-color: #F0FFFF;
display: flex;
justify-content: center;
flex-direction: column;
height: 3%;
}
.tag {
padding-left: 1px;
display: flex;
align-items: center;
height: 35px;
border-bottom: solid 1px;
}
.icon-img {
height: 100%;
width: 3%;
}
.icon-img .el-image {
height: 100%;
width: 100%;
}
.title {
margin-left: 2px;
}
.stand {
margin-left: auto;
}
.user {
margin-left: auto;
cursor: pointer;
}
.view-container {
height: 100%;
width: 90%;
}
.view-main {
height: 97% - 35px;
width: 100%;
}
</style>