195 lines
4.5 KiB
Vue
195 lines
4.5 KiB
Vue
<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: 20px;font-weight: bold;">Caterpillar CSCL ASRS Management System</span>
|
||
</div>
|
||
<div class="user">
|
||
<el-dropdown @command="handleCommand">
|
||
<span class="el-dropdown-link" style="font-size: 15px; font-weight: bold;">
|
||
用户名:{{ 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>
|
||
</div>
|
||
</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">
|
||
<span style="align-self: center; margin-left: 10px; font-weight: bold;">Let’s do the work!</span>
|
||
<span style="align-self: center; margin-left: auto; margin-right: 25px; font-weight: bold;">Version1.0</span>
|
||
<span style="align-self: center; margin-right: 10px; font-weight: bold;">Caterpillar © 2024. All Rights Reserved</span>
|
||
</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
|
||
}
|
||
},
|
||
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: #FFC000;
|
||
display: flex;
|
||
align-items: center;
|
||
height: 5%;
|
||
/* font-size: 15px; */
|
||
}
|
||
|
||
.aside {
|
||
background-color: #fff;
|
||
height: 100%;
|
||
width: 10%;
|
||
border-right: 1px solid #66CCFF;
|
||
}
|
||
|
||
.footer {
|
||
background-color: #FFC000;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
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;
|
||
}
|
||
|
||
.user {
|
||
margin-left: auto;
|
||
}
|
||
|
||
.view-container {
|
||
height: 100%;
|
||
width: 90%;
|
||
}
|
||
|
||
.view-main {
|
||
height: 97% - 35px;
|
||
width: 100%;
|
||
}
|
||
|
||
.example-showcase .el-dropdown-link {
|
||
cursor: pointer;
|
||
color: var(--el-color-primary);
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
</style>
|