Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MeterSphere
metersphere
提交
681db17d
M
metersphere
项目概览
MeterSphere
/
metersphere
上一次同步 大约 3 年
通知
25
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
metersphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
681db17d
编写于
2月 20, 2020
作者:
S
shiziyuan9527
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改切换组织和切换工作空间的位置
上级
ad2dfef8
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
115 addition
and
91 deletion
+115
-91
frontend/src/performance/components/HeaderMenus.vue
frontend/src/performance/components/HeaderMenus.vue
+1
-81
frontend/src/performance/components/HeaderUser.vue
frontend/src/performance/components/HeaderUser.vue
+114
-10
未找到文件。
frontend/src/performance/components/HeaderMenus.vue
浏览文件 @
681db17d
...
...
@@ -2,24 +2,6 @@
<el-menu
class=
"header-menu"
:unique-opened=
"true"
mode=
"horizontal"
router
menu-trigger=
"click"
>
<el-menu-item
index=
"1"
><a
href=
"/"
style=
"text-decoration: none;"
>
{{
$t
(
"
i18n.home
"
)
}}
</a></el-menu-item>
<el-submenu
index=
"7"
popper-class=
"submenu"
>
<template
slot=
"title"
>
组织
</
template
>
<label
v-for=
"(item,index) in organizationList"
:key=
"index"
>
<el-menu-item
@
click=
"clickMenu(item)"
>
{{item.name}}
<i
class=
"el-icon-check"
v-if=
"item.id === currentUserInfo.lastSourceId || item.id === workspaceParentId"
></i>
</el-menu-item>
</label>
</el-submenu>
<el-submenu
index=
"2"
popper-class=
"submenu"
>
<
template
slot=
"title"
>
工作空间
</
template
>
<label
v-for=
"(item,index) in workspaceList"
:key=
"index"
>
<el-menu-item
@
click=
"clickMenu(item)"
>
{{item.name}}
<i
class=
"el-icon-check"
v-if=
"item.id === currentUserInfo.lastSourceId"
></i>
</el-menu-item>
</label>
</el-submenu>
<el-submenu
index=
"3"
popper-class=
"submenu"
v-permission=
"['test_manager']"
>
<template
slot=
"title"
>
项目
</
template
>
<el-menu-item
index=
"3-1"
>
项目1
</el-menu-item>
...
...
@@ -56,68 +38,10 @@
<
script
>
import
RecentTestPlan
from
"
./testPlan/RecentTestPlan
"
;
import
Cookies
from
"
js-cookie
"
;
import
{
TokenKey
}
from
"
../../common/constants
"
;
export
default
{
name
:
"
MsMenus
"
,
components
:
{
RecentTestPlan
},
created
()
{
this
.
initMenuData
();
this
.
getCurrentUserInfo
();
},
computed
:
{
workspaceParentId
()
{
let
result
=
''
;
if
(
this
.
workspaceIds
.
includes
(
this
.
currentUserInfo
.
lastSourceId
))
{
let
obj
=
this
.
workspaceList
.
filter
(
r
=>
r
.
id
===
this
.
currentUserInfo
.
lastSourceId
);
if
(
obj
.
length
>
0
)
{
result
=
obj
[
0
].
organizationId
;
}
}
return
result
;
}
},
data
()
{
return
{
organizationList
:
[
{
index
:
'
7-1
'
,
name
:
'
组织1
'
},
],
workspaceList
:
[
{
index
:
'
2-1
'
,
name
:
'
无工作空间
'
},
],
currentUserInfo
:
{},
currentUserId
:
JSON
.
parse
(
Cookies
.
get
(
TokenKey
)).
id
,
workspaceIds
:
[]
}
},
methods
:
{
initMenuData
()
{
this
.
$get
(
"
/organization/list/userorg/
"
+
this
.
currentUserId
,
response
=>
{
this
.
organizationList
=
response
.
data
;
})
this
.
$get
(
"
/workspace/list/userworkspace/
"
+
this
.
currentUserId
,
response
=>
{
this
.
workspaceList
=
response
.
data
;
this
.
workspaceIds
=
response
.
data
.
map
(
r
=>
r
.
id
);
})
},
getCurrentUserInfo
()
{
this
.
$get
(
"
/user/info/
"
+
this
.
currentUserId
,
response
=>
{
this
.
currentUserInfo
=
response
.
data
;
})
},
clickMenu
(
data
)
{
if
(
data
.
id
===
this
.
currentUserInfo
.
lastSourceId
)
{
return
false
;
}
window
.
console
.
log
(
data
.
id
);
let
user
=
{};
user
.
id
=
this
.
currentUserInfo
.
id
;
user
.
lastSourceId
=
data
.
id
;
this
.
$post
(
"
/user/switch/source/
"
+
user
.
lastSourceId
,
{});
window
.
location
.
reload
();
}
}
components
:
{
RecentTestPlan
}
}
</
script
>
...
...
@@ -143,8 +67,4 @@
.el-divider--horizontal
{
margin
:
0
;
}
.el-icon-check
{
color
:
#44b349
;
}
</
style
>
frontend/src/performance/components/HeaderUser.vue
浏览文件 @
681db17d
<
template
>
<el-dropdown
size=
"medium"
@
command=
"handleCommand"
>
<span
class=
"dropdown-link"
>
{{
currentUser
.
name
}}
<i
class=
"el-icon-caret-bottom el-icon--right"
/>
</span>
<el-dropdown-menu
slot=
"dropdown"
>
<el-dropdown-item
command=
"personal"
>
个人信息
</el-dropdown-item>
<el-dropdown-item
command=
"logout"
>
退出系统
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<div
class=
"ms-org-ws"
>
<el-row
:gutter=
"10"
style=
"height:200px;"
>
<el-col
:span=
"16"
:offset=
"4"
>
<el-menu
:unique-opened=
"true"
mode=
"horizontal"
router
menu-trigger=
"click"
class=
"header-user-menu"
background-color=
"rgb(44, 42, 72)"
text-color=
"#fff"
>
<el-submenu
index=
"1"
popper-class=
"submenu"
>
<template
slot=
"title"
>
组织
</
template
>
<label
v-for=
"(item,index) in organizationList"
:key=
"index"
>
<el-menu-item
@
click=
"clickMenu(item)"
>
{{item.name}}
<i
class=
"el-icon-check"
v-if=
"item.id === currentUserInfo.lastSourceId || item.id === workspaceParentId"
></i>
</el-menu-item>
</label>
</el-submenu>
<el-submenu
index=
"2"
popper-class=
"submenu"
>
<
template
slot=
"title"
>
工作空间
</
template
>
<label
v-for=
"(item,index) in workspaceList"
:key=
"index"
>
<el-menu-item
@
click=
"clickMenu(item)"
>
{{item.name}}
<i
class=
"el-icon-check"
v-if=
"item.id === currentUserInfo.lastSourceId"
></i>
</el-menu-item>
</label>
</el-submenu>
</el-menu>
</el-col>
<el-col
:span=
"4"
>
<el-dropdown
size=
"medium"
@
command=
"handleCommand"
>
<span
class=
"dropdown-link"
>
{{currentUser.name}}
<i
class=
"el-icon-caret-bottom el-icon--right"
/>
</span>
<el-dropdown-menu
slot=
"dropdown"
>
<el-dropdown-item
command=
"personal"
>
个人信息
</el-dropdown-item>
<el-dropdown-item
command=
"logout"
>
退出系统
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-col>
</el-row>
</div>
</template>
<
script
>
...
...
@@ -16,11 +49,38 @@
export
default
{
name
:
"
MsUser
"
,
created
()
{
this
.
initMenuData
();
this
.
getCurrentUserInfo
();
},
data
()
{
return
{
organizationList
:
[
{
index
:
'
7-1
'
,
name
:
'
组织1
'
},
],
workspaceList
:
[
{
index
:
'
2-1
'
,
name
:
'
无工作空间
'
},
],
currentUserInfo
:
{},
currentUserId
:
JSON
.
parse
(
Cookies
.
get
(
TokenKey
)).
id
,
workspaceIds
:
[]
}
},
computed
:
{
currentUser
:
()
=>
{
let
user
=
Cookies
.
get
(
TokenKey
);
window
.
console
.
log
(
user
);
return
JSON
.
parse
(
user
);
},
workspaceParentId
()
{
let
result
=
''
;
if
(
this
.
workspaceIds
.
includes
(
this
.
currentUserInfo
.
lastSourceId
))
{
let
obj
=
this
.
workspaceList
.
filter
(
r
=>
r
.
id
===
this
.
currentUserInfo
.
lastSourceId
);
if
(
obj
.
length
>
0
)
{
result
=
obj
[
0
].
organizationId
;
}
}
return
result
;
}
},
methods
:
{
...
...
@@ -38,15 +98,59 @@
default
:
break
;
}
},
initMenuData
()
{
this
.
$get
(
"
/organization/list/userorg/
"
+
this
.
currentUserId
,
response
=>
{
this
.
organizationList
=
response
.
data
;
})
this
.
$get
(
"
/workspace/list/userworkspace/
"
+
this
.
currentUserId
,
response
=>
{
this
.
workspaceList
=
response
.
data
;
this
.
workspaceIds
=
response
.
data
.
map
(
r
=>
r
.
id
);
})
},
getCurrentUserInfo
()
{
this
.
$get
(
"
/user/info/
"
+
this
.
currentUserId
,
response
=>
{
this
.
currentUserInfo
=
response
.
data
;
})
},
clickMenu
(
data
)
{
if
(
data
.
id
===
this
.
currentUserInfo
.
lastSourceId
)
{
return
false
;
}
window
.
console
.
log
(
data
.
id
);
let
user
=
{};
user
.
id
=
this
.
currentUserInfo
.
id
;
user
.
lastSourceId
=
data
.
id
;
this
.
$post
(
"
/user/update
"
,
user
);
window
.
location
.
reload
();
}
}
}
</
script
>
<
style
>
.header-user-menu.el-menu--horizontal
>
li
.el-submenu
>
*
{
height
:
40px
;
line-height
:
40px
;
color
:
inherit
;
}
</
style
>
<
style
scoped
>
.dropdown-link
{
cursor
:
pointer
;
font-size
:
12px
;
color
:
rgb
(
245
,
245
,
245
);
}
.ms-org-ws
{
width
:
30%
;
height
:
40px
;
line-height
:
40px
;
}
.el-icon-check
{
color
:
#44b349
;
margin-left
:
10px
;
}
</
style
>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录