mooho-base-admin-plus 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env +5 -0
- package/.env.development +0 -0
- package/.env.production +0 -0
- package/.eslintignore +11 -0
- package/.eslintrc.js +47 -0
- package/.prettierrc +15 -0
- package/README.md +18 -0
- package/dist/favicon.ico +0 -0
- package/dist/mooho-base-admin-plus.min.esm.js +131746 -0
- package/dist/mooho-base-admin-plus.min.js +279 -0
- package/dist/setting.js +31 -0
- package/dist/static/images/app-barcode.png +0 -0
- package/dist/static/images/login/bg.png +0 -0
- package/dist/static/images/login/logo.png +0 -0
- package/dist/static/images/login/password-active.png +0 -0
- package/dist/static/images/login/password-default.png +0 -0
- package/dist/static/images/login/signIn-img.png +0 -0
- package/dist/static/images/login/user-active.png +0 -0
- package/dist/static/images/login/user-default.png +0 -0
- package/dist/static/images/logo-dark.png +0 -0
- package/dist/static/images/logo-small.png +0 -0
- package/dist/static/images/logo.png +0 -0
- package/dist/static/images/logo.svg +510 -0
- package/dist/static/images/no-image.png +0 -0
- package/dist/style.css +4 -0
- package/index.html +18 -0
- package/other/pda.vue +28 -0
- package/package.json +59 -0
- package/public/favicon.ico +0 -0
- package/public/setting.js +31 -0
- package/public/static/images/app-barcode.png +0 -0
- package/public/static/images/login/bg.png +0 -0
- package/public/static/images/login/logo.png +0 -0
- package/public/static/images/login/password-active.png +0 -0
- package/public/static/images/login/password-default.png +0 -0
- package/public/static/images/login/signIn-img.png +0 -0
- package/public/static/images/login/user-active.png +0 -0
- package/public/static/images/login/user-default.png +0 -0
- package/public/static/images/logo-dark.png +0 -0
- package/public/static/images/logo-small.png +0 -0
- package/public/static/images/logo.png +0 -0
- package/public/static/images/logo.svg +510 -0
- package/public/static/images/no-image.png +0 -0
- package/src/App.vue +60 -0
- package/src/api/application.js +35 -0
- package/src/api/customModel.js +187 -0
- package/src/api/customPage.js +15 -0
- package/src/api/customTable.js +24 -0
- package/src/api/dataSource.js +93 -0
- package/src/api/dataView.js +199 -0
- package/src/api/dictType.js +23 -0
- package/src/api/entityView.js +13 -0
- package/src/api/enum.js +15 -0
- package/src/api/filterColumn.js +16 -0
- package/src/api/model.js +244 -0
- package/src/api/movePlan.js +29 -0
- package/src/api/notification.js +28 -0
- package/src/api/openApiPermission.js +25 -0
- package/src/api/permission.js +51 -0
- package/src/api/planJob.js +15 -0
- package/src/api/process.js +23 -0
- package/src/api/processDef.js +36 -0
- package/src/api/processInst.js +16 -0
- package/src/api/rolePermission.js +17 -0
- package/src/api/roleProperty.js +36 -0
- package/src/api/shortcut.js +20 -0
- package/src/api/system.js +23 -0
- package/src/api/task.js +56 -0
- package/src/api/taskQueue.js +24 -0
- package/src/api/user.js +45 -0
- package/src/api/viewColumn.js +16 -0
- package/src/assets/svg/body.svg +17 -0
- package/src/assets/svg/header-theme-dark.svg +40 -0
- package/src/assets/svg/header-theme-primary.svg +40 -0
- package/src/assets/svg/header-top.svg +40 -0
- package/src/assets/svg/icon-happy.svg +1 -0
- package/src/assets/svg/icon-sad.svg +1 -0
- package/src/assets/svg/icon-social-bilibili.svg +1 -0
- package/src/assets/svg/icon-social-dingding.svg +1 -0
- package/src/assets/svg/icon-social-facebook.svg +1 -0
- package/src/assets/svg/icon-social-juejin.svg +1 -0
- package/src/assets/svg/icon-social-qq.svg +1 -0
- package/src/assets/svg/icon-social-twitter.svg +1 -0
- package/src/assets/svg/icon-social-wechat.svg +1 -0
- package/src/assets/svg/icon-social-weibo.svg +1 -0
- package/src/assets/svg/icon-social-zhihu.svg +1 -0
- package/src/assets/svg/nav-theme-dark.svg +40 -0
- package/src/assets/svg/nav-theme-light.svg +40 -0
- package/src/components/copyright/index.vue +28 -0
- package/src/components/home/notice-list.vue +62 -0
- package/src/components/home/shortcut.vue +125 -0
- package/src/components/input/dialog-select.vue +301 -0
- package/src/components/input/item-select.vue +195 -0
- package/src/components/link/index.vue +54 -0
- package/src/components/richEditor/index.vue +86 -0
- package/src/components/upload/file-upload.vue +84 -0
- package/src/components/upload/upload-attachment.vue +119 -0
- package/src/components/upload/upload-image.vue +212 -0
- package/src/components/view/column-check.vue +223 -0
- package/src/components/view/column-edit.vue +850 -0
- package/src/components/view/column-select.vue +206 -0
- package/src/components/view/condition-edit.vue +164 -0
- package/src/components/view/filter-edit.vue +633 -0
- package/src/components/view/filter-setting.vue +126 -0
- package/src/components/view/form-setting-layout.vue +375 -0
- package/src/components/view/form-setting.vue +247 -0
- package/src/components/view/group-column.vue +104 -0
- package/src/components/view/group-method.vue +104 -0
- package/src/components/view/mixin.js +72 -0
- package/src/components/view/modal-form-filter.vue +319 -0
- package/src/components/view/modal-form-sort.vue +248 -0
- package/src/components/view/modal-form.vue +453 -0
- package/src/components/view/modal-table.vue +471 -0
- package/src/components/view/table-filter.vue +702 -0
- package/src/components/view/table-setting.vue +533 -0
- package/src/components/view/view-chart.vue +423 -0
- package/src/components/view/view-form-draggable.vue +837 -0
- package/src/components/view/view-form.vue +1444 -0
- package/src/components/view/view-table.vue +2261 -0
- package/src/components/workflow/flow-chart.vue +846 -0
- package/src/directive/focus.js +10 -0
- package/src/directive/tabHide.js +9 -0
- package/src/i18n/index.js +15 -0
- package/src/i18n/locale/en-US.js +1 -0
- package/src/i18n/locale/lang.js +1 -0
- package/src/i18n/locale/zh-CN.js +1 -0
- package/src/i18n/locale.js +102 -0
- package/src/index.js +222 -0
- package/src/layouts/basic-layout/header-breadcrumb/index.vue +122 -0
- package/src/layouts/basic-layout/header-collapse/index.vue +44 -0
- package/src/layouts/basic-layout/header-fullscreen/index.vue +19 -0
- package/src/layouts/basic-layout/header-i18n/index.vue +45 -0
- package/src/layouts/basic-layout/header-log/index.vue +41 -0
- package/src/layouts/basic-layout/header-logo/index.vue +23 -0
- package/src/layouts/basic-layout/header-notice/index.vue +218 -0
- package/src/layouts/basic-layout/header-reload/index.vue +21 -0
- package/src/layouts/basic-layout/header-search/index.vue +37 -0
- package/src/layouts/basic-layout/header-setting/index.vue +219 -0
- package/src/layouts/basic-layout/header-user/index.vue +175 -0
- package/src/layouts/basic-layout/i18n.js +50 -0
- package/src/layouts/basic-layout/index.vue +280 -0
- package/src/layouts/basic-layout/menu-head/index.vue +120 -0
- package/src/layouts/basic-layout/menu-head/title.vue +48 -0
- package/src/layouts/basic-layout/menu-side/index.vue +113 -0
- package/src/layouts/basic-layout/menu-side/menu-collapse.vue +76 -0
- package/src/layouts/basic-layout/menu-side/menu-item.vue +31 -0
- package/src/layouts/basic-layout/menu-side/menu-title.vue +56 -0
- package/src/layouts/basic-layout/menu-side/submenu.vue +31 -0
- package/src/layouts/basic-layout/mixins/click-item.js +21 -0
- package/src/layouts/basic-layout/mixins/sider-menu-badge.js +13 -0
- package/src/layouts/basic-layout/mixins/translate-title.js +11 -0
- package/src/layouts/basic-layout/tabs/index.vue +192 -0
- package/src/layouts/basic-layout/water-mark/index.vue +29 -0
- package/src/libs/lodop/index.js +145 -0
- package/src/libs/random_str.js +10 -0
- package/src/libs/request/index.js +158 -0
- package/src/libs/system/index.js +234 -0
- package/src/libs/util.cookies.js +44 -0
- package/src/libs/util.db.js +13 -0
- package/src/libs/util.js +55 -0
- package/src/libs/util.log.js +88 -0
- package/src/libs/water-mark.js +44 -0
- package/src/menu/header.js +20 -0
- package/src/menu/modules/dashboard.js +23 -0
- package/src/menu/sider.js +12 -0
- package/src/mixins/app.js +9 -0
- package/src/mixins/page.js +643 -0
- package/src/pages/account/login.vue +101 -0
- package/src/pages/common/home.vue +169 -0
- package/src/pages/common/task-form.vue +350 -0
- package/src/pages/common/todo.vue +31 -0
- package/src/pages/system/apiLog.vue +79 -0
- package/src/pages/system/applicationType.vue +182 -0
- package/src/pages/system/customPage.vue +62 -0
- package/src/pages/system/customTable.vue +98 -0
- package/src/pages/system/dict.vue +36 -0
- package/src/pages/system/dictType.vue +58 -0
- package/src/pages/system/entityView.vue +38 -0
- package/src/pages/system/error/404.vue +6 -0
- package/src/pages/system/extendColumn.vue +99 -0
- package/src/pages/system/formView.vue +136 -0
- package/src/pages/system/log.vue +55 -0
- package/src/pages/system/notice.vue +26 -0
- package/src/pages/system/openApi.vue +26 -0
- package/src/pages/system/openUser.vue +66 -0
- package/src/pages/system/organization.vue +98 -0
- package/src/pages/system/organizationType.vue +26 -0
- package/src/pages/system/permission.vue +175 -0
- package/src/pages/system/planJob.vue +40 -0
- package/src/pages/system/printTemplate.vue +48 -0
- package/src/pages/system/process.vue +79 -0
- package/src/pages/system/processType.vue +26 -0
- package/src/pages/system/role.vue +395 -0
- package/src/pages/system/rolePropertyEdit.vue +480 -0
- package/src/pages/system/sequenceSetting.vue +26 -0
- package/src/pages/system/systemData.vue +52 -0
- package/src/pages/system/tableView.vue +386 -0
- package/src/pages/system/taskQueue.vue +48 -0
- package/src/pages/system/user.vue +250 -0
- package/src/pages/template/processPage.vue +243 -0
- package/src/pages/template/reportPage.vue +66 -0
- package/src/pages/template/viewPage.vue +139 -0
- package/src/plugins/auth/index.js +21 -0
- package/src/plugins/error/index.js +31 -0
- package/src/plugins/index.js +24 -0
- package/src/plugins/sweetalert2/index.js +20 -0
- package/src/router/dynamic.js +183 -0
- package/src/router/index.js +84 -0
- package/src/setting.js +202 -0
- package/src/store/index.js +9 -0
- package/src/store/modules/admin/index.js +16 -0
- package/src/store/modules/admin/modules/account.js +103 -0
- package/src/store/modules/admin/modules/cache.js +119 -0
- package/src/store/modules/admin/modules/dataView.js +112 -0
- package/src/store/modules/admin/modules/db.js +231 -0
- package/src/store/modules/admin/modules/i18n.js +87 -0
- package/src/store/modules/admin/modules/layout.js +115 -0
- package/src/store/modules/admin/modules/loader.js +44 -0
- package/src/store/modules/admin/modules/log.js +77 -0
- package/src/store/modules/admin/modules/menu.js +338 -0
- package/src/store/modules/admin/modules/page.js +466 -0
- package/src/store/modules/admin/modules/user.js +96 -0
- package/src/store/modules/admin/modules/viewPage.js +34 -0
- package/src/styles/common.less +47 -0
- package/src/styles/css/default.css +510 -0
- package/src/styles/css/login.css +1217 -0
- package/src/styles/default/index.less +6 -0
- package/src/styles/font/demo.css +539 -0
- package/src/styles/font/demo_index.html +372 -0
- package/src/styles/font/icon-demo/demo.css +539 -0
- package/src/styles/font/icon-demo/demo_index.html +423 -0
- package/src/styles/font/icon-demo/iconfont.css +61 -0
- package/src/styles/font/icon-demo/iconfont.eot +0 -0
- package/src/styles/font/icon-demo/iconfont.js +1 -0
- package/src/styles/font/icon-demo/iconfont.svg +59 -0
- package/src/styles/font/icon-demo/iconfont.ttf +0 -0
- package/src/styles/font/icon-demo/iconfont.woff +0 -0
- package/src/styles/font/icon-demo/iconfont.woff2 +0 -0
- package/src/styles/font/iconfont.css +47 -0
- package/src/styles/font/iconfont.js +1 -0
- package/src/styles/font/iconfont.json +65 -0
- package/src/styles/font/iconfont.ttf +0 -0
- package/src/styles/font/iconfont.woff +0 -0
- package/src/styles/font/iconfont.woff2 +0 -0
- package/src/styles/font/ionicons.svg +870 -0
- package/src/styles/font/ionicons.ttf +0 -0
- package/src/styles/font/ionicons.woff +0 -0
- package/src/styles/font/ionicons.woff2 +0 -0
- package/src/styles/index.less +7 -0
- package/src/styles/layout/basic-layout/layout.less +527 -0
- package/src/styles/layout/basic-layout/menu.less +274 -0
- package/src/styles/layout/index.less +2 -0
- package/src/styles/setting.less +6 -0
- package/styleguide.config.js +22 -0
- package/test/api/barcode.js +50 -0
- package/test/api/inbound.js +47 -0
- package/test/api/interfaceLog.js +15 -0
- package/test/api/interfaceQueue.js +15 -0
- package/test/api/interfaceServer.js +29 -0
- package/test/api/movePlan.js +50 -0
- package/test/api/movePlanItem.js +13 -0
- package/test/api/moveType.js +22 -0
- package/test/api/openApiPermission.js +25 -0
- package/test/api/outbound.js +40 -0
- package/test/api/permission.js +34 -0
- package/test/api/rolePermission.js +17 -0
- package/test/api/user.js +40 -0
- package/test/api/viewColumn.js +16 -0
- package/test/api/warehouse.js +13 -0
- package/test/api/warehouseMoveType.js +18 -0
- package/test/main.js +55 -0
- package/test/package.js +33 -0
- package/test/pages/home/index.vue +22 -0
- package/test/pages/task/test.vue +28 -0
- package/test/pages/test/dataViewTest.vue +28 -0
- package/test/pages/test/logReport.vue +25 -0
- package/test/pages/test/testPage.vue +38 -0
- package/test/router/routes.js +88 -0
- package/test/setting.env.js +22 -0
- package/test/styles/css/custom.css +0 -0
- package/test/styles/css/login.css +1217 -0
- package/vite.config.js +72 -0
- package/vue.config.js +20 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// 默认布局使用的多语言
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
'zh-CN': {
|
|
5
|
+
basicLayout: {
|
|
6
|
+
search: {
|
|
7
|
+
placeholder: '搜索...',
|
|
8
|
+
cancel: '取消'
|
|
9
|
+
},
|
|
10
|
+
user: {
|
|
11
|
+
center: '个人中心',
|
|
12
|
+
setting: '设置',
|
|
13
|
+
logOut: '退出登录'
|
|
14
|
+
},
|
|
15
|
+
logout: {
|
|
16
|
+
confirmTitle: '退出登录确认',
|
|
17
|
+
confirmContent: '您确定退出登录当前账户吗?打开的标签页和个人设置将会保存。'
|
|
18
|
+
},
|
|
19
|
+
tabs: {
|
|
20
|
+
left: '关闭左侧',
|
|
21
|
+
right: '关闭右侧',
|
|
22
|
+
other: '关闭其它',
|
|
23
|
+
all: '全部关闭'
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
'en-US': {
|
|
28
|
+
basicLayout: {
|
|
29
|
+
search: {
|
|
30
|
+
placeholder: 'Search...',
|
|
31
|
+
cancel: 'Cancel'
|
|
32
|
+
},
|
|
33
|
+
user: {
|
|
34
|
+
center: 'My home',
|
|
35
|
+
setting: 'Setting',
|
|
36
|
+
logOut: 'Log out'
|
|
37
|
+
},
|
|
38
|
+
logout: {
|
|
39
|
+
confirmTitle: 'Logout confirmation',
|
|
40
|
+
confirmContent: 'Are you sure you are logged out of your current account? Open tabs and personal settings will be saved.'
|
|
41
|
+
},
|
|
42
|
+
tabs: {
|
|
43
|
+
left: 'Close left',
|
|
44
|
+
right: 'Close right',
|
|
45
|
+
other: 'Close other',
|
|
46
|
+
all: 'Close all'
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Layout class="i-layout">
|
|
3
|
+
<Sider v-if="!isMobile && !hideSider" class="i-layout-sider" :class="siderClasses" :width="menuSideWidth">
|
|
4
|
+
<i-menu-side :hide-logo="isHeaderStick && headerFix && showHeader" />
|
|
5
|
+
</Sider>
|
|
6
|
+
<Layout class="i-layout-inside" :class="insideClasses">
|
|
7
|
+
<transition name="fade-quick">
|
|
8
|
+
<Header class="i-layout-header" :class="headerClasses" :style="headerStyle" v-show="showHeader" v-resize="handleHeaderWidthChange">
|
|
9
|
+
<i-header-logo v-if="isMobile && showMobileLogo" />
|
|
10
|
+
<i-header-logo v-if="!isMobile && isHeaderStick && headerFix" />
|
|
11
|
+
<i-header-collapse v-if="(isMobile || showSiderCollapse) && !hideSider" @on-toggle-drawer="handleToggleDrawer" />
|
|
12
|
+
<i-header-reload v-if="!isMobile && showReload" @on-reload="handleReload" />
|
|
13
|
+
<i-menu-head v-if="headerMenu && !isMobile" ref="menuHead" />
|
|
14
|
+
<i-header-breadcrumb v-if="showBreadcrumb && !headerMenu && !isMobile" ref="breadcrumb" />
|
|
15
|
+
<i-header-search v-if="showSearch && !headerMenu && !isMobile && !showBreadcrumb" />
|
|
16
|
+
<div class="i-layout-header-right">
|
|
17
|
+
<slot name="header" />
|
|
18
|
+
<i-header-search v-if="(showSearch && isMobile) || (showSearch && (headerMenu || showBreadcrumb))" />
|
|
19
|
+
<i-menu-head v-if="headerMenu && isMobile" />
|
|
20
|
+
<i-header-log v-if="isDesktop && showLog" />
|
|
21
|
+
<i-header-fullscreen v-if="isDesktop && showFullscreen" />
|
|
22
|
+
<i-header-notice v-if="showNotice" />
|
|
23
|
+
<i-header-user />
|
|
24
|
+
<i-header-i18n v-if="showI18n" />
|
|
25
|
+
<i-header-setting v-if="enableSetting && !isMobile" />
|
|
26
|
+
</div>
|
|
27
|
+
</Header>
|
|
28
|
+
</transition>
|
|
29
|
+
<Content class="i-layout-content" :class="contentClasses">
|
|
30
|
+
<transition name="fade-quick">
|
|
31
|
+
<i-tabs v-if="tabs" v-show="showHeader" @on-reload="handleReload" />
|
|
32
|
+
</transition>
|
|
33
|
+
<div class="i-layout-content-main">
|
|
34
|
+
<router-view #default="{ Component }">
|
|
35
|
+
<keep-alive :include="keepAlive">
|
|
36
|
+
<component :is="Component" v-if="loadRouter" />
|
|
37
|
+
</keep-alive>
|
|
38
|
+
</router-view>
|
|
39
|
+
</div>
|
|
40
|
+
</Content>
|
|
41
|
+
<i-copyright />
|
|
42
|
+
</Layout>
|
|
43
|
+
<div v-if="isMobile && !hideSider">
|
|
44
|
+
<Drawer v-model="showDrawer" placement="left" :closable="false" :class-name="drawerClasses">
|
|
45
|
+
<i-menu-side />
|
|
46
|
+
</Drawer>
|
|
47
|
+
</div>
|
|
48
|
+
<i-water-mark />
|
|
49
|
+
</Layout>
|
|
50
|
+
</template>
|
|
51
|
+
<script>
|
|
52
|
+
import { nextTick } from 'vue';
|
|
53
|
+
import { mapState, mapGetters, mapMutations } from 'vuex';
|
|
54
|
+
|
|
55
|
+
import iMenuHead from './menu-head';
|
|
56
|
+
import iMenuSide from './menu-side';
|
|
57
|
+
import iHeaderLogo from './header-logo';
|
|
58
|
+
import iHeaderCollapse from './header-collapse';
|
|
59
|
+
import iHeaderReload from './header-reload';
|
|
60
|
+
import iHeaderBreadcrumb from './header-breadcrumb';
|
|
61
|
+
import iHeaderSearch from './header-search';
|
|
62
|
+
import iHeaderLog from './header-log';
|
|
63
|
+
import iHeaderFullscreen from './header-fullscreen';
|
|
64
|
+
import iHeaderNotice from './header-notice';
|
|
65
|
+
import iHeaderUser from './header-user';
|
|
66
|
+
import iHeaderI18n from './header-i18n';
|
|
67
|
+
import iHeaderSetting from './header-setting';
|
|
68
|
+
import iTabs from './tabs';
|
|
69
|
+
import iWaterMark from './water-mark';
|
|
70
|
+
import iCopyright from '../../components/copyright';
|
|
71
|
+
|
|
72
|
+
import Setting from '../../setting';
|
|
73
|
+
|
|
74
|
+
import { requestAnimation } from '../../libs/util';
|
|
75
|
+
|
|
76
|
+
export default {
|
|
77
|
+
name: 'BasicLayout',
|
|
78
|
+
components: {
|
|
79
|
+
iMenuHead,
|
|
80
|
+
iMenuSide,
|
|
81
|
+
iCopyright,
|
|
82
|
+
iHeaderLogo,
|
|
83
|
+
iHeaderCollapse,
|
|
84
|
+
iHeaderReload,
|
|
85
|
+
iHeaderBreadcrumb,
|
|
86
|
+
iHeaderSearch,
|
|
87
|
+
iHeaderUser,
|
|
88
|
+
iHeaderI18n,
|
|
89
|
+
iHeaderLog,
|
|
90
|
+
iHeaderFullscreen,
|
|
91
|
+
iHeaderSetting,
|
|
92
|
+
iHeaderNotice,
|
|
93
|
+
iTabs,
|
|
94
|
+
iWaterMark
|
|
95
|
+
},
|
|
96
|
+
data() {
|
|
97
|
+
return {
|
|
98
|
+
showDrawer: false,
|
|
99
|
+
ticking: false,
|
|
100
|
+
headerVisible: true,
|
|
101
|
+
oldScrollTop: 0,
|
|
102
|
+
isDelayHideSider: false, // hack,当从隐藏侧边栏的 header 切换到正常 header 时,防止 Logo 抖动
|
|
103
|
+
loadRouter: true
|
|
104
|
+
};
|
|
105
|
+
},
|
|
106
|
+
computed: {
|
|
107
|
+
...mapState('admin/layout', [
|
|
108
|
+
'siderTheme',
|
|
109
|
+
'headerTheme',
|
|
110
|
+
'headerStick',
|
|
111
|
+
'tabs',
|
|
112
|
+
'tabsFix',
|
|
113
|
+
'siderFix',
|
|
114
|
+
'headerFix',
|
|
115
|
+
'headerHide',
|
|
116
|
+
'headerMenu',
|
|
117
|
+
'isMobile',
|
|
118
|
+
'isTablet',
|
|
119
|
+
'isDesktop',
|
|
120
|
+
'menuCollapse',
|
|
121
|
+
'showMobileLogo',
|
|
122
|
+
'showSearch',
|
|
123
|
+
'showNotice',
|
|
124
|
+
'showFullscreen',
|
|
125
|
+
'showSiderCollapse',
|
|
126
|
+
'showBreadcrumb',
|
|
127
|
+
'showLog',
|
|
128
|
+
'showI18n',
|
|
129
|
+
'showReload',
|
|
130
|
+
'enableSetting'
|
|
131
|
+
]),
|
|
132
|
+
...mapState('admin/page', ['keepAlive']),
|
|
133
|
+
...mapGetters('admin/menu', ['hideSider']),
|
|
134
|
+
// 如果开启 headerMenu,且当前 header 的 hideSider 为 true,则将顶部按 headerStick 处理
|
|
135
|
+
// 这时,即使没有开启 headerStick,仍然按开启处理
|
|
136
|
+
isHeaderStick() {
|
|
137
|
+
let state = this.headerStick;
|
|
138
|
+
if (this.hideSider) state = true;
|
|
139
|
+
return state;
|
|
140
|
+
},
|
|
141
|
+
showHeader() {
|
|
142
|
+
let visible = true;
|
|
143
|
+
if (this.headerFix && this.headerHide && !this.headerVisible) visible = false;
|
|
144
|
+
return visible;
|
|
145
|
+
},
|
|
146
|
+
headerClasses() {
|
|
147
|
+
return [
|
|
148
|
+
`i-layout-header-color-${this.headerTheme}`,
|
|
149
|
+
{
|
|
150
|
+
'i-layout-header-fix': this.headerFix,
|
|
151
|
+
'i-layout-header-fix-collapse': this.headerFix && this.menuCollapse,
|
|
152
|
+
'i-layout-header-mobile': this.isMobile,
|
|
153
|
+
'i-layout-header-stick': this.isHeaderStick && !this.isMobile,
|
|
154
|
+
'i-layout-header-with-menu': this.headerMenu,
|
|
155
|
+
'i-layout-header-with-hide-sider': this.hideSider || this.isDelayHideSider
|
|
156
|
+
}
|
|
157
|
+
];
|
|
158
|
+
},
|
|
159
|
+
headerStyle() {
|
|
160
|
+
const menuWidth = this.isHeaderStick ? 0 : this.menuCollapse ? Setting.menuSideCollapseWidth : Setting.menuSideWidth;
|
|
161
|
+
return this.isMobile || !this.headerFix
|
|
162
|
+
? {}
|
|
163
|
+
: {
|
|
164
|
+
width: `calc(100% - ${menuWidth}px)`
|
|
165
|
+
};
|
|
166
|
+
},
|
|
167
|
+
siderClasses() {
|
|
168
|
+
return {
|
|
169
|
+
'i-layout-sider-fix': this.siderFix,
|
|
170
|
+
'i-layout-sider-dark': this.siderTheme === 'dark'
|
|
171
|
+
};
|
|
172
|
+
},
|
|
173
|
+
contentClasses() {
|
|
174
|
+
return {
|
|
175
|
+
'i-layout-content-fix-with-header': this.headerFix,
|
|
176
|
+
'i-layout-content-with-tabs': this.tabs,
|
|
177
|
+
'i-layout-content-with-tabs-fix': this.tabs && this.tabsFix
|
|
178
|
+
};
|
|
179
|
+
},
|
|
180
|
+
insideClasses() {
|
|
181
|
+
return {
|
|
182
|
+
'i-layout-inside-fix-with-sider': this.siderFix,
|
|
183
|
+
'i-layout-inside-fix-with-sider-collapse': this.siderFix && this.menuCollapse,
|
|
184
|
+
'i-layout-inside-with-hide-sider': this.hideSider,
|
|
185
|
+
'i-layout-inside-mobile': this.isMobile
|
|
186
|
+
};
|
|
187
|
+
},
|
|
188
|
+
drawerClasses() {
|
|
189
|
+
let className = 'i-layout-drawer';
|
|
190
|
+
if (this.siderTheme === 'dark') className += ' i-layout-drawer-dark';
|
|
191
|
+
return className;
|
|
192
|
+
},
|
|
193
|
+
menuSideWidth() {
|
|
194
|
+
return this.menuCollapse ? Setting.menuSideCollapseWidth : Setting.menuSideWidth;
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
watch: {
|
|
198
|
+
hideSider() {
|
|
199
|
+
this.isDelayHideSider = true;
|
|
200
|
+
setTimeout(() => {
|
|
201
|
+
this.isDelayHideSider = false;
|
|
202
|
+
}, 0);
|
|
203
|
+
},
|
|
204
|
+
$route(to, from) {
|
|
205
|
+
if (to.name === from.name) {
|
|
206
|
+
// 相同路由,不同参数,跳转时,重载页面
|
|
207
|
+
if (Setting.sameRouteForceUpdate) {
|
|
208
|
+
this.handleReload();
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
methods: {
|
|
214
|
+
...mapMutations('admin/layout', ['updateMenuCollapse']),
|
|
215
|
+
...mapMutations('admin/page', ['keepAlivePush', 'keepAliveRemove']),
|
|
216
|
+
handleToggleDrawer(state) {
|
|
217
|
+
if (typeof state === 'boolean') {
|
|
218
|
+
this.showDrawer = state;
|
|
219
|
+
} else {
|
|
220
|
+
this.showDrawer = !this.showDrawer;
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
handleScroll() {
|
|
224
|
+
if (!this.headerHide) return;
|
|
225
|
+
|
|
226
|
+
const scrollTop = document.body.scrollTop + document.documentElement.scrollTop;
|
|
227
|
+
|
|
228
|
+
if (!this.ticking) {
|
|
229
|
+
this.ticking = true;
|
|
230
|
+
requestAnimation(() => {
|
|
231
|
+
if (this.oldScrollTop > scrollTop) {
|
|
232
|
+
this.headerVisible = true;
|
|
233
|
+
} else if (scrollTop > 300 && this.headerVisible) {
|
|
234
|
+
this.headerVisible = false;
|
|
235
|
+
} else if (scrollTop < 300 && !this.headerVisible) {
|
|
236
|
+
this.headerVisible = true;
|
|
237
|
+
}
|
|
238
|
+
this.oldScrollTop = scrollTop;
|
|
239
|
+
this.ticking = false;
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
handleHeaderWidthChange() {
|
|
244
|
+
const $breadcrumb = this.$refs.breadcrumb;
|
|
245
|
+
if ($breadcrumb) {
|
|
246
|
+
$breadcrumb.handleGetWidth();
|
|
247
|
+
$breadcrumb.handleCheckWidth();
|
|
248
|
+
}
|
|
249
|
+
const $menuHead = this.$refs.menuHead;
|
|
250
|
+
if ($menuHead) {
|
|
251
|
+
// todo $menuHead.handleGetMenuHeight();
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
handleReload() {
|
|
255
|
+
// 针对缓存的页面也生效
|
|
256
|
+
const isCurrentPageCache = this.keepAlive.indexOf(this.$route.name) > -1;
|
|
257
|
+
const pageName = this.$route.name;
|
|
258
|
+
if (isCurrentPageCache) {
|
|
259
|
+
this.keepAliveRemove(pageName);
|
|
260
|
+
}
|
|
261
|
+
this.loadRouter = false;
|
|
262
|
+
nextTick(() => {
|
|
263
|
+
this.loadRouter = true;
|
|
264
|
+
if (isCurrentPageCache) {
|
|
265
|
+
this.keepAlivePush(pageName);
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
mounted() {
|
|
271
|
+
document.addEventListener('scroll', this.handleScroll, { passive: true });
|
|
272
|
+
},
|
|
273
|
+
beforeUnmount() {
|
|
274
|
+
document.removeEventListener('scroll', this.handleScroll);
|
|
275
|
+
},
|
|
276
|
+
created() {
|
|
277
|
+
if (this.isTablet && this.showSiderCollapse) this.updateMenuCollapse(true);
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
</script>
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="i-layout-menu-head" :class="{ 'i-layout-menu-head-mobile': isMobile }">
|
|
3
|
+
<Menu mode="horizontal" :active-name="headerName" v-if="!isMobile && !isMenuLimit" ref="menu">
|
|
4
|
+
<template v-for="(item, index) in filterHeader" :key="item.path">
|
|
5
|
+
<Submenu v-if="item.children && item.children.length" :name="item.name" :key="index">
|
|
6
|
+
<template #title>
|
|
7
|
+
<i-menu-head-title :item="item" badge />
|
|
8
|
+
</template>
|
|
9
|
+
<MenuItem
|
|
10
|
+
v-for="subitem in item.children"
|
|
11
|
+
:to="subitem.path"
|
|
12
|
+
:replace="subitem.replace"
|
|
13
|
+
:target="subitem.target"
|
|
14
|
+
:name="item.name"
|
|
15
|
+
:key="subitem.path"
|
|
16
|
+
@click="handleClick(subitem.path, 'header')"
|
|
17
|
+
>
|
|
18
|
+
<i-menu-head-title :item="subitem" badge />
|
|
19
|
+
</MenuItem>
|
|
20
|
+
</Submenu>
|
|
21
|
+
<MenuItem v-else :to="item.path" :replace="item.replace" :target="item.target" :name="item.name" :key="item.path" @click="handleClick(item.path, 'header')">
|
|
22
|
+
<i-menu-head-title :item="item" badge />
|
|
23
|
+
</MenuItem>
|
|
24
|
+
</template>
|
|
25
|
+
</Menu>
|
|
26
|
+
<div class="i-layout-header-trigger i-layout-header-trigger-min i-layout-header-trigger-in i-layout-header-trigger-no-height" v-else>
|
|
27
|
+
<Dropdown trigger="click" :class="{ 'i-layout-menu-head-mobile-drop': isMobile }">
|
|
28
|
+
<Icon type="ios-apps" />
|
|
29
|
+
<template #list>
|
|
30
|
+
<DropdownMenu>
|
|
31
|
+
<template v-for="(item, index) in filterHeader">
|
|
32
|
+
<template v-if="item.children && item.children.length">
|
|
33
|
+
<DropdownItem class="i-layout-menu-head-mobile-subtitle" disabled :key="index">
|
|
34
|
+
<i-menu-head-title :item="item" badge />
|
|
35
|
+
</DropdownItem>
|
|
36
|
+
<i-link
|
|
37
|
+
v-for="subitem in item.children"
|
|
38
|
+
:to="subitem.path"
|
|
39
|
+
:replace="subitem.replace"
|
|
40
|
+
:target="subitem.target"
|
|
41
|
+
:key="subitem.path"
|
|
42
|
+
@click="handleClick(subitem.path, 'header')"
|
|
43
|
+
>
|
|
44
|
+
<DropdownItem>
|
|
45
|
+
<i-menu-head-title :item="subitem" badge />
|
|
46
|
+
</DropdownItem>
|
|
47
|
+
</i-link>
|
|
48
|
+
</template>
|
|
49
|
+
<i-link v-else :to="item.path" :replace="item.replace" :target="item.target" :key="item.path" @click="handleClick(item.path, 'header')">
|
|
50
|
+
<DropdownItem>
|
|
51
|
+
<i-menu-head-title :item="item" badge />
|
|
52
|
+
</DropdownItem>
|
|
53
|
+
</i-link>
|
|
54
|
+
</template>
|
|
55
|
+
</DropdownMenu>
|
|
56
|
+
</template>
|
|
57
|
+
</Dropdown>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</template>
|
|
61
|
+
<script>
|
|
62
|
+
import iMenuHeadTitle from './title';
|
|
63
|
+
import { mapState, mapGetters } from 'vuex';
|
|
64
|
+
import { getStyle } from 'view-ui-plus/src/utils/assist';
|
|
65
|
+
import clickItem from '../mixins/click-item';
|
|
66
|
+
import Setting from '../../../setting';
|
|
67
|
+
// import { on, off } from 'view-ui-plus/src/utils/dom';
|
|
68
|
+
// import { throttle } from 'lodash';
|
|
69
|
+
|
|
70
|
+
export default {
|
|
71
|
+
name: 'iMenuHead',
|
|
72
|
+
components: { iMenuHeadTitle },
|
|
73
|
+
mixins: [clickItem],
|
|
74
|
+
computed: {
|
|
75
|
+
...mapState('admin/layout', ['isMobile']),
|
|
76
|
+
...mapState('admin/menu', ['headerName']),
|
|
77
|
+
...mapGetters('admin/menu', ['filterHeader'])
|
|
78
|
+
},
|
|
79
|
+
data() {
|
|
80
|
+
return {
|
|
81
|
+
handleResize: () => {},
|
|
82
|
+
isMenuLimit: false,
|
|
83
|
+
menuMaxWidth: 0 // 达到这个值后,menu 就显示不下了
|
|
84
|
+
};
|
|
85
|
+
},
|
|
86
|
+
methods: {
|
|
87
|
+
handleGetMenuHeight() {
|
|
88
|
+
const menuWidth = parseInt(getStyle(this.$el, 'width'));
|
|
89
|
+
const $menu = this.$refs.menu;
|
|
90
|
+
if ($menu) {
|
|
91
|
+
const menuHeight = parseInt(getStyle(this.$refs.menu.$el, 'height'));
|
|
92
|
+
if (menuHeight > Setting.headerHeight) {
|
|
93
|
+
if (!this.isMenuLimit) {
|
|
94
|
+
this.menuMaxWidth = menuWidth;
|
|
95
|
+
}
|
|
96
|
+
this.isMenuLimit = true;
|
|
97
|
+
}
|
|
98
|
+
} else if (menuWidth >= this.menuMaxWidth) {
|
|
99
|
+
this.isMenuLimit = false;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
watch: {
|
|
104
|
+
filterHeader() {
|
|
105
|
+
this.handleGetMenuHeight();
|
|
106
|
+
},
|
|
107
|
+
isMobile() {
|
|
108
|
+
this.handleGetMenuHeight();
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
mounted() {
|
|
112
|
+
// this.handleResize = throttle(this.handleGetMenuHeight, 100, { leading: false });
|
|
113
|
+
// on(window, 'resize', this.handleResize);
|
|
114
|
+
this.handleGetMenuHeight();
|
|
115
|
+
},
|
|
116
|
+
beforeUnmount() {
|
|
117
|
+
// off(window, 'resize', this.handleResize);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
</script>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="i-layout-menu-head-title">
|
|
3
|
+
<span class="i-layout-menu-head-title-icon" v-if="(item.icon || item.custom || item.img) && !hideIcon">
|
|
4
|
+
<Icon :type="item.icon" v-if="item.icon" />
|
|
5
|
+
<Icon :custom="item.custom" v-else-if="item.custom" />
|
|
6
|
+
<img :src="item.img" v-else-if="item.img" />
|
|
7
|
+
</span>
|
|
8
|
+
<span class="i-layout-menu-head-title-text">{{ tTitle(item.title) }}</span>
|
|
9
|
+
<Badge class="i-layout-menu-head-badge" v-if="badge && badgeData" v-bind="badgeData" />
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
<script>
|
|
13
|
+
/**
|
|
14
|
+
* 该组件除了 Menu,也被 Breadcrumb 使用过
|
|
15
|
+
* */
|
|
16
|
+
import { mapState } from 'vuex';
|
|
17
|
+
import tTitle from '../mixins/translate-title';
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
name: 'iMenuHeadTitle',
|
|
21
|
+
mixins: [tTitle],
|
|
22
|
+
props: {
|
|
23
|
+
item: {
|
|
24
|
+
type: Object,
|
|
25
|
+
default() {
|
|
26
|
+
return {};
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
hideIcon: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false
|
|
32
|
+
},
|
|
33
|
+
badge: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
computed: {
|
|
39
|
+
...mapState('admin/menu', ['headerMenuBadge']),
|
|
40
|
+
badgeData() {
|
|
41
|
+
let data = null;
|
|
42
|
+
const headerMenuBadge = this.headerMenuBadge.find(item => item.path === this.item.path);
|
|
43
|
+
if (headerMenuBadge) data = headerMenuBadge;
|
|
44
|
+
return data;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
</script>
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div class="i-layout-sider-logo" :class="{ 'i-layout-sider-logo-dark': siderTheme === 'dark' }">
|
|
4
|
+
<transition name="fade-quick">
|
|
5
|
+
<i-link to="/" v-show="!hideLogo">
|
|
6
|
+
<img :src="rootPath + 'images/logo-small.png'" v-if="menuCollapse" />
|
|
7
|
+
<img :src="rootPath + 'images/logo.png'" v-else-if="siderTheme === 'light'" />
|
|
8
|
+
<img :src="rootPath + 'images/logo-dark.png'" v-else />
|
|
9
|
+
</i-link>
|
|
10
|
+
</transition>
|
|
11
|
+
</div>
|
|
12
|
+
<Menu
|
|
13
|
+
ref="menu"
|
|
14
|
+
class="i-layout-menu-side i-scrollbar-hide"
|
|
15
|
+
:class="{ 'i-layout-menu-side-collapse': menuCollapse }"
|
|
16
|
+
:theme="siderTheme"
|
|
17
|
+
:accordion="menuAccordion"
|
|
18
|
+
:active-name="activePath"
|
|
19
|
+
:open-names="openNames"
|
|
20
|
+
width="auto"
|
|
21
|
+
>
|
|
22
|
+
<template v-for="(item, index) in filterSider">
|
|
23
|
+
<template v-if="!menuCollapse">
|
|
24
|
+
<i-menu-side-item v-if="item.children === undefined || !item.children.length" :menu="item" :key="index" />
|
|
25
|
+
<i-menu-side-submenu v-else :menu="item" :key="'submenu' + index" />
|
|
26
|
+
</template>
|
|
27
|
+
<template v-else>
|
|
28
|
+
<Tooltip :content="tTitle(item.title)" placement="right" v-if="item.children === undefined || !item.children.length" :key="index" :theme="siderTheme">
|
|
29
|
+
<i-menu-side-item class="i-layout-menu-side-collapse-top-item" :menu="item" hide-title />
|
|
30
|
+
</Tooltip>
|
|
31
|
+
<i-menu-side-collapse v-else :menu="item" top-level :key="'collapse' + index" />
|
|
32
|
+
</template>
|
|
33
|
+
</template>
|
|
34
|
+
</Menu>
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
|
37
|
+
<script>
|
|
38
|
+
import { nextTick } from 'vue';
|
|
39
|
+
import { mapState, mapGetters } from 'vuex';
|
|
40
|
+
import Setting from '../../../setting';
|
|
41
|
+
|
|
42
|
+
import iMenuSideItem from './menu-item';
|
|
43
|
+
import iMenuSideSubmenu from './submenu';
|
|
44
|
+
import iMenuSideCollapse from './menu-collapse';
|
|
45
|
+
import tTitle from '../mixins/translate-title';
|
|
46
|
+
|
|
47
|
+
// 元素是否在可视区域
|
|
48
|
+
function isElementInViewport(el) {
|
|
49
|
+
let rect = el.getBoundingClientRect();
|
|
50
|
+
return (
|
|
51
|
+
rect.top >= 0 &&
|
|
52
|
+
rect.left >= 0 &&
|
|
53
|
+
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
|
|
54
|
+
rect.right <= (window.innerWidth || document.documentElement.clientWidth)
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export default {
|
|
59
|
+
name: 'iMenuSide',
|
|
60
|
+
mixins: [tTitle],
|
|
61
|
+
components: { iMenuSideItem, iMenuSideSubmenu, iMenuSideCollapse },
|
|
62
|
+
props: {
|
|
63
|
+
hideLogo: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: false
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
computed: {
|
|
69
|
+
...mapState('admin/layout', ['siderTheme', 'menuAccordion', 'menuCollapse']),
|
|
70
|
+
...mapState('admin/menu', ['activePath', 'openNames']),
|
|
71
|
+
...mapGetters('admin/menu', ['filterSider']),
|
|
72
|
+
rootPath() {
|
|
73
|
+
return Setting.rootPath;
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
watch: {
|
|
77
|
+
$route: {
|
|
78
|
+
handler() {
|
|
79
|
+
this.handleUpdateMenuState();
|
|
80
|
+
},
|
|
81
|
+
immediate: true
|
|
82
|
+
},
|
|
83
|
+
// 在展开/收起侧边菜单栏时,更新一次 menu 的状态
|
|
84
|
+
menuCollapse() {
|
|
85
|
+
this.handleUpdateMenuState();
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
methods: {
|
|
89
|
+
handleUpdateMenuState() {
|
|
90
|
+
nextTick(() => {
|
|
91
|
+
if (this.$refs.menu) {
|
|
92
|
+
this.$refs.menu.updateActiveName();
|
|
93
|
+
if (this.menuAccordion) this.$refs.menu.updateOpened();
|
|
94
|
+
// 聚焦当前项
|
|
95
|
+
nextTick(() => {
|
|
96
|
+
const $activeMenu = document.getElementsByClassName('ivu-menu-item ivu-menu-item-active ivu-menu-item-selected');
|
|
97
|
+
if ($activeMenu && $activeMenu.length && !isElementInViewport($activeMenu[0])) {
|
|
98
|
+
const activeMenuTop = $activeMenu[0].getBoundingClientRect().top - Setting.headerHeight;
|
|
99
|
+
const $menu = this.$refs.menu.$el;
|
|
100
|
+
setTimeout(() => {
|
|
101
|
+
this.$ScrollTop($menu, {
|
|
102
|
+
to: activeMenuTop,
|
|
103
|
+
time: 0
|
|
104
|
+
});
|
|
105
|
+
}, 300);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
</script>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Dropdown :transfer="false" boundaries-element="viewport" placement="right-start" :class="dropdownClasses">
|
|
3
|
+
<li :class="menuItemClasses" v-if="topLevel">
|
|
4
|
+
<i-menu-side-title :menu="menu" hide-title collapse />
|
|
5
|
+
</li>
|
|
6
|
+
<DropdownItem v-else>
|
|
7
|
+
<i-menu-side-title :menu="menu" :selected="openNames.indexOf(menu.path) >= 0" collapse />
|
|
8
|
+
<Icon type="ios-arrow-forward" class="i-layout-menu-side-arrow" />
|
|
9
|
+
</DropdownItem>
|
|
10
|
+
<template #list>
|
|
11
|
+
<DropdownMenu class="i-layout-menu-side-collapse-dropdown-menu" :style="dropdownMenuMaxHeight">
|
|
12
|
+
<div class="i-layout-menu-side-collapse-title" v-if="showCollapseMenuTitle">
|
|
13
|
+
<i-menu-side-title :menu="menu" collapse />
|
|
14
|
+
</div>
|
|
15
|
+
<template v-for="(item, index) in menu.children">
|
|
16
|
+
<i-link :to="item.path" :target="item.target" v-if="item.children === undefined || !item.children.length" :key="index" @click="handleClick(item.path)">
|
|
17
|
+
<DropdownItem :divided="item.divided" :class="{ 'i-layout-menu-side-collapse-item-selected': item.path === activePath }">
|
|
18
|
+
<i-menu-side-title :menu="item" collapse />
|
|
19
|
+
</DropdownItem>
|
|
20
|
+
</i-link>
|
|
21
|
+
<i-menu-side-collapse v-else :menu="item" :key="'collapse-' + index" />
|
|
22
|
+
</template>
|
|
23
|
+
</DropdownMenu>
|
|
24
|
+
</template>
|
|
25
|
+
</Dropdown>
|
|
26
|
+
</template>
|
|
27
|
+
<script>
|
|
28
|
+
import iMenuSideTitle from './menu-title';
|
|
29
|
+
import clickItem from '../mixins/click-item';
|
|
30
|
+
import Setting from '../../../setting';
|
|
31
|
+
|
|
32
|
+
import { mapState } from 'vuex';
|
|
33
|
+
|
|
34
|
+
export default {
|
|
35
|
+
name: 'iMenuSideCollapse',
|
|
36
|
+
components: { iMenuSideTitle },
|
|
37
|
+
mixins: [clickItem],
|
|
38
|
+
props: {
|
|
39
|
+
menu: {
|
|
40
|
+
type: Object,
|
|
41
|
+
default() {
|
|
42
|
+
return {};
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
// 是否是第一级,区分在于左侧和展开侧
|
|
46
|
+
topLevel: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
computed: {
|
|
52
|
+
...mapState('admin/layout', ['siderTheme', 'showCollapseMenuTitle', 'bodyHeight']),
|
|
53
|
+
...mapState('admin/menu', ['activePath', 'openNames']),
|
|
54
|
+
dropdownClasses() {
|
|
55
|
+
return {
|
|
56
|
+
'i-layout-menu-side-collapse-top': this.topLevel,
|
|
57
|
+
'i-layout-menu-side-collapse-dark': this.siderTheme === 'dark'
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
menuItemClasses() {
|
|
61
|
+
return [
|
|
62
|
+
'ivu-menu-item i-layout-menu-side-collapse-top-item',
|
|
63
|
+
{
|
|
64
|
+
'ivu-menu-item-selected ivu-menu-item-active': this.openNames.indexOf(this.menu.path) >= 0 // -active 在高亮时,有背景
|
|
65
|
+
}
|
|
66
|
+
];
|
|
67
|
+
},
|
|
68
|
+
// 菜单过多时,限高滚动
|
|
69
|
+
dropdownMenuMaxHeight() {
|
|
70
|
+
return {
|
|
71
|
+
'max-height': `calc(${this.bodyHeight}px - ${Setting.headerHeight}px - 32px)`
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
</script>
|