|
|
@@ -0,0 +1,415 @@
|
|
|
+<template>
|
|
|
+ <a-layout class="layout-top">
|
|
|
+ <a-layout-header class="m-layout-header">
|
|
|
+ <div>深圳市多元世纪信息技术股份有限公司</div>
|
|
|
+ <div class="m-layout-header-right">
|
|
|
+ <div>
|
|
|
+ <span>{{ username }}(2500000001),您好!</span>
|
|
|
+ </div>
|
|
|
+ <div class="relative">
|
|
|
+ <a-input-search ref="userNameInput" class="searchInput" placeholder="请输入代码/名称" @pressEnter="search" >
|
|
|
+ </a-input-search>
|
|
|
+ <!-- <a-icon type="search" /> -->
|
|
|
+ </div>
|
|
|
+ <div class="news-container">
|
|
|
+ <a-badge dot @click="chooseSetMenu('notice')">
|
|
|
+ <svg class="icon svg-icon" aria-hidden="true">
|
|
|
+ <use xlink:href="#icon-xiaoxi"></use>
|
|
|
+ </svg>
|
|
|
+ </a-badge>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <a-popover v-model:visible="visible" trigger="click" placement="bottomRight">
|
|
|
+ <template #content>
|
|
|
+ <div v-for="item in setMenu" @click="chooseSetMenu(item.path)" :key="item.path">{{item.name}}</div>
|
|
|
+ </template>
|
|
|
+ <a-avatar :size="24">
|
|
|
+ <template #icon>
|
|
|
+ <UserOutlined />
|
|
|
+ </template>
|
|
|
+ </a-avatar>
|
|
|
+ </a-popover>
|
|
|
+ <Setting />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </a-layout-header>
|
|
|
+ <a-layout class="middleLayout">
|
|
|
+ <a-layout-sider class="m-layout-left"
|
|
|
+ width="180"
|
|
|
+ v-model:collapsed="collapsed"
|
|
|
+ @collapse="collapse"
|
|
|
+ collapsible>
|
|
|
+ <a-menu theme="dark"
|
|
|
+ mode="inline"
|
|
|
+ class="left-menu"
|
|
|
+ v-model:selectedKeys="selectedKeys"
|
|
|
+ v-model:openKeys="openKeys"
|
|
|
+ @click="menuClick">
|
|
|
+ <a-sub-menu v-for="item in menuList"
|
|
|
+ :key="item.code">
|
|
|
+ <template #title>
|
|
|
+ <span>
|
|
|
+ <svg class="icon svg-icon"
|
|
|
+ aria-hidden="true">
|
|
|
+ <use :xlink:href="fontIcon(item.code)"></use>
|
|
|
+ </svg>
|
|
|
+ <span class="menu-item_title"
|
|
|
+ v-show="!collapsed">{{ item.title }}</span>
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ <a-menu-item :key="subItem.code"
|
|
|
+ v-for="subItem in item.children">
|
|
|
+ <span>{{ subItem.title }}</span>
|
|
|
+ </a-menu-item>
|
|
|
+ </a-sub-menu>
|
|
|
+ </a-menu>
|
|
|
+ </a-layout-sider>
|
|
|
+ <a-layout-content :style="{ background: '#0E0E0F', flex: 1 }">
|
|
|
+ <router-view />
|
|
|
+ </a-layout-content>
|
|
|
+ </a-layout>
|
|
|
+ </a-layout>
|
|
|
+</template>
|
|
|
+<script lang="ts">
|
|
|
+import { UserOutlined } from '@ant-design/icons-vue';
|
|
|
+import { defineComponent, ref, provide, unref } from 'vue';
|
|
|
+import Setting from '@/views/setting/index.vue';
|
|
|
+import CapitalInfo from '@/components/capitalInfo/index.vue';
|
|
|
+import SecondMenu from '@/components/secondeMenu/index.vue';
|
|
|
+import APP from '@/services';
|
|
|
+import { initData } from '@/setup/methods/index';
|
|
|
+import { useRouter } from 'vue-router';
|
|
|
+
|
|
|
+// 菜单栏
|
|
|
+const handleMenu = () => {
|
|
|
+ const collapsed = ref<boolean>(false);
|
|
|
+ const selectedKeys = ref<string[]>(['1-1']);
|
|
|
+ const openKeys = ref<string[]>(['1']);
|
|
|
+ const preOpenKeys = ref<string[]>(['1']);
|
|
|
+ // const menuList = APP.getRef('menus');
|
|
|
+ const menuList = [
|
|
|
+ {
|
|
|
+ key: '1',
|
|
|
+ title: '市场',
|
|
|
+ code: 'market',
|
|
|
+ children: [
|
|
|
+ {
|
|
|
+ key: '1-1',
|
|
|
+ title: '现货贸易',
|
|
|
+ code: ''
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: '2',
|
|
|
+ title: '查询',
|
|
|
+ code: 'search',
|
|
|
+ children: [
|
|
|
+ {
|
|
|
+ key: '2-1',
|
|
|
+ title: '单据记录',
|
|
|
+ code: ''
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: '2-2',
|
|
|
+ title: '资金流水',
|
|
|
+ code: ''
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: '2-3',
|
|
|
+ title: '出入库',
|
|
|
+ code: ''
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: '2-4',
|
|
|
+ title: '登录日志',
|
|
|
+ code: ''
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: '3',
|
|
|
+ title: '报表',
|
|
|
+ code: 'report'
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ const router = useRouter();
|
|
|
+ // 控制菜单是否隐藏
|
|
|
+ function collapse(collapsed: boolean) {
|
|
|
+ if (collapsed) {
|
|
|
+ preOpenKeys.value = openKeys.value;
|
|
|
+ openKeys.value = [];
|
|
|
+ } else {
|
|
|
+ openKeys.value = preOpenKeys.value;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function menuClick(value: any) {
|
|
|
+ router.push(value.key);
|
|
|
+ }
|
|
|
+ // 一级菜单图标
|
|
|
+ function fontIcon(code: string): string {
|
|
|
+ let result = 'icon-jinrongfenxi';
|
|
|
+ switch (code) {
|
|
|
+ case 'market':
|
|
|
+ result = 'icon-jinrongfenxi';
|
|
|
+ break;
|
|
|
+ case 'info':
|
|
|
+ result = 'icon-zhangdan';
|
|
|
+ break;
|
|
|
+ case 'business':
|
|
|
+ result = 'icon-renwu';
|
|
|
+ break;
|
|
|
+ case 'manage':
|
|
|
+ result = 'icon-quanxian';
|
|
|
+ break;
|
|
|
+ case 'search':
|
|
|
+ result = 'icon-chazhaojilu';
|
|
|
+ break;
|
|
|
+ case 'report':
|
|
|
+ result = 'icon-bingtu';
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return '#' + result;
|
|
|
+ }
|
|
|
+ return { collapsed, selectedKeys, menuList, openKeys, collapse, menuClick, fontIcon };
|
|
|
+};
|
|
|
+
|
|
|
+// 设置
|
|
|
+const setFn = () => {
|
|
|
+ const visible = ref<boolean>(false);
|
|
|
+ const chooseSetupItem = ref<string>('');
|
|
|
+ provide('setting', chooseSetupItem);
|
|
|
+ const setMenu = [
|
|
|
+ // { name: '修改密码', path: 'password' },
|
|
|
+ // { name: '收货地址', path: 'addresss' },
|
|
|
+ // // {name: '发票', path: 'setup-password'},
|
|
|
+ // { name: '手机号码绑定/解绑', path: 'phone' },
|
|
|
+ // { name: '关于我们', path: 'aboutUs' },
|
|
|
+ { name: '退出', path: 'logout' },
|
|
|
+ ];
|
|
|
+ function chooseSetMenu(path: string) {
|
|
|
+ chooseSetupItem.value = path;
|
|
|
+ console.log(path);
|
|
|
+ visible.value = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ return { visible, setMenu, chooseSetMenu };
|
|
|
+};
|
|
|
+// 搜索
|
|
|
+const onSearch = () => {
|
|
|
+ function search(value: string) {
|
|
|
+ console.log(value);
|
|
|
+ }
|
|
|
+ return { search };
|
|
|
+};
|
|
|
+// 配置是否显示下半部分
|
|
|
+function setShowBottomPart(code: string): boolean {
|
|
|
+ const unShow = ['outaccount_status'];
|
|
|
+ return !unShow.includes(code);
|
|
|
+}
|
|
|
+export default defineComponent({
|
|
|
+ name: 'layout-top',
|
|
|
+ components: {
|
|
|
+ Setting,
|
|
|
+ UserOutlined,
|
|
|
+ CapitalInfo,
|
|
|
+ SecondMenu,
|
|
|
+ },
|
|
|
+ setup(props, context) {
|
|
|
+ const { collapsed, selectedKeys, openKeys, menuList, collapse, menuClick, fontIcon } = handleMenu();
|
|
|
+ const router = useRouter();
|
|
|
+
|
|
|
+ initData(() => {
|
|
|
+ // 处理路由跳转到菜单栏里第一个队员的页面
|
|
|
+ const list = unref(menuList);
|
|
|
+ if (list.length && list[0].children && list[0].children.length) {
|
|
|
+ const code = list[0].children[0].code;
|
|
|
+ selectedKeys.value = [code];
|
|
|
+ openKeys.value = [list[0].code];
|
|
|
+ context.emit('chooseMenu', setShowBottomPart(code));
|
|
|
+ router.push(code);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ const { visible, setMenu, chooseSetMenu } = setFn();
|
|
|
+ const username = APP.get('username');
|
|
|
+ const { search } = onSearch();
|
|
|
+ const searchName = ref<string[]>(['']);
|
|
|
+ return {
|
|
|
+ collapsed,
|
|
|
+ collapse,
|
|
|
+ selectedKeys,
|
|
|
+ openKeys,
|
|
|
+ menuClick,
|
|
|
+ username,
|
|
|
+ menuList,
|
|
|
+ visible,
|
|
|
+ setMenu,
|
|
|
+ chooseSetMenu,
|
|
|
+ fontIcon,
|
|
|
+ };
|
|
|
+ },
|
|
|
+});
|
|
|
+</script>
|
|
|
+<style lang="less">
|
|
|
+.layout-top {
|
|
|
+ .flex;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ flex-direction: column;
|
|
|
+ .m-layout-header {
|
|
|
+ width: 100%;
|
|
|
+ height: 40px;
|
|
|
+ line-height: 40px;
|
|
|
+ background: @m-grey0;
|
|
|
+ color: @m-grey1;
|
|
|
+ padding: 0 20px;
|
|
|
+ .flex();
|
|
|
+ justify-content: space-between;
|
|
|
+ .searchInput.ant-input-affix-wrapper {
|
|
|
+ width: 240px;
|
|
|
+ height: 30px;
|
|
|
+ line-height: 30px;
|
|
|
+ font-size: 14px;
|
|
|
+ background: @m-grey9;
|
|
|
+ border: 0;
|
|
|
+ vertical-align: middle;
|
|
|
+ padding-left: 40px;
|
|
|
+ position: relative;
|
|
|
+ .rounded-corners(15px);
|
|
|
+ .ant-input {
|
|
|
+ background: @m-grey9;
|
|
|
+ color: @m-white0;
|
|
|
+ }
|
|
|
+ .ant-input-suffix {
|
|
|
+ margin-left: -215px;
|
|
|
+ .ant-input-search-icon {
|
|
|
+ color: @m-grey10;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // .relative {
|
|
|
+ // position: relative;
|
|
|
+ // .a-icon {
|
|
|
+ // font-size: 14px;
|
|
|
+ // .position(absolute, 50%, auto, auto, 10px);
|
|
|
+ // margin-top: -7px;
|
|
|
+ // color: @m-grey10;
|
|
|
+ // z-index: 10;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ .m-layout-header-right {
|
|
|
+ .flex();
|
|
|
+ .news-container {
|
|
|
+ padding-left: 10px;
|
|
|
+ padding-right: 16px;
|
|
|
+ .ant-badge {
|
|
|
+ margin-top: 7px;
|
|
|
+ cursor: pointer;
|
|
|
+ > svg {
|
|
|
+ font-size: 24px;
|
|
|
+ }
|
|
|
+ .ant-badge-dot {
|
|
|
+ box-shadow: 0 0 0 1px @m-red0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .ant-avatar-icon {
|
|
|
+ margin-top: -3px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .middleLayout {
|
|
|
+ flex: 1;
|
|
|
+ width: 100%;
|
|
|
+ .inlineflex;
|
|
|
+ border-bottom: 1px solid @m-black2;
|
|
|
+ .m-layout-left {
|
|
|
+ height: 100%;
|
|
|
+ background: @m-black4;
|
|
|
+ .ant-layout-sider-children {
|
|
|
+ ul.ant-menu.ant-menu-inline {
|
|
|
+ li.ant-menu-submenu {
|
|
|
+ padding-bottom: 0;
|
|
|
+ .ant-menu-submenu-title {
|
|
|
+ color: @m-grey2;
|
|
|
+ font-size: 16px;
|
|
|
+ height: 60px;
|
|
|
+ line-height: 60px;
|
|
|
+ margin-top: 0;
|
|
|
+ margin-bottom: 0;
|
|
|
+ padding: 5px 0;
|
|
|
+ .icon {
|
|
|
+ font-size: 20px;
|
|
|
+ }
|
|
|
+ .menu-item_title {
|
|
|
+ display: inline-block;
|
|
|
+ font-size: 16px;
|
|
|
+ margin-left: 15px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .ant-menu-sub {
|
|
|
+ .ant-menu-item {
|
|
|
+ padding-left: 60px !important;
|
|
|
+ margin-top: 5px;
|
|
|
+ margin-bottom: 5px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ li.ant-menu-submenu-open {
|
|
|
+ .ant-menu-submenu-title {
|
|
|
+ color: @m-white0;
|
|
|
+ .icon {
|
|
|
+ color: @m-white0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .ant-menu-sub {
|
|
|
+ .ant-menu-item.ant-menu-item-selected {
|
|
|
+ background-color: @m-blue0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .ant-layout-sider-trigger {
|
|
|
+ width: 100%;
|
|
|
+ height: 40px;
|
|
|
+ line-height: 40px;
|
|
|
+ background: @m-black0;
|
|
|
+ position: absolute;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .ant-menu-vertical {
|
|
|
+ .ant-menu-submenu-vertical {
|
|
|
+ height: 60px;
|
|
|
+ line-height: 60px;
|
|
|
+ padding: 5px 0;
|
|
|
+ .ant-menu-submenu-title {
|
|
|
+ height: 50px;
|
|
|
+ line-height: 50px;
|
|
|
+ .icon {
|
|
|
+ font-size: 20px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .ant-menu-submenu {
|
|
|
+ .ant-menu-submenu-title {
|
|
|
+ .menu-item_title {
|
|
|
+ display: none;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .bottomLayout {
|
|
|
+ width: 100%;
|
|
|
+ flex: none;
|
|
|
+ height: @bottomHeight;
|
|
|
+ .inlineflex;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|