Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mes-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
周远喜
mes-ui
Commits
c8bd797d
Commit
c8bd797d
authored
Sep 18, 2020
by
renjintao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug
parent
19655e94
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
232 additions
and
216 deletions
+232
-216
state.vue
components/page/state.vue
+123
-119
default.vue
layouts/default.vue
+108
-97
index.vue
pages/basicData/user/index.vue
+1
-0
No files found.
components/page/state.vue
View file @
c8bd797d
<
template
>
<
template
>
<div
class=
"ib"
>
<div
class=
"ib"
>
<div
class=
"ib"
v-if=
"!isMore"
>
<div
class=
"ib"
v-if=
"!isMore"
>
<span
v-if=
"type=='text'"
:style=
"style"
>
{{
name
}}
</span>
<span
v-if=
"type=='text'"
:style=
"style"
>
{{
name
}}
</span>
<Tag
v-if=
"type=='tag'"
:color=
"tagcolor"
>
{{
name
}}
</Tag>
<Tag
v-if=
"type=='tag'"
:color=
"tagcolor"
>
{{
name
}}
</Tag>
<Badge
v-if=
"type=='dot'"
:color=
"tagcolor"
:text=
"name"
/>
<Badge
v-if=
"type=='dot'"
:color=
"tagcolor"
:text=
"name"
/>
<Icon
v-if=
"type=='icon'"
:type=
"item.icon"
:color=
"tagcolor"
:title=
"name"
size=
"24"
/>
<Icon
v-if=
"type=='icon'"
:type=
"item.icon"
:color=
"tagcolor"
:title=
"name"
size=
"24"
/>
</div>
</div>
<div
class=
"ib"
v-else
v-for=
"(li,i) in items"
:key=
"i"
>
<div
class=
"ib"
v-else
v-for=
"(li,i) in items"
:key=
"i"
>
<span
v-if=
"type=='text'"
:style=
"li.style"
>
{{
li
.
name
}}
</span>
<span
v-if=
"type=='text'"
:style=
"li.style"
>
{{
li
.
name
}}
</span>
<Tag
v-if=
"type=='tag'"
:color=
"li.tagcolor"
>
{{
li
.
name
}}
</Tag>
<Tag
v-if=
"type=='tag'"
:color=
"li.tagcolor"
>
{{
li
.
name
}}
</Tag>
<Badge
v-if=
"type=='dot'"
:color=
"li.tagcolor"
:text=
"li.name"
/>
<Badge
v-if=
"type=='dot'"
:color=
"li.tagcolor"
:text=
"li.name"
/>
</div>
</div>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
export
default
{
export
default
{
name
:
'state'
,
name
:
'state'
,
data
()
{
data
()
{
return
{
return
{
name
:
''
,
name
:
''
,
isMore
:
false
,
isMore
:
false
,
item
:
{},
item
:
{},
items
:
[],
items
:
[],
data
:
[]
data
:
[]
}
}
},
props
:
{
default
:
{
type
:
String
,
default
:
''
},
type
:
{
type
:
String
,
default
:
'text'
,
validator
:
function
(
value
)
{
return
[
'text'
,
'tag'
,
'dot'
,
'icon'
].
indexOf
(
value
)
!=
-
1
}
},
code
:
{
type
:
String
,
required
:
true
},
value
:
{
type
:
[
String
,
Number
],
required
:
false
},
},
color
:
{
props
:
{
type
:
Boolean
,
default
:
{
default
:
true
type
:
String
,
default
:
''
},
type
:
{
type
:
String
,
default
:
'text'
,
validator
:
function
(
value
)
{
return
[
'text'
,
'tag'
,
'dot'
,
'icon'
].
indexOf
(
value
)
!=
-
1
}
},
code
:
{
type
:
String
,
required
:
true
},
value
:
{
type
:
[
String
,
Number
],
required
:
false
},
color
:
{
type
:
Boolean
,
default
:
true
},
icon
:
{
type
:
Boolean
,
default
:
false
},
img
:
{
type
:
Boolean
,
default
:
false
}
},
},
icon
:
{
created
()
{
type
:
Boolean
,
this
.
data
=
this
.
$store
.
getters
.
dictionaryByKey
(
this
.
code
)
||
[]
default
:
false
},
},
img
:
{
methods
:
{
type
:
Boolean
,
setName
(
v
)
{
default
:
false
if
((
v
+
""
).
indexOf
(
','
)
==
-
1
)
{
}
var
item
},
this
.
data
.
map
((
u
)
=>
{
created
()
{
if
(
u
.
code
==
v
)
{
this
.
data
=
this
.
$store
.
getters
.
dictionaryByKey
(
this
.
code
)
||
[]
item
=
u
},
}
methods
:
{
})
setName
(
v
)
{
if
(
item
)
{
if
((
v
+
""
).
indexOf
(
','
)
==-
1
)
{
this
.
name
=
item
.
name
var
item
this
.
item
=
item
this
.
data
.
map
((
u
)
=>
{
}
else
{
if
(
u
.
code
==
v
)
{
if
(
!
this
.
value
&&
typeof
(
this
.
value
)
!=
"undefined"
)
{
item
=
u
this
.
name
=
this
.
value
}
}
else
{
})
this
.
name
=
''
if
(
item
)
{
}
this
.
name
=
item
.
name
}
this
.
item
=
item
}
else
{
}
else
{
this
.
isMore
=
true
;
this
.
name
=
this
.
value
var
items
=
[];
var
ul
=
(
v
+
""
).
split
(
','
)
this
.
data
.
map
((
u
)
=>
{
if
(
ul
.
indexOf
(
u
.
code
)
>
-
1
)
{
u
.
tagcolor
=
u
.
color
|
'default'
u
.
style
=
{
color
:
u
.
color
|
'inherit'
}
items
.
push
(
u
)
}
})
this
.
items
=
items
;
}
}
}
}
else
{
this
.
isMore
=
true
;
var
items
=
[];
var
ul
=
(
v
+
""
).
split
(
','
)
this
.
data
.
map
((
u
)
=>
{
if
(
ul
.
indexOf
(
u
.
code
)
>-
1
)
{
u
.
tagcolor
=
u
.
color
|
'default'
u
.
style
=
{
color
:
u
.
color
|
'inherit'
}
items
.
push
(
u
)
}
})
this
.
items
=
items
;
}
}
},
computed
:
{
tagcolor
()
{
if
(
this
.
color
&&
this
.
item
&&
this
.
item
.
color
!=
''
&&
this
.
item
.
color
!=
null
)
{
return
this
.
item
.
color
}
return
'default'
},
},
style
()
{
computed
:
{
if
(
!
this
.
color
)
{
tagcolor
()
{
return
{}
if
(
}
this
.
color
&&
return
{
this
.
item
&&
color
:
this
.
item
.
color
!=
''
&&
this
.
item
&&
this
.
item
.
color
!=
''
&&
this
.
item
.
color
!=
null
this
.
item
.
color
!=
null
?
this
.
item
.
color
)
{
:
'inherit'
return
this
.
item
.
color
}
}
}
return
'default'
},
},
watch
:
{
style
()
{
value
(
v
)
{
if
(
!
this
.
color
)
{
this
.
setName
(
v
)
return
{}
// this.$forceUpdate()
}
return
{
color
:
this
.
item
&&
this
.
item
.
color
!=
''
&&
this
.
item
.
color
!=
null
?
this
.
item
.
color
:
'inherit'
}
}
},
},
data
(
v
){
watch
:
{
if
(
v
.
length
>
0
){
value
(
v
)
{
this
.
setName
(
this
.
value
)
this
.
setName
(
v
)
this
.
$forceUpdate
()
// this.$forceUpdate()
}
},
data
(
v
)
{
if
(
v
.
length
>
0
)
{
this
.
setName
(
this
.
value
)
this
.
$forceUpdate
()
}
}
}
}
}
}
}
</
script
>
</
script
>
\ No newline at end of file
layouts/default.vue
View file @
c8bd797d
<
template
>
<
template
>
<MainLayout
/>
<MainLayout
/>
</
template
>
</
template
>
<
script
>
<
script
>
import
MainLayout
from
"./basic-layout"
;
import
MainLayout
from
"./basic-layout"
;
// 配置
// 配置
import
Setting
from
"@/setting"
;
import
Setting
from
"@/setting"
;
// 方法
// 方法
import
{
getHeaderName
,
getMenuSider
,
getSiderSubmenu
}
from
"@/libs/system"
;
import
{
getHeaderName
,
getMenuSider
,
getSiderSubmenu
}
from
"@/libs/system"
;
// 菜单和路由
// 菜单和路由
import
menuHeader
from
"@/menu/header"
;
import
menuHeader
from
"@/menu/header"
;
import
menuSider
from
"@/menu/sider"
;
import
menuSider
from
"@/menu/sider"
;
import
{
frameInRoutes
}
from
"@/router/routes"
;
import
{
frameInRoutes
}
from
"@/router/routes"
;
export
default
{
export
default
{
middleware
:
"auth"
,
middleware
:
"auth"
,
components
:
{
MainLayout
},
components
:
{
data
()
{
MainLayout
return
{
},
menus
:
[]
data
()
{
};
return
{
},
menus
:
[]
created
()
{
};
// 处理路由 得到每一级的路由设置
},
this
.
$store
.
commit
(
"admin/page/init"
,
frameInRoutes
);
created
()
{
// 设置顶栏菜单
// 处理路由 得到每一级的路由设置
this
.
$store
.
commit
(
"admin/menu/setHeader"
,
menuHeader
);
this
.
$store
.
commit
(
"admin/page/init"
,
frameInRoutes
);
// 加载用户登录的数据
// 设置顶栏菜单
this
.
$store
.
dispatch
(
"admin/account/load"
);
this
.
$store
.
commit
(
"admin/menu/setHeader"
,
menuHeader
);
// 初始化全屏监听
// 加载用户登录的数据
this
.
$store
.
dispatch
(
"admin/layout/listenFullscreen"
);
this
.
$store
.
dispatch
(
"admin/account/load"
);
},
// 初始化全屏监听
mounted
()
{
this
.
$store
.
dispatch
(
"admin/layout/listenFullscreen"
);
this
.
getMenu
();
},
},
mounted
()
{
watch
:
{
this
.
getMenu
();
// 监听路由 控制侧边栏显示 标记当前顶栏菜单(如需要)
},
$route
(
to
,
from
)
{
watch
:
{
let
path
=
to
.
matched
[
to
.
matched
.
length
-
1
].
path
;
// 监听路由 控制侧边栏显示 标记当前顶栏菜单(如需要)
if
(
!
Setting
.
dynamicSiderMenu
)
{
$route
(
to
,
from
)
{
let
headerName
=
getHeaderName
(
path
,
menuSider
);
let
path
=
to
.
matched
[
to
.
matched
.
length
-
1
].
path
;
if
(
headerName
===
null
)
{
if
(
!
Setting
.
dynamicSiderMenu
)
{
path
=
to
.
path
;
let
headerName
=
getHeaderName
(
path
,
menuSider
);
headerName
=
getHeaderName
(
path
,
menuSider
);
if
(
headerName
===
null
)
{
}
path
=
to
.
path
;
// 在 404 时,是没有 headerName 的
headerName
=
getHeaderName
(
path
,
menuSider
);
if
(
headerName
!==
null
)
{
}
this
.
$store
.
commit
(
"admin/menu/setHeaderName"
,
headerName
);
// 在 404 时,是没有 headerName 的
if
(
headerName
!==
null
)
{
this
.
$store
.
commit
(
"admin/menu/setHeaderName"
,
headerName
);
const
filterMenuSider
=
getMenuSider
(
menuSider
,
headerName
);
const
filterMenuSider
=
getMenuSider
(
menuSider
,
headerName
);
this
.
$store
.
commit
(
"admin/menu/setSider"
,
filterMenuSider
);
this
.
$store
.
commit
(
"admin/menu/setSider"
,
filterMenuSider
);
this
.
$store
.
commit
(
"admin/menu/setActivePath"
,
to
.
path
);
this
.
$store
.
commit
(
"admin/menu/setActivePath"
,
to
.
path
);
const
openNames
=
getSiderSubmenu
(
path
,
menuSider
);
const
openNames
=
getSiderSubmenu
(
path
,
menuSider
);
this
.
$store
.
commit
(
"admin/menu/setOpenNames"
,
openNames
);
this
.
$store
.
commit
(
"admin/menu/setOpenNames"
,
openNames
);
}
}
else
{
let
menus
=
this
.
$store
.
state
.
admin
.
menu
.
sider
;
this
.
$store
.
commit
(
"admin/menu/setActivePath"
,
to
.
path
);
const
openNames
=
getSiderSubmenu
(
path
,
menus
);
this
.
$store
.
commit
(
"admin/menu/setOpenNames"
,
openNames
);
}
// this.appRouteChange(to, from);
}
}
}
else
{
},
let
menus
=
this
.
$store
.
state
.
admin
.
menu
.
sider
;
methods
:
{
this
.
$store
.
commit
(
"admin/menu/setActivePath"
,
to
.
path
);
const
openNames
=
getSiderSubmenu
(
path
,
menus
);
this
.
$store
.
commit
(
"admin/menu/setOpenNames"
,
openNames
);
}
// this.appRouteChange(to, from);
}
},
methods
:
{
getMenu
()
{
getMenu
()
{
this
.
$http
.
sysUser
.
getusermenu
({
id
:
"portal"
}).
then
(
res
=>
{
this
.
$http
.
sysUser
.
getusermenu
({
if
(
res
.
result
)
{
id
:
"portal"
this
.
menus
=
res
.
result
[
0
].
children
;
}).
then
(
res
=>
{
this
.
toMenu
(
this
.
menus
);
if
(
res
.
result
)
{
let
headerName
=
"home"
;
this
.
menus
=
res
.
result
[
0
].
children
;
this
.
$store
.
commit
(
"admin/menu/setHeaderName"
,
headerName
);
this
.
toMenu
(
this
.
menus
);
this
.
$store
.
commit
(
"admin/page/init"
,
this
.
menus
);
let
headerName
=
"home"
;
const
filterMenuSider
=
getMenuSider
(
this
.
menus
,
headerName
);
this
.
$store
.
commit
(
"admin/menu/setHeaderName"
,
headerName
);
this
.
$store
.
commit
(
"admin/menu/setSider"
,
filterMenuSider
);
this
.
$store
.
commit
(
"admin/page/init"
,
this
.
menus
);
// if (to) {
const
filterMenuSider
=
getMenuSider
(
this
.
menus
,
headerName
);
// this.$store.commit("admin/menu/setActivePath", to.path);
this
.
$store
.
commit
(
"admin/menu/setSider"
,
filterMenuSider
);
// }
// if (to) {
// this.$store.commit("admin/menu/setActivePath", to.path);
// }
// const openNames = getSiderSubmenu(path, menuSider);
// const openNames = getSiderSubmenu(path, menuSider);
// this.$store.commit("admin/menu/setOpenNames", openNames);
// this.$store.commit("admin/menu/setOpenNames", openNames);
}
else
{
}
else
{
this
.
$Message
.
error
(
"加载产品树失败!"
);
this
.
$Message
.
error
(
"加载产品树失败!"
);
}
}
});
});
},
},
toMenu
(
list
)
{
toMenu
(
list
)
{
list
.
forEach
(
datas
=>
{
list
.
forEach
(
datas
=>
{
var
that
=
this
;
var
that
=
this
;
var
listObj
=
{};
var
listObj
=
{};
datas
.
path
=
datas
.
url
;
datas
.
path
=
datas
.
url
;
let
name
=
datas
.
url
.
replace
(
/
\/
/g
,
"-"
);
let
name
=
datas
.
url
.
replace
(
/
\/
/g
,
"-"
);
datas
.
header
=
"home"
;
datas
.
header
=
"home"
;
delete
datas
.
target
;
delete
datas
.
target
;
if
(
name
.
substr
(
0
,
1
)
==
"-"
)
{
if
(
name
.
substr
(
0
,
1
)
==
"-"
)
{
name
=
name
.
substr
(
1
);
name
=
name
.
substr
(
1
);
}
}
if
(
name
.
charAt
(
name
.
length
-
1
)
==
"-"
)
{
if
(
name
.
charAt
(
name
.
length
-
1
)
==
"-"
)
{
name
=
name
.
substr
(
0
,
name
.
length
-
1
);
name
=
name
.
substr
(
0
,
name
.
length
-
1
);
}
}
datas
.
meta
=
{
datas
.
meta
=
{
auth
:
false
,
auth
:
false
,
title
:
datas
.
title
,
title
:
datas
.
title
,
closable
:
true
closable
:
true
};
};
datas
.
name
=
name
;
datas
.
name
=
name
;
if
(
datas
.
children
!=
null
)
{
if
(
datas
.
children
!=
null
)
{
this
.
toMenu
(
datas
.
children
);
this
.
toMenu
(
datas
.
children
);
}
});
this
.
menusNew
=
list
;
}
}
});
this
.
menusNew
=
list
;
}
}
}
};
};
</
script
>
</
script
>
\ No newline at end of file
pages/basicData/user/index.vue
View file @
c8bd797d
...
@@ -302,6 +302,7 @@ export default {
...
@@ -302,6 +302,7 @@ export default {
key
:
"licensedToWork"
,
key
:
"licensedToWork"
,
title
:
this
.
l
(
"licensedToWork"
),
title
:
this
.
l
(
"licensedToWork"
),
align
:
"left"
,
align
:
"left"
,
code
:
"User.base.workLicense"
,
},
},
{
{
key
:
"positionId"
,
key
:
"positionId"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment