初始化2
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import {
|
||||
HomeFilled, Download, Upload, Search, CircleCheck, List,
|
||||
Box, Tickets, Monitor
|
||||
} from '@element-plus/icons-vue'
|
||||
import { getUser, logout } from '../utils/auth'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const user = getUser()
|
||||
const pageTitle = computed(() => route.meta?.title || '')
|
||||
|
||||
const menus = [
|
||||
{ path: '/', title: '工作台', icon: HomeFilled },
|
||||
{ path: '/inbound', title: '入库管理', icon: Download },
|
||||
{ path: '/outbound', title: '备料出库', icon: Upload },
|
||||
{ path: '/inventory', title: '库存查询', icon: Search },
|
||||
{ path: '/inspection', title: '质量检验', icon: CircleCheck },
|
||||
{ path: '/stocktake', title: '库存盘点', icon: List },
|
||||
{ path: '/semi', title: '半成品/成品', icon: Box },
|
||||
{ path: '/package', title: '包装绑定', icon: Box },
|
||||
{ path: '/ledger', title: '物料台账', icon: Tickets }
|
||||
]
|
||||
|
||||
function onLogout() {
|
||||
logout()
|
||||
ElMessage.success('已退出登录')
|
||||
router.push('/login')
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-container class="layout">
|
||||
<el-aside width="210px" class="aside">
|
||||
<div class="brand">
|
||||
<el-icon :size="22"><Box /></el-icon>
|
||||
<span>北自所库房客户端</span>
|
||||
</div>
|
||||
<el-menu :default-active="route.path" class="menu" background-color="#001529"
|
||||
text-color="#c2cad8" active-text-color="#ffffff" router>
|
||||
<el-menu-item v-for="m in menus" :key="m.path" :index="m.path">
|
||||
<el-icon><component :is="m.icon" /></el-icon>
|
||||
<span>{{ m.title }}</span>
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
</el-aside>
|
||||
|
||||
<el-container>
|
||||
<el-header height="56px" class="header">
|
||||
<span class="title">{{ pageTitle }}</span>
|
||||
<div class="spacer"></div>
|
||||
<el-button text type="primary" @click="router.push('/display')">
|
||||
<el-icon style="margin-right:4px"><Monitor /></el-icon>免登录大屏
|
||||
</el-button>
|
||||
<el-tag effect="plain">{{ user?.realName || user?.username || '未登录' }}</el-tag>
|
||||
<el-button text type="danger" @click="onLogout">退出登录</el-button>
|
||||
</el-header>
|
||||
<el-main class="main">
|
||||
<router-view />
|
||||
</el-main>
|
||||
</el-container>
|
||||
</el-container>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.layout { height: 100vh; }
|
||||
.aside { background: #001529; }
|
||||
.brand {
|
||||
display: flex; align-items: center; gap: 8px;
|
||||
height: 56px; padding: 0 16px;
|
||||
color: #fff; font-weight: 600; font-size: 15px;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
.menu { border-right: none; }
|
||||
.header {
|
||||
display: flex; align-items: center; gap: 10px;
|
||||
background: #fff; border-bottom: 1px solid #ebeef5;
|
||||
}
|
||||
.title { font-size: 16px; font-weight: 600; }
|
||||
.spacer { flex: 1; }
|
||||
.main { background: #f0f2f5; padding: 14px; overflow: auto; }
|
||||
</style>
|
||||
Reference in New Issue
Block a user