Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
admin
Overview
Overview
Details
Activity
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
baihong
admin
Commits
1ce24c12
Commit
1ce24c12
authored
Apr 25, 2021
by
baihong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add:新增角色管理,增删改查
parent
769d1455
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
239 additions
and
2 deletions
+239
-2
activityClocks.js
src/api/clock/activityClocks.js
+20
-0
routers.js
src/router/routers.js
+8
-0
logList.vue
src/view/admin/logList.vue
+2
-2
roleList.vue
src/view/admin/roleList.vue
+209
-0
No files found.
src/api/clock/activityClocks.js
View file @
1ce24c12
...
...
@@ -41,4 +41,23 @@ export const getActivityConfigByPay = (data) => {
//日志操作
export
const
adminLogs
=
(
data
)
=>
{
return
$http
.
get
(
'/cms/adminLogs'
,
data
)
}
//角色列表
export
const
groups
=
(
data
)
=>
{
return
$http
.
get
(
'/cms/groups'
,
data
)
}
export
const
groupsDe
=
(
data
)
=>
{
return
$http
.
get
(
'/cms/groups/'
+
data
)
}
export
const
menus
=
(
data
)
=>
{
return
$http
.
get
(
'/cms/menus'
,
data
)
}
export
const
addGroups
=
(
data
)
=>
{
return
$http
.
postObj
(
'/cms/groups'
,
data
)
}
export
const
updateGroups
=
(
id
,
data
)
=>
{
return
$http
.
putObj
(
'/cms/groups/'
+
id
,
data
)
}
export
const
delGroups
=
(
id
)
=>
{
return
$http
.
delete
(
'/cms/groups/'
+
id
)
}
\ No newline at end of file
src/router/routers.js
View file @
1ce24c12
...
...
@@ -282,6 +282,14 @@ export default [
component
:
()
=>
import
(
"@/view/admin/list.vue"
)
},
{
path
:
"/admin/roleList"
,
name
:
"roleList"
,
meta
:
{
title
:
"角色管理"
},
component
:
()
=>
import
(
"@/view/admin/roleList.vue"
)
},
{
path
:
"/admin/logList"
,
name
:
"logList"
,
meta
:
{
...
...
src/view/admin/logList.vue
View file @
1ce24c12
...
...
@@ -2,10 +2,10 @@
<div
class=
"content"
>
<div
class=
"topSearch"
>
<div
class=
"left"
>
管理员搜索
:
管理员搜索
:
<Input
v-model=
"keyword"
style=
"width:150px"
style=
"width:150px
;
"
enter-button
placeholder=
"请输入"
/>
...
...
src/view/admin/roleList.vue
0 → 100644
View file @
1ce24c12
<
template
>
<div
class=
"content"
>
<div
class=
"topSearch"
>
<div
class=
"left"
></div>
<div
class=
"right"
>
<Button
type=
"primary"
@
click=
"
add = true;
modal1 = true;
"
>
新增
</Button
>
</div>
</div>
<Table
:loading=
"$store.state.app.isLoading"
border
ref=
"selection"
:columns=
"columns"
:data=
"data"
>
<template
slot-scope=
"
{ row }" slot="action">
<a
@
click=
"
modal1 = true;
add = false;
uuid = row.uuid;
name = row.name;
"
>
编辑
</a
>
<a
style=
"margin-left:10px"
@
click=
"del(row.uuid)"
>
删除
</a>
</
template
>
</Table>
<Modal
v-model=
"modal1"
title=
"新增/编辑角色"
@
on-ok=
"ok"
@
on-cancel=
"modal1 = false"
>
<Form
ref=
"formValidate"
:label-width=
"100"
>
<FormItem
label=
"管理员名称"
prop=
"name"
>
<Input
v-model=
"name"
style=
"width:60%"
placeholder=
"请输入"
></Input>
</FormItem>
<FormItem
prop=
"name"
>
<Tree
:data=
"menu"
show-checkbox
multiple
@
on-check-change=
"onselectchange"
></Tree>
</FormItem>
</Form>
</Modal>
<Pager
class=
"margin-top-10"
:config=
"config"
@
on-change=
"handlePager"
></Pager>
</div>
</template>
<
script
>
import
{
groups
,
groupsDe
,
menus
,
addGroups
,
updateGroups
,
delGroups
}
from
"@/api/clock/activityClocks"
;
import
{
formatDate
}
from
"@/libs/util"
;
import
Pager
from
"@/view/common/Pager.vue"
;
export
default
{
name
:
"categories"
,
components
:
{
Pager
},
filters
:
{
format
(
value
)
{
return
formatDate
(
value
);
}
},
data
()
{
return
{
uuid
:
""
,
modal1
:
false
,
add
:
true
,
name
:
""
,
config
:
{
total
:
0
,
size
:
10
,
current
:
1
},
date
:
[],
menu
:
[],
second_menu_uuid
:
[],
status
:
null
,
pageIndex
:
1
,
pageSize
:
10
,
data
:
[],
columns
:
[
{
title
:
"角色名称"
,
key
:
"name"
},
{
title
:
"操作"
,
slot
:
"action"
}
]
};
},
methods
:
{
search
()
{
let
params
=
{
language
:
"cn"
,
page_index
:
this
.
pageIndex
,
page_size
:
this
.
pageSize
};
groups
(
params
).
then
(
res
=>
{
this
.
config
.
total
=
res
.
total
;
this
.
data
=
res
.
data
;
});
},
onselectchange
(
p
)
{
console
.
log
(
p
);
this
.
second_menu_uuid
=
p
.
map
(
p
=>
{
if
(
p
.
children
.
length
)
{
p
.
children
=
p
.
children
.
map
(
i
=>
{
if
(
i
.
children
.
length
)
{
i
.
children
=
i
.
children
(
l
=>
{
return
l
.
uuid
;
});
}
return
i
.
uuid
;
});
}
return
p
.
uuid
;
});
},
del
(
id
)
{
delGroups
(
id
).
then
(
res
=>
{
this
.
$Message
.
success
(
"删除成功"
);
this
.
search
();
});
},
ok
()
{
if
(
this
.
add
)
{
let
params
=
{
name
:
this
.
name
,
menu_uuid
:
this
.
second_menu_uuid
};
addGroups
(
params
).
then
(
res
=>
{
this
.
$Message
.
success
(
"增加成功"
);
this
.
search
();
});
}
else
{
let
params
=
{
name
:
this
.
name
,
menu_uuid
:
this
.
second_menu_uuid
};
updateGroups
(
this
.
uuid
,
params
).
then
(
res
=>
{
this
.
$Message
.
success
(
"修改成功"
);
this
.
search
();
});
}
},
getMenus
()
{
menus
().
then
(
res
=>
{
this
.
menu
=
res
.
root
.
map
(
p
=>
{
p
.
title
=
p
.
name
;
p
.
checked
=
this
.
second_menu_uuid
.
includes
(
p
.
uuid
);
if
(
p
.
children
.
length
)
{
p
.
children
=
p
.
children
.
map
(
i
=>
{
i
.
title
=
i
.
name
;
i
.
checked
=
this
.
second_menu_uuid
.
includes
(
i
.
uuid
);
if
(
i
.
children
.
length
)
{
i
.
children
=
i
.
children
.
map
(
l
=>
{
l
.
title
=
l
.
name
;
l
.
checked
=
this
.
second_menu_uuid
.
includes
(
l
.
uuid
);
return
l
;
});
}
return
i
;
});
}
return
p
;
});
});
},
handlePager
(
pager
)
{
this
.
pageIndex
=
pager
.
current
;
this
.
pageSize
=
pager
.
size
;
this
.
search
();
},
edit
(
p
)
{
this
.
modal1
=
true
;
groupsDe
(
p
.
uuid
).
then
(
res
=>
{
this
.
second_menu_uuid
=
res
.
second_menu_uuid
;
this
.
getMenus
();
});
}
},
mounted
()
{
this
.
search
();
this
.
getMenus
();
}
};
</
script
>
<
style
lang=
"less"
></
style
>
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