Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qa-platform-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
QA
qa-platform-ui
Commits
31484c6d
Commit
31484c6d
authored
Jun 29, 2021
by
黎博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
权限处理
parent
f2827f07
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
12 deletions
+12
-12
user.js
src/store/modules/user.js
+0
-1
hasPermission.js
src/utils/hasPermission.js
+2
-3
ProjectList.vue
src/views/auto/ProjectList.vue
+9
-6
Aside.vue
src/views/layout/leftAside/Aside.vue
+1
-2
No files found.
src/store/modules/user.js
View file @
31484c6d
...
@@ -33,7 +33,6 @@ const getters = {
...
@@ -33,7 +33,6 @@ const getters = {
// 异步获取用户信息
// 异步获取用户信息
const
actions
=
{
const
actions
=
{
userMsg
(
context
,
userInfo
)
{
userMsg
(
context
,
userInfo
)
{
console
.
log
(
'
用户信息
'
,
userInfo
)
context
.
commit
(
'
SET_USER
'
,
userInfo
.
userInfo
)
context
.
commit
(
'
SET_USER
'
,
userInfo
.
userInfo
)
}
}
}
}
...
...
src/utils/hasPermission.js
View file @
31484c6d
//
import store from '../store/store'
import
store
from
'
../store/store
'
export
function
hasPermission
(
permission
)
{
export
function
hasPermission
(
permission
)
{
permission
=
permission
.
trim
()
permission
=
permission
.
trim
()
let
myPermissions
=
this
.
$store
.
user
.
getters
.
PermissionList
let
myPermissions
=
store
.
getters
[
'
user/PermissionList
'
]
console
.
log
(
'
111
'
,
myPermissions
)
return
myPermissions
.
indexOf
(
permission
)
>
-
1
return
myPermissions
.
indexOf
(
permission
)
>
-
1
}
}
src/views/auto/ProjectList.vue
View file @
31484c6d
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
<el-button
type=
"primary"
icon=
"el-icon-search"
@
click=
"searchMockList"
>
查询
</el-button>
-->
<el-button
type=
"primary"
icon=
"el-icon-search"
@
click=
"searchMockList"
>
查询
</el-button>
-->
<!--
<el-button
type=
"primary"
icon=
"el-icon-circle-plus"
@
click=
"DialogAddVisible=true"
>
新增
</el-button>
-->
<!--
<el-button
type=
"primary"
icon=
"el-icon-circle-plus"
@
click=
"DialogAddVisible=true"
>
新增
</el-button>
-->
<el-button
type=
"primary"
icon=
"el-icon-circle-plus"
@
click=
"DialogAddVisible=true"
v-
permission=
"'auto:project:add'
"
>
新增
</el-button>
<el-button
type=
"primary"
icon=
"el-icon-circle-plus"
@
click=
"DialogAddVisible=true"
v-
if=
"hasPermission('auto:project:add')
"
>
新增
</el-button>
</div>
</div>
<el-table
:data=
"projectList"
border
style=
"width: 100%;margin-top:20px"
>
<el-table
:data=
"projectList"
border
style=
"width: 100%;margin-top:20px"
>
<el-table-column
type=
'index'
width=
"50px"
>
<el-table-column
type=
'index'
width=
"50px"
>
...
@@ -19,8 +19,8 @@
...
@@ -19,8 +19,8 @@
<el-table-column
prop=
"createTime"
label=
"创建时间"
width=
"200px"
></el-table-column>
<el-table-column
prop=
"createTime"
label=
"创建时间"
width=
"200px"
></el-table-column>
<el-table-column
label=
"操作"
>
<el-table-column
label=
"操作"
>
<slot
slot-scope=
"scope"
>
<slot
slot-scope=
"scope"
>
<el-button
type=
"warning"
icon=
"el-icon-edit"
@
click=
"openEditDialog(scope.row)"
>
编辑
</el-button>
<el-button
type=
"warning"
icon=
"el-icon-edit"
@
click=
"openEditDialog(scope.row)"
v-if=
"hasPermission('auto:project:edit')"
>
编辑
</el-button>
<el-button
type=
"danger"
icon=
"el-icon-delete"
@
click=
"delProjectFrom(scope.row)"
>
删除
</el-button>
<el-button
type=
"danger"
icon=
"el-icon-delete"
@
click=
"delProjectFrom(scope.row)"
v-if=
"hasPermission('auto:project:del')"
>
删除
</el-button>
</slot>
</slot>
</el-table-column>
</el-table-column>
</el-table>
</el-table>
...
@@ -61,13 +61,13 @@
...
@@ -61,13 +61,13 @@
</template>
</template>
<
script
>
<
script
>
import
{
mapGetters
}
from
'
vuex
'
import
{
import
{
getProjectList
,
getProjectList
,
addProject
,
addProject
,
editProject
,
editProject
,
delProject
delProject
}
from
'
@/api/getAotoInterface
'
}
from
'
@/api/getAotoInterface
'
import
{
mapGetters
}
from
'
vuex
'
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
...
@@ -115,8 +115,8 @@ export default {
...
@@ -115,8 +115,8 @@ export default {
},
},
computed
:
{
computed
:
{
...
mapGetters
({
...
mapGetters
({
// 获取
权限
信息
// 获取
用户
信息
getP
ermissionList
:
'
user/PermissionList
'
p
ermissionList
:
'
user/PermissionList
'
})
})
},
},
methods
:
{
methods
:
{
...
@@ -226,6 +226,9 @@ export default {
...
@@ -226,6 +226,9 @@ export default {
handleCurrentChange
(
newPage
)
{
handleCurrentChange
(
newPage
)
{
this
.
queryModuleInfo
.
pageNum
=
newPage
this
.
queryModuleInfo
.
pageNum
=
newPage
this
.
getProjectList
()
this
.
getProjectList
()
},
hasPermission
(
permission
)
{
return
this
.
permissionList
.
indexOf
(
permission
)
>
-
1
}
}
}
}
}
}
...
...
src/views/layout/leftAside/Aside.vue
View file @
31484c6d
...
@@ -97,11 +97,10 @@ export default {
...
@@ -97,11 +97,10 @@ export default {
// this.$store.dispatch('user/userMsg', {
// this.$store.dispatch('user/userMsg', {
// userInfo: resp.data.data
// userInfo: resp.data.data
// })
// })
console
.
log
(
this
.
getUserId
)
// 同步赋值mutations
// 同步赋值mutations
this
.
$store
.
commit
(
'
user/SET_USER
'
,
resp
.
data
.
data
)
this
.
$store
.
commit
(
'
user/SET_USER
'
,
resp
.
data
.
data
)
console
.
log
(
this
.
getUserId
)
this
.
menuList
=
resp
.
data
.
data
.
menuList
this
.
menuList
=
resp
.
data
.
data
.
menuList
this
.
getNav
()
this
.
getNav
()
})
})
...
...
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