You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
14 KiB
1 lines
14 KiB
{"ast":null,"code":"import { createElementVNode as _createElementVNode, createCommentVNode as _createCommentVNode, createVNode as _createVNode, resolveComponent as _resolveComponent, withCtx as _withCtx, openBlock as _openBlock, createBlock as _createBlock, Fragment as _Fragment, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode } from \"vue\";\nconst _hoisted_1 = {\n class: \"header-right\"\n};\nexport function render(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_el_icon = _resolveComponent(\"el-icon\");\n const _component_el_menu_item = _resolveComponent(\"el-menu-item\");\n const _component_el_menu = _resolveComponent(\"el-menu\");\n const _component_el_aside = _resolveComponent(\"el-aside\");\n const _component_el_button = _resolveComponent(\"el-button\");\n const _component_el_header = _resolveComponent(\"el-header\");\n const _component_router_view = _resolveComponent(\"router-view\");\n const _component_el_main = _resolveComponent(\"el-main\");\n const _component_el_container = _resolveComponent(\"el-container\");\n return _openBlock(), _createBlock(_component_el_container, {\n class: \"layout-container\"\n }, {\n default: _withCtx(() => [_createVNode(_component_el_aside, {\n width: \"200px\"\n }, {\n default: _withCtx(() => [_cache[7] || (_cache[7] = _createElementVNode(\"div\", {\n class: \"logo\"\n }, \"物流管理系统\", -1 /* HOISTED */)), _createVNode(_component_el_menu, {\n router: true,\n \"default-active\": $setup.route.path\n }, {\n default: _withCtx(() => [_createCommentVNode(\" 普通用户菜单 \"), $setup.userInfo.roles?.includes('ROLE_USER') ? (_openBlock(), _createBlock(_component_el_menu_item, {\n key: 0,\n index: \"/orders/my\"\n }, {\n default: _withCtx(() => [_createVNode(_component_el_icon, null, {\n default: _withCtx(() => [_createVNode($setup[\"Document\"])]),\n _: 1 /* STABLE */\n }), _cache[0] || (_cache[0] = _createElementVNode(\"span\", null, \"我的订单\", -1 /* HOISTED */))]),\n _: 1 /* STABLE */\n })) : _createCommentVNode(\"v-if\", true), _createCommentVNode(\" 仓库管理员菜单 \"), $setup.userInfo.roles?.includes('ROLE_WAREHOUSE_ADMIN') ? (_openBlock(), _createBlock(_component_el_menu_item, {\n key: 1,\n index: \"/admin/orders\"\n }, {\n default: _withCtx(() => [_createVNode(_component_el_icon, null, {\n default: _withCtx(() => [_createVNode($setup[\"List\"])]),\n _: 1 /* STABLE */\n }), _cache[1] || (_cache[1] = _createElementVNode(\"span\", null, \"订单管理\", -1 /* HOISTED */))]),\n _: 1 /* STABLE */\n })) : _createCommentVNode(\"v-if\", true), _createCommentVNode(\" 物流管理员菜单 \"), $setup.userInfo.roles?.includes('ROLE_LOGISTICS_ADMIN') ? (_openBlock(), _createElementBlock(_Fragment, {\n key: 2\n }, [_createVNode(_component_el_menu_item, {\n index: \"/orders/create\"\n }, {\n default: _withCtx(() => [_createVNode(_component_el_icon, null, {\n default: _withCtx(() => [_createVNode($setup[\"Plus\"])]),\n _: 1 /* STABLE */\n }), _cache[2] || (_cache[2] = _createElementVNode(\"span\", null, \"创建订单\", -1 /* HOISTED */))]),\n _: 1 /* STABLE */\n }), _createVNode(_component_el_menu_item, {\n index: \"/admin/orders\"\n }, {\n default: _withCtx(() => [_createVNode(_component_el_icon, null, {\n default: _withCtx(() => [_createVNode($setup[\"List\"])]),\n _: 1 /* STABLE */\n }), _cache[3] || (_cache[3] = _createElementVNode(\"span\", null, \"订单管理\", -1 /* HOISTED */))]),\n _: 1 /* STABLE */\n })], 64 /* STABLE_FRAGMENT */)) : _createCommentVNode(\"v-if\", true), _createCommentVNode(\" 仅管理员菜单 \"), $setup.userInfo.roles?.includes('ROLE_ADMIN') ? (_openBlock(), _createElementBlock(_Fragment, {\n key: 3\n }, [_createVNode(_component_el_menu_item, {\n index: \"/admin/orders\"\n }, {\n default: _withCtx(() => [_createVNode(_component_el_icon, null, {\n default: _withCtx(() => [_createVNode($setup[\"List\"])]),\n _: 1 /* STABLE */\n }), _cache[4] || (_cache[4] = _createElementVNode(\"span\", null, \"订单管理\", -1 /* HOISTED */))]),\n _: 1 /* STABLE */\n }), _createVNode(_component_el_menu_item, {\n index: \"/admin/users\"\n }, {\n default: _withCtx(() => [_createVNode(_component_el_icon, null, {\n default: _withCtx(() => [_createVNode($setup[\"User\"])]),\n _: 1 /* STABLE */\n }), _cache[5] || (_cache[5] = _createElementVNode(\"span\", null, \"用户管理\", -1 /* HOISTED */))]),\n _: 1 /* STABLE */\n }), _createVNode(_component_el_menu_item, {\n index: \"/admin/locations\"\n }, {\n default: _withCtx(() => [_createVNode(_component_el_icon, null, {\n default: _withCtx(() => [_createVNode($setup[\"Location\"])]),\n _: 1 /* STABLE */\n }), _cache[6] || (_cache[6] = _createElementVNode(\"span\", null, \"中转点管理\", -1 /* HOISTED */))]),\n _: 1 /* STABLE */\n })], 64 /* STABLE_FRAGMENT */)) : _createCommentVNode(\"v-if\", true)]),\n _: 1 /* STABLE */\n }, 8 /* PROPS */, [\"default-active\"])]),\n _: 1 /* STABLE */\n }), _createVNode(_component_el_container, null, {\n default: _withCtx(() => [_createVNode(_component_el_header, null, {\n default: _withCtx(() => [_createElementVNode(\"div\", _hoisted_1, [_createElementVNode(\"span\", null, _toDisplayString($setup.userInfo.username), 1 /* TEXT */), _createVNode(_component_el_button, {\n type: \"text\",\n onClick: $setup.handleLogout\n }, {\n default: _withCtx(() => _cache[8] || (_cache[8] = [_createTextVNode(\"退出登录\")])),\n _: 1 /* STABLE */\n })])]),\n _: 1 /* STABLE */\n }), _createVNode(_component_el_main, null, {\n default: _withCtx(() => [_createVNode(_component_router_view)]),\n _: 1 /* STABLE */\n })]),\n _: 1 /* STABLE */\n })]),\n _: 1 /* STABLE */\n });\n}","map":{"version":3,"names":["class","_createBlock","_component_el_container","default","_withCtx","_createVNode","_component_el_aside","width","_createElementVNode","_component_el_menu","router","$setup","route","path","_createCommentVNode","userInfo","roles","includes","_component_el_menu_item","key","index","_component_el_icon","_","_createElementBlock","_Fragment","_component_el_header","_hoisted_1","_toDisplayString","username","_component_el_button","type","onClick","handleLogout","_cache","_createTextVNode","_component_el_main","_component_router_view"],"sources":["D:\\IDEAproject\\Front-end logistics\\src\\components\\layout\\index.vue"],"sourcesContent":["<template>\r\n <el-container class=\"layout-container\">\r\n <el-aside width=\"200px\">\r\n <div class=\"logo\">物流管理系统</div>\r\n <el-menu\r\n :router=\"true\"\r\n :default-active=\"route.path\"\r\n >\r\n <!-- 普通用户菜单 -->\r\n <el-menu-item \r\n \r\n v-if=\"userInfo.roles?.includes('ROLE_USER')\"\r\n index=\"/orders/my\"\r\n >\r\n <el-icon><Document /></el-icon>\r\n <span>我的订单</span>\r\n </el-menu-item>\r\n \r\n <!-- 仓库管理员菜单 -->\r\n <template v-if=\"userInfo.roles?.includes('ROLE_WAREHOUSE_ADMIN')\">\r\n <el-menu-item index=\"/admin/orders\">\r\n <el-icon><List /></el-icon>\r\n <span>订单管理</span>\r\n </el-menu-item>\r\n </template>\r\n\r\n <!-- 物流管理员菜单 -->\r\n <template v-if=\"userInfo.roles?.includes('ROLE_LOGISTICS_ADMIN')\">\r\n <el-menu-item index=\"/orders/create\">\r\n <el-icon><Plus /></el-icon>\r\n <span>创建订单</span>\r\n </el-menu-item>\r\n <el-menu-item index=\"/admin/orders\">\r\n <el-icon><List /></el-icon>\r\n <span>订单管理</span>\r\n </el-menu-item>\r\n </template>\r\n\r\n <!-- 仅管理员菜单 -->\r\n <template v-if=\"userInfo.roles?.includes('ROLE_ADMIN')\">\r\n <el-menu-item index=\"/admin/orders\">\r\n <el-icon><List /></el-icon>\r\n <span>订单管理</span>\r\n </el-menu-item>\r\n <el-menu-item index=\"/admin/users\">\r\n <el-icon><User /></el-icon>\r\n <span>用户管理</span>\r\n </el-menu-item>\r\n <el-menu-item index=\"/admin/locations\">\r\n <el-icon><Location /></el-icon>\r\n <span>中转点管理</span>\r\n </el-menu-item>\r\n </template>\r\n </el-menu>\r\n </el-aside>\r\n \r\n <el-container>\r\n <el-header>\r\n <div class=\"header-right\">\r\n <span>{{ userInfo.username }}</span>\r\n <el-button type=\"text\" @click=\"handleLogout\">退出登录</el-button>\r\n </div>\r\n </el-header>\r\n \r\n <el-main>\r\n <router-view></router-view>\r\n </el-main>\r\n </el-container>\r\n </el-container>\r\n</template>\r\n\r\n<script setup>\r\nimport { computed } from 'vue'\r\nimport { useRoute, useRouter } from 'vue-router'\r\nimport { useStore } from 'vuex'\r\nimport { Document, Plus, List, User, Location } from '@element-plus/icons-vue'\r\nimport { ElMessage, ElMessageBox } from 'element-plus'\r\n\r\nconst route = useRoute()\r\nconst router = useRouter()\r\nconst store = useStore()\r\n\r\nconst userInfo = computed(() => store.state.userInfo)\r\n\r\nconst handleLogout = async () => {\r\n try {\r\n await ElMessageBox.confirm('确定要退出登录吗?', '提示', {\r\n type: 'warning',\r\n confirmButtonText: '确定',\r\n cancelButtonText: '取消'\r\n })\r\n \r\n // 直接清除本地存储的用户信息和 token\r\n store.dispatch('logout')\r\n ElMessage.success('已退出登录')\r\n router.push('/login')\r\n } catch (error) {\r\n if (error !== 'cancel') {\r\n console.error('退出失败:', error)\r\n }\r\n }\r\n}\r\n</script>\r\n\r\n<style scoped>\r\n.layout-container {\r\n height: 100vh;\r\n}\r\n\r\n.logo {\r\n height: 60px;\r\n line-height: 60px;\r\n text-align: center;\r\n font-size: 20px;\r\n font-weight: bold;\r\n color: #409EFF;\r\n border-bottom: 1px solid #DCDFE6;\r\n}\r\n\r\n.el-aside {\r\n background-color: #fff;\r\n border-right: 1px solid #DCDFE6;\r\n}\r\n\r\n.el-header {\r\n background-color: #fff;\r\n border-bottom: 1px solid #DCDFE6;\r\n display: flex;\r\n align-items: center;\r\n justify-content: flex-end;\r\n padding: 0 20px;\r\n}\r\n\r\n.header-right {\r\n display: flex;\r\n align-items: center;\r\n gap: 20px;\r\n}\r\n\r\n.el-main {\r\n background-color: #f5f5f5;\r\n padding: 20px;\r\n}\r\n</style> "],"mappings":";;EA0DaA,KAAK,EAAC;AAAc;;;;;;;;;;;uBAzD/BC,YAAA,CAmEeC,uBAAA;IAnEDF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