md-iview 1.0.12
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +2 -0
- package/package.json +116 -0
- package/src/components/libs/util.js +117 -0
- package/src/components/md-error-page/403.less +92 -0
- package/src/components/md-error-page/403.vue +34 -0
- package/src/components/md-error-page/404.less +60 -0
- package/src/components/md-error-page/404.vue +34 -0
- package/src/components/md-error-page/500.less +73 -0
- package/src/components/md-error-page/500.vue +36 -0
- package/src/components/md-error-page/demo/index.less +22 -0
- package/src/components/md-error-page/demo/index.vue +97 -0
- package/src/components/md-form-item/index.js +3 -0
- package/src/components/md-icon/icon.vue +77 -0
- package/src/components/md-icon/icons.js +5 -0
- package/src/components/md-icon/index.js +11 -0
- package/src/components/md-icon/style/index.less +1 -0
- package/src/components/md-loading/index.js +55 -0
- package/src/components/md-loading/index.vue +53 -0
- package/src/components/md-loading/md-loading.js +38 -0
- package/src/components/md-print/demo/index.vue +260 -0
- package/src/components/md-print/index.js +123 -0
- package/src/components/md-rich-editor/index.vue +69 -0
- package/src/components/md-rich-editor/module/image-extend/index.js +216 -0
- package/src/components/md-scroll-bar/demo/index.vue +102 -0
- package/src/components/md-scroll-bar/index.js +3 -0
- package/src/components/md-scroll-bar/index.less +90 -0
- package/src/components/md-scroll-bar/index.vue +250 -0
- package/src/components/md-select/index.js +7 -0
- package/src/components/md-select/select.vue +841 -0
- package/src/components/md-shrinkable-menu/components/sidebarMenu.vue +167 -0
- package/src/components/md-shrinkable-menu/components/sidebarMenuShrink.vue +119 -0
- package/src/components/md-shrinkable-menu/demo/data/cachePage.js +1 -0
- package/src/components/md-shrinkable-menu/demo/data/currentPath.js +9 -0
- package/src/components/md-shrinkable-menu/demo/data/menu.js +575 -0
- package/src/components/md-shrinkable-menu/demo/data/menu2.js +1017 -0
- package/src/components/md-shrinkable-menu/demo/data/pageTagsList.js +153 -0
- package/src/components/md-shrinkable-menu/demo/index.less +297 -0
- package/src/components/md-shrinkable-menu/demo/index.vue +285 -0
- package/src/components/md-shrinkable-menu/index.vue +112 -0
- package/src/components/md-shrinkable-menu/sidebar.vue +195 -0
- package/src/components/md-shrinkable-menu/styles/menu.less +5 -0
- package/src/components/md-shrinkable-menu/styles/sidebar.less +363 -0
- package/src/components/md-split-pane/demo/index.vue +101 -0
- package/src/components/md-split-pane/index.js +3 -0
- package/src/components/md-split-pane/index.less +93 -0
- package/src/components/md-split-pane/index.vue +230 -0
- package/src/components/md-table/action-tooltip.vue +45 -0
- package/src/components/md-table/can-edit-v2.vue +823 -0
- package/src/components/md-table/can-edit.vue +723 -0
- package/src/components/md-table/custom-cell.vue +71 -0
- package/src/components/md-table/date-picker-cell-v2.vue +48 -0
- package/src/components/md-table/date-picker-cell.vue +39 -0
- package/src/components/md-table/demo/data/search.js +67 -0
- package/src/components/md-table/demo/data/table2csv.js +200 -0
- package/src/components/md-table/demo/data/table2excel.js +239 -0
- package/src/components/md-table/demo/data/table_data.js +251 -0
- package/src/components/md-table/demo/editable-table.vue +144 -0
- package/src/components/md-table/demo/exportable-table.vue +124 -0
- package/src/components/md-table/demo/widgets/header-search.vue +88 -0
- package/src/components/md-table/drop-down-cell-v2.vue +87 -0
- package/src/components/md-table/drop-down-cell.vue +81 -0
- package/src/components/md-table/editable-expand.vue +143 -0
- package/src/components/md-table/expand.vue +97 -0
- package/src/components/md-table/index.vue +53 -0
- package/src/components/md-table/iview-table/cell.vue +99 -0
- package/src/components/md-table/iview-table/expand.js +21 -0
- package/src/components/md-table/iview-table/export-csv.js +76 -0
- package/src/components/md-table/iview-table/header.js +16 -0
- package/src/components/md-table/iview-table/index.js +2 -0
- package/src/components/md-table/iview-table/mixin.js +31 -0
- package/src/components/md-table/iview-table/table-body.vue +101 -0
- package/src/components/md-table/iview-table/table-head.vue +311 -0
- package/src/components/md-table/iview-table/table-tr.vue +31 -0
- package/src/components/md-table/iview-table/table.vue +1026 -0
- package/src/components/md-table/iview-table/util.js +93 -0
- package/src/components/md-table/libs/table2excel.js +100 -0
- package/src/components/md-table/select-cell-v2.vue +64 -0
- package/src/components/md-table/select-cell.vue +46 -0
- package/src/components/md-table/table.less +76 -0
- package/src/components/md-toolbar/index.vue +171 -0
- package/src/components/md-tree/index.js +2 -0
- package/src/components/md-tree/node.vue +238 -0
- package/src/components/md-tree/render.js +17 -0
- package/src/components/md-tree/tree.vue +241 -0
- package/src/components/utilities/can.js +35 -0
- package/src/directives/index.js +34 -0
- package/src/directives/resize.js +27 -0
- package/src/directives/scroll.js +27 -0
- package/src/directives/style/bg-color.js +23 -0
- package/src/directives/style/color.js +23 -0
- package/src/directives/style/font-size.js +23 -0
- package/src/directives/style/height.js +23 -0
- package/src/directives/style/lineHeight.js +23 -0
- package/src/directives/style/margin.js +48 -0
- package/src/directives/style/opacity.js +23 -0
- package/src/directives/style/padding.js +48 -0
- package/src/directives/style/width.js +24 -0
- package/src/index.js +442 -0
- package/src/locale/lang.js +5 -0
- package/src/mixins/colorable.js +51 -0
- package/src/style/color/bezierEasing.less +110 -0
- package/src/style/color/colorPalette.less +75 -0
- package/src/style/color/colors.less +146 -0
- package/src/style/color/tinyColor.less +1184 -0
- package/src/style/common.less +72 -0
- package/src/style/components/_ripple.less +60 -0
- package/src/style/components/_shrinkable-menu.less +46 -0
- package/src/style/components/_toolbar.less +96 -0
- package/src/style/components/index.less +3 -0
- package/src/style/components/rich-editor.less +6 -0
- package/src/style/index.less +10 -0
- package/src/style/theme.less +155 -0
- package/src/utils/color.js +46 -0
- package/src/utils/console.js +105 -0
- package/src/utils/load.js +79 -0
- package/src/utils/mask.js +139 -0
- package/src/utils/mixins.js +5 -0
- package/src/utils/validate.js +271 -0
@@ -0,0 +1,285 @@
|
|
1
|
+
<style lang="less">
|
2
|
+
@import "index.less";
|
3
|
+
</style>
|
4
|
+
<template>
|
5
|
+
<div class="main" :class="{'main-hide-text': shrink}">
|
6
|
+
<div class="sidebar-menu-con" :style="{width: shrink?'80px':'250px'}">
|
7
|
+
<scroll-bar ref="scrollBar">
|
8
|
+
<shrinkable-menu
|
9
|
+
:shrink="shrink"
|
10
|
+
@on-change="handleSubmenuChange"
|
11
|
+
:theme="menuTheme"
|
12
|
+
:before-push="beforePush"
|
13
|
+
:open-names="openedSubmenuArr"
|
14
|
+
:menu-list="menuList">
|
15
|
+
<!--<div slot="top" class="logo-con">-->
|
16
|
+
<!--<img v-show="!shrink" src="@/assets/logo.png" key="max-logo" />-->
|
17
|
+
<!--<img v-show="shrink" src="@/assets/logo.png" key="min-logo" />-->
|
18
|
+
<!--</div>-->
|
19
|
+
</shrinkable-menu>
|
20
|
+
|
21
|
+
</scroll-bar>
|
22
|
+
|
23
|
+
<Affix :offset-bottom="0" class="menu-right-footer" @click.native="toggleClick" :style="{width: shrink?'80px':'250px'}">
|
24
|
+
<div style="padding: 0 16px;">
|
25
|
+
<template v-if="!shrink">
|
26
|
+
<md-icon type="first_page" ></md-icon>
|
27
|
+
</template>
|
28
|
+
<template v-else>
|
29
|
+
<md-icon type="last_page"></md-icon>
|
30
|
+
</template>
|
31
|
+
</div>
|
32
|
+
</Affix>
|
33
|
+
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<!--<div class="main-header-con" :style="{paddingLeft: shrink?'60px':'200px'}">-->
|
37
|
+
<!--<div class="main-header">-->
|
38
|
+
<!--<div class="navicon-con">-->
|
39
|
+
<!--<Button :style="{transform: 'rotateZ(' + (this.shrink ? '-90' : '0') + 'deg)'}" type="text" @click="toggleClick">-->
|
40
|
+
<!--<Icon type="navicon" size="32"></Icon>-->
|
41
|
+
<!--</Button>-->
|
42
|
+
<!--</div>-->
|
43
|
+
<!--<div class="header-middle-con">-->
|
44
|
+
<!--<div class="main-breadcrumb">-->
|
45
|
+
<!--<breadcrumb-nav :currentPath="currentPath"></breadcrumb-nav>-->
|
46
|
+
<!--</div>-->
|
47
|
+
<!--</div>-->
|
48
|
+
<!--<div class="header-avator-con">-->
|
49
|
+
<!--<full-screen v-model="isFullScreen" @on-change="fullscreenChange"></full-screen>-->
|
50
|
+
<!--<lock-screen></lock-screen>-->
|
51
|
+
<!--<message-tip v-model="mesCount"></message-tip>-->
|
52
|
+
<!--<theme-switch></theme-switch>-->
|
53
|
+
|
54
|
+
<!--<div class="user-dropdown-menu-con">-->
|
55
|
+
<!--<Row type="flex" justify="end" align="middle" class="user-dropdown-innercon">-->
|
56
|
+
<!--<Dropdown transfer trigger="click" @on-click="handleClickUserDropdown">-->
|
57
|
+
<!--<a href="javascript:void(0)">-->
|
58
|
+
<!--<span class="main-user-name">{{ userName }}</span>-->
|
59
|
+
<!--<Icon type="arrow-down-b"></Icon>-->
|
60
|
+
<!--</a>-->
|
61
|
+
<!--<DropdownMenu slot="list">-->
|
62
|
+
<!--<DropdownItem name="ownSpace">个人中心</DropdownItem>-->
|
63
|
+
<!--<DropdownItem name="loginout" divided>退出登录</DropdownItem>-->
|
64
|
+
<!--</DropdownMenu>-->
|
65
|
+
<!--</Dropdown>-->
|
66
|
+
<!--<Avatar :src="avatorPath" style="background: #619fe7;margin-left: 10px;"></Avatar>-->
|
67
|
+
<!--</Row>-->
|
68
|
+
<!--</div>-->
|
69
|
+
<!--</div>-->
|
70
|
+
<!--</div>-->
|
71
|
+
<!--<div class="tags-con">-->
|
72
|
+
<!--<tags-page-opened :pageTagsList="pageTagsList"></tags-page-opened>-->
|
73
|
+
<!--</div>-->
|
74
|
+
<!--</div>-->
|
75
|
+
<!--<div class="single-page-con" :style="{left: shrink?'60px':'200px'}">-->
|
76
|
+
<!--<div class="single-page">-->
|
77
|
+
<!--<keep-alive :include="cachePage">-->
|
78
|
+
<!--<router-view></router-view>-->
|
79
|
+
<!--</keep-alive>-->
|
80
|
+
<!--</div>-->
|
81
|
+
<!--</div>-->
|
82
|
+
</div>
|
83
|
+
</template>
|
84
|
+
<script>
|
85
|
+
// import shrinkableMenu from './main-components/shrinkable-menu/shrinkable-menu.vue';
|
86
|
+
// import tagsPageOpened from './main-components/tags-page-opened.vue';
|
87
|
+
// import breadcrumbNav from './main-components/breadcrumb-nav.vue';
|
88
|
+
// import fullScreen from './main-components/fullscreen.vue';
|
89
|
+
// import lockScreen from './main-components/lockscreen/lockscreen.vue';
|
90
|
+
// import messageTip from './main-components/message-tip.vue';
|
91
|
+
// import themeSwitch from './main-components/theme-switch/theme-switch.vue';
|
92
|
+
// import Cookies from 'js-cookie';
|
93
|
+
// import util from '@/libs/util.js';
|
94
|
+
// import scrollBar from '@/views/my-components/scroll-bar/vue-scroller-bars';
|
95
|
+
|
96
|
+
import shrinkableMenu from '../index';
|
97
|
+
import scrollBar from '../../md-scroll-bar';
|
98
|
+
import util from '../../libs/util';
|
99
|
+
import _menuList from './data/menu'
|
100
|
+
import _pageTagsList from './data/pageTagsList'
|
101
|
+
import _currentPath from './data/currentPath'
|
102
|
+
import _cachePage from './data/cachePage'
|
103
|
+
|
104
|
+
export default {
|
105
|
+
components: {
|
106
|
+
shrinkableMenu,
|
107
|
+
// tagsPageOpened,
|
108
|
+
// breadcrumbNav,
|
109
|
+
// fullScreen,
|
110
|
+
// lockScreen,
|
111
|
+
// messageTip,
|
112
|
+
// themeSwitch,
|
113
|
+
scrollBar
|
114
|
+
},
|
115
|
+
model:{
|
116
|
+
prop:'collapsed'
|
117
|
+
},
|
118
|
+
props:{
|
119
|
+
collapsed:{
|
120
|
+
type:Boolean,
|
121
|
+
default:false,
|
122
|
+
}
|
123
|
+
},
|
124
|
+
data () {
|
125
|
+
return {
|
126
|
+
menuList:[],
|
127
|
+
shrink: false,
|
128
|
+
userName: '',
|
129
|
+
isFullScreen: false,
|
130
|
+
// openedSubmenuArr: ["component","tables","form","advanced-router"]
|
131
|
+
openedSubmenuArr: [],//["个人中心","tables","form","advanced-router"]
|
132
|
+
};
|
133
|
+
},
|
134
|
+
computed: {
|
135
|
+
// menuList () {
|
136
|
+
// console.log(this.$md.state.personal_menus);
|
137
|
+
// return this.$md.state.personal_menus;
|
138
|
+
// // return _menuList
|
139
|
+
// // return this.$store.state.app.menuList;
|
140
|
+
// },
|
141
|
+
pageTagsList () {
|
142
|
+
return _pageTagsList
|
143
|
+
// return this.$store.state.app.pageOpenedList; // 打开的页面的页面对象
|
144
|
+
},
|
145
|
+
currentPath () {
|
146
|
+
return _currentPath;
|
147
|
+
// return this.$store.state.app.currentPath; // 当前面包屑数组
|
148
|
+
},
|
149
|
+
avatorPath () {
|
150
|
+
return localStorage.avatorImgPath;
|
151
|
+
},
|
152
|
+
cachePage () {
|
153
|
+
return _cachePage
|
154
|
+
// return this.$store.state.app.cachePage;
|
155
|
+
},
|
156
|
+
lang () {
|
157
|
+
return ""
|
158
|
+
// return this.$store.state.app.lang;
|
159
|
+
},
|
160
|
+
menuTheme () {
|
161
|
+
return 'light'
|
162
|
+
// return this.$store.state.app.menuTheme;
|
163
|
+
},
|
164
|
+
mesCount () {
|
165
|
+
return 3;
|
166
|
+
// return this.$store.state.app.messageCount;
|
167
|
+
}
|
168
|
+
},
|
169
|
+
methods: {
|
170
|
+
getMenusList(){
|
171
|
+
this.menuList = _menuList['result'];
|
172
|
+
this.openedSubmenuArr = this.menuList.map(elem=>{
|
173
|
+
return elem.name;
|
174
|
+
})
|
175
|
+
|
176
|
+
// this.menuList = [_menuList[2]];
|
177
|
+
// this.$md.dispatch('personal_menus', {userId:'4'}).then(data=>{
|
178
|
+
// let list = data['result'][1];
|
179
|
+
//
|
180
|
+
// let childList = list['childList'];
|
181
|
+
// this.menuList = [list];
|
182
|
+
// this.openedSubmenuArr = this.menuList .map(elem=>{
|
183
|
+
// return elem.name;
|
184
|
+
// })
|
185
|
+
// // this.openedSubmenuArr = this.menuList;
|
186
|
+
// console.log(this.menuList);
|
187
|
+
// // this.menuList = data['result']
|
188
|
+
// // console.log( data['result'][1]);
|
189
|
+
// })
|
190
|
+
},
|
191
|
+
init () {
|
192
|
+
// let pathArr = util.setCurrentPath(this, this.$route.name);
|
193
|
+
// this.$store.commit('updateMenulist');
|
194
|
+
// if (pathArr.length >= 2) {
|
195
|
+
// this.$store.commit('addOpenSubmenu', pathArr[1].name);
|
196
|
+
// }
|
197
|
+
// this.userName = Cookies.get('user');
|
198
|
+
// let messageCount = 3;
|
199
|
+
// this.messageCount = messageCount.toString();
|
200
|
+
// this.checkTag(this.$route.name);
|
201
|
+
// this.$store.commit('setMessageCount', 3);
|
202
|
+
},
|
203
|
+
toggleClick () {
|
204
|
+
this.shrink = !this.shrink;
|
205
|
+
this.$emit('input', this.shrink);
|
206
|
+
},
|
207
|
+
handleClickUserDropdown (name) {
|
208
|
+
if (name === 'ownSpace') {
|
209
|
+
util.openNewPage(this, 'ownspace_index');
|
210
|
+
this.$router.push({
|
211
|
+
name: 'ownspace_index'
|
212
|
+
});
|
213
|
+
} else if (name === 'loginout') {
|
214
|
+
// 退出登录
|
215
|
+
this.$store.commit('logout', this);
|
216
|
+
this.$store.commit('clearOpenedSubmenu');
|
217
|
+
this.$router.push({
|
218
|
+
name: 'login'
|
219
|
+
});
|
220
|
+
}
|
221
|
+
},
|
222
|
+
checkTag (name) {
|
223
|
+
let openpageHasTag = this.pageTagsList.some(item => {
|
224
|
+
if (item.name === name) {
|
225
|
+
return true;
|
226
|
+
}
|
227
|
+
});
|
228
|
+
if (!openpageHasTag) { // 解决关闭当前标签后再点击回退按钮会退到当前页时没有标签的问题
|
229
|
+
util.openNewPage(this, name, this.$route.params || {}, this.$route.query || {});
|
230
|
+
}
|
231
|
+
},
|
232
|
+
handleSubmenuChange (val) {
|
233
|
+
// console.log(val)
|
234
|
+
},
|
235
|
+
beforePush (name) {
|
236
|
+
// if (name === 'accesstest_index') {
|
237
|
+
// return false;
|
238
|
+
// } else {
|
239
|
+
// return true;
|
240
|
+
// }
|
241
|
+
return true;
|
242
|
+
},
|
243
|
+
fullscreenChange (isFullScreen) {
|
244
|
+
// console.log(isFullScreen);
|
245
|
+
},
|
246
|
+
scrollBarResize () {
|
247
|
+
this.$refs.scrollBar.resize();
|
248
|
+
}
|
249
|
+
},
|
250
|
+
watch: {
|
251
|
+
collapsed(to) {
|
252
|
+
this.shrink = to;
|
253
|
+
},
|
254
|
+
'$route' (to) {
|
255
|
+
// this.$store.commit('setCurrentPageName', to.name);
|
256
|
+
// let pathArr = util.setCurrentPath(this, to.name);
|
257
|
+
// if (pathArr.length > 2) {
|
258
|
+
// this.$store.commit('addOpenSubmenu', pathArr[1].name);
|
259
|
+
// }
|
260
|
+
// this.checkTag(to.name);
|
261
|
+
// localStorage.currentPageName = to.name;
|
262
|
+
},
|
263
|
+
lang () {
|
264
|
+
// util.setCurrentPath(this, this.$route.name); // 在切换语言时用于刷新面包屑
|
265
|
+
},
|
266
|
+
openedSubmenuArr () {
|
267
|
+
setTimeout(() => {
|
268
|
+
this.scrollBarResize();
|
269
|
+
}, 300);
|
270
|
+
}
|
271
|
+
},
|
272
|
+
mounted () {
|
273
|
+
this.init();
|
274
|
+
window.addEventListener('resize', this.scrollBarResize);
|
275
|
+
},
|
276
|
+
created () {
|
277
|
+
// 显示打开的页面的列表
|
278
|
+
// this.$store.commit('setOpenedList');
|
279
|
+
this.getMenusList();
|
280
|
+
},
|
281
|
+
dispatch () {
|
282
|
+
window.removeEventListener('resize', this.scrollBarResize);
|
283
|
+
}
|
284
|
+
};
|
285
|
+
</script>
|
@@ -0,0 +1,112 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="ivu-shrinkable-menu">
|
3
|
+
<slot name="top"></slot>
|
4
|
+
<sidebar-menu
|
5
|
+
v-show="!shrink"
|
6
|
+
:menu-theme="theme"
|
7
|
+
:menu-list="menuList"
|
8
|
+
:open-names="openNames"
|
9
|
+
:icon-size="iconSize"
|
10
|
+
:icon-color="iconColor"
|
11
|
+
:show-divider="showDivider"
|
12
|
+
:cell-height="cellHeight"
|
13
|
+
@on-change="handleChange"
|
14
|
+
></sidebar-menu>
|
15
|
+
<sidebar-menu-shrink
|
16
|
+
v-show="shrink"
|
17
|
+
:menu-theme="theme"
|
18
|
+
:menu-list="menuList"
|
19
|
+
:icon-size="iconSize"
|
20
|
+
:icon-color="iconColor"
|
21
|
+
@on-change="handleChange"
|
22
|
+
></sidebar-menu-shrink>
|
23
|
+
</div>
|
24
|
+
</template>
|
25
|
+
|
26
|
+
<script>
|
27
|
+
import sidebarMenu from "./components/sidebarMenu.vue";
|
28
|
+
import sidebarMenuShrink from "./components/sidebarMenuShrink.vue";
|
29
|
+
import util from "../libs/util";
|
30
|
+
// import util from '@/libs/util';
|
31
|
+
export default {
|
32
|
+
name: "shrinkableMenu",
|
33
|
+
components: {
|
34
|
+
sidebarMenu,
|
35
|
+
sidebarMenuShrink
|
36
|
+
},
|
37
|
+
props: {
|
38
|
+
shrink: {
|
39
|
+
type: Boolean,
|
40
|
+
default: false
|
41
|
+
},
|
42
|
+
iconSize: {
|
43
|
+
type:Number,
|
44
|
+
default:16,
|
45
|
+
},
|
46
|
+
iconColor:{
|
47
|
+
type:Object|String,
|
48
|
+
default:'#C5C8CD'
|
49
|
+
},
|
50
|
+
cellHeight:{
|
51
|
+
type:Number,
|
52
|
+
default:56,
|
53
|
+
},
|
54
|
+
menuList: {
|
55
|
+
type: Array,
|
56
|
+
required: true
|
57
|
+
},
|
58
|
+
theme: {
|
59
|
+
type: String,
|
60
|
+
default: "dark",
|
61
|
+
validator(val) {
|
62
|
+
return util.oneOf(val, ["dark", "light"]);
|
63
|
+
}
|
64
|
+
},
|
65
|
+
beforePush: {
|
66
|
+
type: Function
|
67
|
+
},
|
68
|
+
openNames: {
|
69
|
+
type: Array
|
70
|
+
},
|
71
|
+
showDivider:{
|
72
|
+
type:Boolean,
|
73
|
+
default:true,
|
74
|
+
}
|
75
|
+
},
|
76
|
+
computed: {
|
77
|
+
bgColor() {
|
78
|
+
return this.theme === "dark" ? "#495060" : "#fafafa";
|
79
|
+
},
|
80
|
+
shrinkIconColor() {
|
81
|
+
return this.theme === "dark" ? "#595959" : "#495060";
|
82
|
+
// return this.theme === 'dark' ? '#fafafa' : '#495060';
|
83
|
+
}
|
84
|
+
},
|
85
|
+
methods: {
|
86
|
+
handleChange(name) {
|
87
|
+
|
88
|
+
let willpush = true;
|
89
|
+
if (this.beforePush !== undefined) {
|
90
|
+
if (!this.beforePush(name)) {
|
91
|
+
willpush = false;
|
92
|
+
}
|
93
|
+
}
|
94
|
+
// console.log(willpush, name)
|
95
|
+
if (willpush) {
|
96
|
+
this.$router.push({
|
97
|
+
path: name
|
98
|
+
});
|
99
|
+
// this.$router.push({
|
100
|
+
// name: name
|
101
|
+
// });
|
102
|
+
}
|
103
|
+
|
104
|
+
this.$emit("on-change", name);
|
105
|
+
}
|
106
|
+
}
|
107
|
+
};
|
108
|
+
</script>
|
109
|
+
|
110
|
+
<style lang="less" scoped>
|
111
|
+
/*@import "./styles/menu.less";*/
|
112
|
+
</style>
|
@@ -0,0 +1,195 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="main" :class="{'main-hide-text': shrink}">
|
3
|
+
<div class="sidebar-menu-con" :style="{width: shrink?'80px':'250px'}" :class="{'sidebar-menu-con-footer__has':!hideFooter,'sidebar-menu-con-footer__none':hideFooter}">
|
4
|
+
<scroll-bar ref="scrollBar">
|
5
|
+
<shrinkable-menu
|
6
|
+
:shrink="shrink"
|
7
|
+
@on-change="handleSubmenuChange"
|
8
|
+
:theme="theme"
|
9
|
+
:class="themeClassName"
|
10
|
+
class="shrinkable-menu"
|
11
|
+
:before-push="beforePush"
|
12
|
+
:open-names="openedSubs"
|
13
|
+
:icon-size="iconSize"
|
14
|
+
:icon-color="iconColor"
|
15
|
+
:show-divider="showDivider"
|
16
|
+
:cell-height="cellHeight"
|
17
|
+
:menu-list="menuList">
|
18
|
+
<!--<div slot="top" class="logo-con">-->
|
19
|
+
<!--<img v-show="!shrink" src="@/assets/logo.png" key="max-logo" />-->
|
20
|
+
<!--<img v-show="shrink" src="@/assets/logo.png" key="min-logo" />-->
|
21
|
+
<!--</div>-->
|
22
|
+
</shrinkable-menu>
|
23
|
+
</scroll-bar>
|
24
|
+
<Affix v-if="!hideFooter" :offset-bottom="0" class="menu-right-footer" @click.native="toggleClick" :style="{width: shrink?'80px':'250px'}">
|
25
|
+
<div style="padding: 0 16px;">
|
26
|
+
<template v-if="!shrink">
|
27
|
+
<md-icon type="md-arrow-back" size="18"></md-icon>
|
28
|
+
</template>
|
29
|
+
<template v-else>
|
30
|
+
<md-icon type="md-arrow-forward" size="18"></md-icon>
|
31
|
+
</template>
|
32
|
+
</div>
|
33
|
+
</Affix>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
</template>
|
37
|
+
<script>
|
38
|
+
import shrinkableMenu from './index';
|
39
|
+
import scrollBar from '../md-scroll-bar';
|
40
|
+
// import _menuList from './data/menu'
|
41
|
+
|
42
|
+
export default {
|
43
|
+
components: {
|
44
|
+
shrinkableMenu,
|
45
|
+
scrollBar
|
46
|
+
},
|
47
|
+
model:{
|
48
|
+
prop:'collapsed',
|
49
|
+
},
|
50
|
+
props:{
|
51
|
+
cellHeight:{
|
52
|
+
type:Number,
|
53
|
+
default:48,
|
54
|
+
},
|
55
|
+
iconSize: {
|
56
|
+
type:Number,
|
57
|
+
default:16,
|
58
|
+
},
|
59
|
+
iconColor:{
|
60
|
+
type:Object|String,
|
61
|
+
default:'#C5C8CD'
|
62
|
+
},
|
63
|
+
collapsed:{
|
64
|
+
type:Boolean,
|
65
|
+
default:false,
|
66
|
+
},
|
67
|
+
menus:{
|
68
|
+
type:Array|Object,
|
69
|
+
default:[],
|
70
|
+
},
|
71
|
+
hideFooter:{
|
72
|
+
type:Boolean,
|
73
|
+
default:true
|
74
|
+
},
|
75
|
+
openedSubs:{
|
76
|
+
type:Array|Object,
|
77
|
+
default:[],
|
78
|
+
},
|
79
|
+
showDivider:{
|
80
|
+
type:Boolean,
|
81
|
+
default:false,
|
82
|
+
},
|
83
|
+
theme:{
|
84
|
+
type:String,
|
85
|
+
default:'dark',
|
86
|
+
validator:value=>{
|
87
|
+
return ['dark', 'light'].indexOf(value) !== -1
|
88
|
+
}
|
89
|
+
}
|
90
|
+
},
|
91
|
+
data () {
|
92
|
+
return {
|
93
|
+
menuList:[],
|
94
|
+
shrink: false,
|
95
|
+
openedSubmenuArr: [],
|
96
|
+
};
|
97
|
+
},
|
98
|
+
computed: {
|
99
|
+
themeClassName() {
|
100
|
+
if (this.theme === 'dark') {
|
101
|
+
return ["shrinkable-menu--dark"]
|
102
|
+
} else {
|
103
|
+
return ["shrinkable-menu--light"]
|
104
|
+
}
|
105
|
+
},
|
106
|
+
menuTheme () {
|
107
|
+
return 'light'
|
108
|
+
// return this.$store.state.app.menuTheme;
|
109
|
+
},
|
110
|
+
},
|
111
|
+
methods: {
|
112
|
+
getMenusList(){
|
113
|
+
this.menuList = this.menus;//_menuList['result'];
|
114
|
+
// this.openedSubmenuArr = this.menus.map(elem=>{
|
115
|
+
// return elem.name;
|
116
|
+
// })
|
117
|
+
// this.menuList = [_menuList[2]];
|
118
|
+
// this.$md.dispatch('personal_menus', {userId:'4'}).then(data=>{
|
119
|
+
// let list = data['result'][1];
|
120
|
+
//
|
121
|
+
// let childList = list['childList'];
|
122
|
+
// this.menuList = [list];
|
123
|
+
// this.openedSubmenuArr = this.menuList .map(elem=>{
|
124
|
+
// return elem.name;
|
125
|
+
// })
|
126
|
+
// // this.openedSubmenuArr = this.menuList;
|
127
|
+
// console.log(this.menuList);
|
128
|
+
// // this.menuList = data['result']
|
129
|
+
// // console.log( data['result'][1]);
|
130
|
+
// })
|
131
|
+
},
|
132
|
+
toggleClick () {
|
133
|
+
this.shrink = !this.shrink;
|
134
|
+
this.$emit('input', this.shrink);
|
135
|
+
},
|
136
|
+
handleSubmenuChange (val) {
|
137
|
+
// console.log(val)
|
138
|
+
},
|
139
|
+
beforePush (name) {
|
140
|
+
// if (name === 'accesstest_index') {
|
141
|
+
// return false;
|
142
|
+
// } else {
|
143
|
+
// return true;
|
144
|
+
// }
|
145
|
+
return true;
|
146
|
+
},
|
147
|
+
scrollBarResize () {
|
148
|
+
this.$refs.scrollBar.resize();
|
149
|
+
}
|
150
|
+
},
|
151
|
+
watch: {
|
152
|
+
collapsed(to) {
|
153
|
+
this.shrink = to;
|
154
|
+
},
|
155
|
+
'$route' (to) {
|
156
|
+
// this.$store.commit('setCurrentPageName', to.name);
|
157
|
+
// let pathArr = util.setCurrentPath(this, to.name);
|
158
|
+
// if (pathArr.length > 2) {
|
159
|
+
// this.$store.commit('addOpenSubmenu', pathArr[1].name);
|
160
|
+
// }
|
161
|
+
// this.checkTag(to.name);
|
162
|
+
// localStorage.currentPageName = to.name;
|
163
|
+
},
|
164
|
+
openedSubs () {
|
165
|
+
setTimeout(() => {
|
166
|
+
this.scrollBarResize();
|
167
|
+
}, 300);
|
168
|
+
}
|
169
|
+
},
|
170
|
+
mounted () {
|
171
|
+
window.addEventListener('resize', this.scrollBarResize);
|
172
|
+
},
|
173
|
+
created () {
|
174
|
+
// 显示打开的页面的列表
|
175
|
+
// this.$store.commit('setOpenedList');
|
176
|
+
this.getMenusList();
|
177
|
+
},
|
178
|
+
dispatch () {
|
179
|
+
window.removeEventListener('resize', this.scrollBarResize);
|
180
|
+
}
|
181
|
+
};
|
182
|
+
</script>
|
183
|
+
|
184
|
+
<style lang="less">
|
185
|
+
/*@import "./styles/sidebar.less";*/
|
186
|
+
/*.sidebar-menu-con-footer__has {*/
|
187
|
+
/* height: calc(~"100% - 47px");;*/
|
188
|
+
/*}*/
|
189
|
+
/*.sidebar-menu-con-footer__none {*/
|
190
|
+
/* height: calc(~"100%");;*/
|
191
|
+
/*}*/
|
192
|
+
/* .shrinkable-menu {
|
193
|
+
background-color: #fafafa;
|
194
|
+
}*/
|
195
|
+
</style>
|