imatrix-ui 2.8.97-dw-tmp10 → 2.8.97-dw-tmp11
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/package.json
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
</template>
|
|
15
15
|
|
|
16
16
|
<template v-for="child in item.children">
|
|
17
|
+
<!-- <sidebar-item-child :key="child.code" :child="child" /> -->
|
|
17
18
|
<sidebar-item
|
|
18
19
|
v-if="child.children&&child.children.length>0"
|
|
19
20
|
:key="child.code"
|
|
@@ -38,6 +39,7 @@ import AppLink from './Link'
|
|
|
38
39
|
import Vue from 'vue'
|
|
39
40
|
import tabJs from '../../../api/tab'
|
|
40
41
|
import { getI18nName } from '../../../utils/menu'
|
|
42
|
+
// import { SidebarItemChild } from './SidebarItemChild.vue'
|
|
41
43
|
export default {
|
|
42
44
|
name: 'SidebarItem',
|
|
43
45
|
components: { Item, AppLink },
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<sidebar-item
|
|
4
|
+
v-if="child && child.children&&child.children.length>0"
|
|
5
|
+
:is-nest="true"
|
|
6
|
+
:item="child"
|
|
7
|
+
class="nest-menu"
|
|
8
|
+
/>
|
|
9
|
+
<app-link v-else :key="child.code" :to="toPath(child)" @click.native="clickMenu(toPath(child))">
|
|
10
|
+
<el-menu-item :index="resolvePath(child.code,child.path,child.pageType)">
|
|
11
|
+
<item :icon="child.iconName" :title="getI18nName(child)" />
|
|
12
|
+
</el-menu-item>
|
|
13
|
+
</app-link>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
// import { isExternal } from 'imatrix-ui/src/utils'
|
|
19
|
+
import Item from './Item'
|
|
20
|
+
import AppLink from './Link'
|
|
21
|
+
import Vue from 'vue'
|
|
22
|
+
import tabJs from '../../../api/tab'
|
|
23
|
+
import { getI18nName } from '../../../utils/menu'
|
|
24
|
+
import SidebarItem from './SidebarItem.vue'
|
|
25
|
+
export default {
|
|
26
|
+
name: 'SidebarItemChild',
|
|
27
|
+
components: { Item, AppLink, SidebarItem },
|
|
28
|
+
props: {
|
|
29
|
+
// route object
|
|
30
|
+
child: {
|
|
31
|
+
type: Object,
|
|
32
|
+
required: true
|
|
33
|
+
},
|
|
34
|
+
isNest: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: false
|
|
37
|
+
}
|
|
38
|
+
// basePath: {
|
|
39
|
+
// type: String,
|
|
40
|
+
// default: ''
|
|
41
|
+
// }
|
|
42
|
+
},
|
|
43
|
+
data() {
|
|
44
|
+
return {
|
|
45
|
+
onlyOneChild: null
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
methods: {
|
|
49
|
+
...tabJs,
|
|
50
|
+
hasOneShowingChild(children, parent) {
|
|
51
|
+
if (children && children.length > 0) {
|
|
52
|
+
this.onlyOneChild = children[0]
|
|
53
|
+
}
|
|
54
|
+
// When there is only one child router, the child router is displayed by default
|
|
55
|
+
if (children.length === 1) {
|
|
56
|
+
return true
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Show parent if there are no child router to display
|
|
60
|
+
if (!children || children.length === 0) {
|
|
61
|
+
// children不存在
|
|
62
|
+
this.onlyOneChild = { ... parent, path: '', noShowingChildren: true }
|
|
63
|
+
return true
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return false
|
|
67
|
+
},
|
|
68
|
+
resolvePath(menuCode, pageCode, pageType) {
|
|
69
|
+
if (this.isExternalLink(pageType)) {
|
|
70
|
+
return '/dsc/' + menuCode + '~~'
|
|
71
|
+
} else {
|
|
72
|
+
return '/dsc/' + menuCode + '~~' + pageCode
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
toPath(menu) {
|
|
76
|
+
const toPathObj = {}
|
|
77
|
+
const routePath = menu.path
|
|
78
|
+
toPathObj.openWay = menu.openWay
|
|
79
|
+
if (this.isExternalLink(menu.pageType)) {
|
|
80
|
+
toPathObj.path = '/dsc-index/iframe-page'
|
|
81
|
+
toPathObj.tabPath = '/dsc/iframe-page'
|
|
82
|
+
toPathObj.query = {}
|
|
83
|
+
toPathObj.query.src = routePath
|
|
84
|
+
toPathObj.isExternal = true
|
|
85
|
+
// 如果路径中没有拼系统编码,才需要把系统编码放到参数中
|
|
86
|
+
toPathObj.query.customSystem = Vue.prototype.customSystem
|
|
87
|
+
toPathObj.query._menuCode = menu.code
|
|
88
|
+
toPathObj.query._menuName = getI18nName(menu)
|
|
89
|
+
} else {
|
|
90
|
+
const pageCode = routePath
|
|
91
|
+
toPathObj.path = '/dsc-index/page'
|
|
92
|
+
toPathObj.tabPath = '/dsc/page'
|
|
93
|
+
toPathObj.query = {}
|
|
94
|
+
toPathObj.query.pageCode = pageCode
|
|
95
|
+
toPathObj.query.customSystem = Vue.prototype.customSystem
|
|
96
|
+
toPathObj.query._menuCode = menu.code
|
|
97
|
+
toPathObj.query._menuName = getI18nName(menu)
|
|
98
|
+
}
|
|
99
|
+
return toPathObj
|
|
100
|
+
},
|
|
101
|
+
// 是否已存在customSystem参数
|
|
102
|
+
isHasCustomSystem(routePath) {
|
|
103
|
+
if (routePath && routePath.indexOf('?') > 0) {
|
|
104
|
+
const params = routePath.substring(routePath.indexOf('?') + 1)
|
|
105
|
+
const paramArr = params.split('&')
|
|
106
|
+
for (let i = 0; i < paramArr.length; i++) {
|
|
107
|
+
const item = paramArr[i]
|
|
108
|
+
const key = item.split('=')[0]
|
|
109
|
+
if (key === 'customSystem') {
|
|
110
|
+
return true
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return false
|
|
115
|
+
},
|
|
116
|
+
clickMenu(toPathObj) {
|
|
117
|
+
// console.log('clickMenu----toPathObj=', toPathObj)
|
|
118
|
+
if (toPathObj.openWay && toPathObj.openWay === 'NEW_PAGE_OPEN' && toPathObj.query) {
|
|
119
|
+
// 新页签打开菜单
|
|
120
|
+
let url = toPathObj.query.src
|
|
121
|
+
if (url && url.indexOf('?') > 0) {
|
|
122
|
+
url += '&'
|
|
123
|
+
} else {
|
|
124
|
+
url += '?'
|
|
125
|
+
}
|
|
126
|
+
if (toPathObj.query.customSystem) {
|
|
127
|
+
url += 'customSystem=' + toPathObj.query.customSystem
|
|
128
|
+
}
|
|
129
|
+
if (toPathObj.query._menuCode) {
|
|
130
|
+
url += '_menuCode=' + toPathObj.query._menuCode
|
|
131
|
+
}
|
|
132
|
+
if (toPathObj.query._menuCode) {
|
|
133
|
+
url += '_menuName=' + toPathObj.query._menuName
|
|
134
|
+
}
|
|
135
|
+
window.open(url, toPathObj.query._menuCode)
|
|
136
|
+
} else {
|
|
137
|
+
// 刷新页签打开菜单
|
|
138
|
+
this.addTabs(toPathObj.query, this.$store.state.tabContent.openTab, toPathObj.tabPath)
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
isExternalLink(pageType) {
|
|
142
|
+
if (pageType && pageType === 'iframe') {
|
|
143
|
+
return true
|
|
144
|
+
}
|
|
145
|
+
return false
|
|
146
|
+
},
|
|
147
|
+
getI18nName(menu) {
|
|
148
|
+
return getI18nName(menu)
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
</script>
|