wms_client_kate_suzhou/src/views/HomeView.vue

178 lines
3.9 KiB
Vue
Raw Normal View History

2024-07-02 08:16:55 +08:00
<template>
<el-container class="wms-home">
<el-header class="header">
2024-07-22 17:02:52 +08:00
<!-- <div class="icon-img">
2024-07-02 08:16:55 +08:00
<el-image :src="icon_img_url" :fit="'fill'" />
2024-07-22 17:02:52 +08:00
</div> -->
2024-07-02 08:16:55 +08:00
<div class="title">
2024-07-22 17:02:52 +08:00
<span style="font-size: 15px;font-weight: bold;">Caterpillar CSCL ASRS Management System</span>
2024-07-19 13:46:52 +08:00
</div>
<div class="user">
<el-dropdown @command="handleCommand">
<span class="el-dropdown-link">
{{ 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>
2024-07-02 08:16:55 +08:00
</div>
</el-header>
<el-container class="content">
<el-aside class="aside">
2024-07-22 17:02:52 +08:00
<el-scrollbar style="height: max-content;">
2024-07-02 08:16:55 +08:00
<sideMenu></sideMenu>
</el-scrollbar>
</el-aside>
2024-07-22 17:02:52 +08:00
<el-container class="view-container">
2024-07-02 08:16:55 +08:00
<el-header class="tag">
<appTag></appTag>
</el-header>
2024-07-22 17:02:52 +08:00
<el-main class="view-main">
2024-07-02 08:16:55 +08:00
<!-- 路由占位符 -->
<el-scrollbar>
<router-view v-slot="{ Component }">
<!-- // TODO keepAlive配置 -->
<keep-alive>
<component :is="Component" />
</keep-alive>
</router-view>
</el-scrollbar>
</el-main>
2024-07-22 17:02:52 +08:00
<el-footer class="footer">
<span style="align-self: center; margin-left: 10px;">Lets do the work!</span>
<span style="align-self: center; margin-right: 10px;">Caterpillar © 2024. All Rights Reserved</span>
</el-footer>
2024-07-02 08:16:55 +08:00
</el-container>
</el-container>
</el-container>
</template>
<script setup>
// @ is an alias to /src
import sideMenu from '@/components/sideMenu.vue'
import appTag from '@/components/appTag.vue'
2024-07-19 13:46:52 +08:00
import store from '@/store'
import { ElMessage } from 'element-plus'
import { restartSystem, reloadConfig } from '@/api/config.js'
2024-07-02 08:16:55 +08:00
const icon_img_url = require('@/assets/fdbk_log.png')
</script>
<script>
export default {
name: 'HomeView',
components: {
sideMenu,
appTag
},
computed: {
userName() {
2024-07-19 13:46:52 +08:00
return store.getters.getUserName
2024-07-02 08:16:55 +08:00
}
},
methods: {
2024-07-19 13:46:52 +08:00
handleCommand: (command) => {
const param = store.getters.getUser
if (command == 1) {
restartSystem(param).then(res => {
if (res.data.code != 0) {
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('发生错误')
})
}
2024-07-02 08:16:55 +08:00
}
}
}
</script>
<style scoped>
.wms-home {
2024-07-22 17:02:52 +08:00
height: calc(100vh);
width: calc(100vw);
2024-07-02 08:16:55 +08:00
background-color: #CCCCCC;
}
.content {
height: 95%;
background-color: #FFFFFF;
}
.header {
2024-07-22 17:02:52 +08:00
background-color: #FFC000;
2024-07-02 08:16:55 +08:00
display: flex;
align-items: center;
height: 5%;
/* font-size: 15px; */
}
.aside {
background-color: #fff;
height: 100%;
width: 10%;
border-right: 1px solid #66CCFF;
}
.footer {
2024-07-22 17:02:52 +08:00
background-color: #FFC000;
2024-07-02 08:16:55 +08:00
display: flex;
2024-07-22 17:02:52 +08:00
justify-content: space-between;
2024-07-02 08:16:55 +08:00
height: 3%;
}
.tag {
padding-left: 1px;
display: flex;
align-items: center;
2024-07-22 17:02:52 +08:00
height: 35px;
2024-07-02 08:16:55 +08:00
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;
}
2024-07-22 17:02:52 +08:00
.view-container {
height: 100%;
width: 90%;
2024-07-02 08:16:55 +08:00
}
2024-07-22 17:02:52 +08:00
.view-main {
height: 97% - 35px;
width: 100%;
2024-07-02 08:16:55 +08:00
}
</style>