Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
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
hujun
tl_estate
Commits
5985a3af
Commit
5985a3af
authored
Jan 31, 2018
by
刘丹
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
权限分配
parent
2b59d83d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
101 additions
and
14 deletions
+101
-14
index.html
application/index/view/auth/index.html
+7
-4
route.php
application/route.php
+1
-1
auth.js
public/resource/js/auth.js
+68
-6
auth_template_tpl.html
public/resource/template/auth_template_tpl.html
+25
-3
No files found.
application/index/view/auth/index.html
View file @
5985a3af
...
...
@@ -12,7 +12,7 @@
<div
class=
"pull-right"
>
<ul
class=
"bread_btn"
>
<li>
<a
href=
"
/index/role
edit"
data-toggle=
"modal"
class=
"btn btn-default"
><i
class=
"icon-plus"
></i>
<a
href=
"
#modal-
edit"
data-toggle=
"modal"
class=
"btn btn-default"
><i
class=
"icon-plus"
></i>
添加角色
</a>
</li>
</ul>
...
...
@@ -73,7 +73,7 @@
<div
class=
"modal-footer"
>
<button
type=
"button"
class=
"btn btn-default"
data-dismiss=
"modal"
>
关闭
</button>
<button
type=
"button"
class=
"btn btn-primary submit_
follow2
"
data-dismiss=
"modal"
>
<button
type=
"button"
class=
"btn btn-primary submit_
edit
"
data-dismiss=
"modal"
>
提交
</button>
</div>
...
...
@@ -93,12 +93,15 @@
</h4>
</div>
<div
class=
"modal-body"
>
<div
class=
"auth"
id=
"access_box"
>
</div>
</div>
<div
class=
"modal-footer"
>
<button
type=
"button"
class=
"btn btn-default"
data-dismiss=
"modal"
>
关闭
</button>
<button
type=
"button"
class=
"btn btn-primary submit_
follow2
"
data-dismiss=
"modal"
>
<button
type=
"button"
class=
"btn btn-primary submit_
power
"
data-dismiss=
"modal"
>
提交
</button>
</div>
...
...
application/route.php
View file @
5985a3af
...
...
@@ -85,7 +85,7 @@ Route::group('index', [
'access'
=>
[
'index/auth/access'
,
[
'method'
=>
'get'
]],
//--权限分配角色页面
'updateAccess'
=>
[
'index/auth/updateAccess'
,
[
'method'
=>
'post'
]],
//--编辑角色权限【接口】
'addAuth'
=>
[
'index/auth/addAuth'
,
[
'method'
=>
'get|post'
]],
//--添加角色【接口】
'accessLook'
=>
[
'index/auth/accessLook'
,
[
'method'
=>
'post'
]],
//--查看编辑角色权限【接口】
'accessLook'
=>
[
'index/auth/accessLook'
,
[
'method'
=>
'
get|
post'
]],
//--查看编辑角色权限【接口】
'setStatus'
=>
[
'index/auth/setStatus'
,
[
'method'
=>
'post'
]],
//--设置角色的状态【接口】
'accessUser'
=>
[
'index/auth/accessUser'
,
[
'method'
=>
'get'
]],
//成员授权
...
...
public/resource/js/auth.js
View file @
5985a3af
...
...
@@ -9,31 +9,93 @@ define (['doT', 'text!temp/auth_template_tpl.html', 'css!style/home.css','pagina
auth
.
event
();
},
event
:
function
()
{
$
(
document
).
delegate
(
".
anch
"
,
"click"
,
function
()
{
//点击编辑
$
(
document
).
delegate
(
".
edit
"
,
"click"
,
function
()
{
//点击编辑
auth
.
house_id
=
$
(
this
).
attr
(
"data-id"
);
auth
.
Edit
();
});
$
(
document
).
delegate
(
".submit_edit"
,
"click"
,
function
()
{
//提交编辑
auth
.
Submit_edit
();
auth
.
getList
();
});
$
(
document
).
delegate
(
".power"
,
"click"
,
function
()
{
//点击权限分配
auth
.
id
=
$
(
this
).
attr
(
"data-id"
);
auth
.
Power
();
});
$
(
document
).
delegate
(
".submit_power"
,
"click"
,
function
()
{
//点击提交权限
auth
.
Submit_power
();
});
},
Edit
:
function
(){
var
caozuo_table
=
""
;
Edit
:
function
(){
//获取
$
.
ajax
({
'type'
:
'GET'
,
'url'
:
'/index/addAuth/group_id/'
,
//获取编辑数据
data
:
{
"id"
:
auth
.
house_id
},
dataType
:
"json"
,
success
:
function
(
data
){
if
(
data
.
code
==
200
){
if
(
data
.
data
)
{
$
(
"input[name = id]"
).
val
(
data
.
data
.
id
);
$
(
"input[name = title]"
).
val
(
data
.
data
.
title
);
$
(
"#description"
).
val
(
data
.
data
.
description
);
}
}
else
{
else
{
alert
(
'获取失败!'
);
}
}
});
},
Submit_edit
:
function
(){
//提交编辑的信息
var
par
=
{};
par
.
id
=
auth
.
house_id
;
par
.
title
=
$
(
"input[name =title]"
).
val
();
par
.
description
=
$
(
"textarea[name =description]"
).
val
();
$
.
ajax
({
'type'
:
'POST'
,
'url'
:
'/index/addAuth'
,
data
:
par
,
dataType
:
"json"
,
success
:
function
(
data
){
if
(
data
.
code
==
200
){
}
else
{
alert
(
data
.
msg
);
}
}
});
},
Power
:
function
(){
//获取的信息
$
.
ajax
({
'type'
:
'GET'
,
'url'
:
'/index/accessLook'
,
data
:{
id
:
auth
.
id
},
dataType
:
"json"
,
success
:
function
(
data
){
var
temp
=
document
.
getElementById
(
'access_tpl'
).
innerHTML
;
var
doTempl
=
doT
.
template
(
temp
);
$
(
"#access_box"
).
html
(
doTempl
(
data
.
data
.
class
));
}
});
},
Submit_power
:
function
(){
//提交权限的信息
var
v
=
''
;
$
(
"input[name=rules]:checked"
).
each
(
function
(
i
)
{
v
+=
$
(
this
).
val
()
+
','
;
})
$
.
ajax
({
'type'
:
'POST'
,
'url'
:
'/index/updateAccess'
,
data
:{
'rules'
:
v
,
'id'
:
auth
.
id
},
dataType
:
"json"
,
success
:
function
(
data
){
if
(
data
.
code
==
200
){
}
else
{
alert
(
data
.
msg
);
}
}
});
},
getList
:
function
(
pageNo
)
{
auth
.
pageNo
=
pageNo
;
var
params
=
{};
...
...
@@ -41,7 +103,7 @@ define (['doT', 'text!temp/auth_template_tpl.html', 'css!style/home.css','pagina
params
.
pageSize
=
auth
.
pageSize
;
$
.
ajax
({
url
:
'/index/getAuth.html'
,
url
:
'/index/getAuth.html'
,
//列表数据
type
:
'GET'
,
async
:
true
,
data
:
params
,
...
...
public/resource/template/auth_template_tpl.html
View file @
5985a3af
...
...
@@ -11,7 +11,8 @@
<
/td
>
<
td
>
[
%=
it
[
item
][
"status"
]
%
]
<
/td
>
<
td
>
<
a
class
=
"btn1 btn-success "
href
=
"#modal-edit"
data
-
toggle
=
"modal"
data
-
id
=
'[%= it[item]["id"] %]'
>
编辑
<
/a
>
<
a
class
=
"btn1 btn-success edit"
href
=
"#modal-edit"
data
-
toggle
=
"modal"
data
-
id
=
'[%= it[item]["id"] %]'
>
编辑
<
/a
>
<
a
class
=
"btn btn-info btn-xs power"
href
=
"#modal-power"
data
-
toggle
=
"modal"
data
-
id
=
'[%= it[item]["id"] %]'
>
权限分配
<
/a
>
<
a
class
=
"btn btn-info btn-xs"
href
=
"/admin.php/index/access?id=[%= it[item]['id']%]"
data
-
toggle
=
"modal"
data
-
id
=
'[%= it[item]["id"] %]'
>
权限分配
<
/a
>
<
/td
>
<
/tr
>
...
...
@@ -21,4 +22,25 @@
<
td
colspan
=
"8"
style
=
"text-align:center;"
>
暂无数据
<
/td
>
<
/tr
>
[
%
}
%
]
</script>
\ No newline at end of file
</script>
<script
id=
"access_tpl"
type=
"text/template"
>
[
%
if
(
it
)
{
%
]
[
%
for
(
var
item
in
it
){
%
]
[
%
if
(
it
[
item
][
'pid'
]
!=
0
){
%
]
[
%
}
%
]
[
%
if
(
it
[
item
][
'is'
]
!=
0
){
%
]
<
label
class
=
"checkbox-inline"
>
<
input
type
=
"checkbox"
value
=
"[%= it[item]['id'] %]"
name
=
"rules"
checked
=
"checked"
>
[
%=
it
[
item
][
"title"
]
%
]
<
/label
>
[
%
}
else
{
%
]
<
label
class
=
"checkbox-inline"
>
<
input
type
=
"checkbox"
value
=
"[%= it[item]['id'] %]"
name
=
"rules"
>
[
%=
it
[
item
][
"title"
]
%
]
<
/label
>
[
%
}
%
]
[
%
}
%
]
[
%
}
%
]
</script>
\ No newline at end of file
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