Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
杨建斌
/
page
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
1
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
4ec0395e
authored
2018-04-01 23:24:49 +0800
by
yangjianbin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
init
1 parent
4dafe548
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
2 deletions
application/controllers/Perm.php
application/views/perm/roleEdit.php
application/controllers/Perm.php
View file @
4ec0395
...
...
@@ -176,8 +176,12 @@ class Perm extends CI_Controller {
$this
->
output
->
set_content_type
(
'application/json'
)
->
set_output
(
json_encode
(
$arr
));
}
public
function
menu
()
public
function
menu
(
$id
)
{
$role
=
json_decode
(
file_get_contents
(
$this
->
config
->
item
(
'apiBaseUrl'
)
.
'system/role/get/'
.
$id
));
$role
=
$role
->
data
->
menuOutputVOS
;
// echo $this->config->item('apiBaseUrl') . 'system/menu/getAllMenu';
$res
=
json_decode
(
file_get_contents
(
$this
->
config
->
item
(
'apiBaseUrl'
)
.
'system/menu/getAllMenuTree'
));
// var_dump($res->data);
...
...
@@ -279,6 +283,35 @@ class Perm extends CI_Controller {
// $data = '[{"id":1,"pId":0,"name":"父节点1 (5人)","open":true},{"id":11,"pId":1,"name":"叶子节点 1-1"},{"id":12,"pId":1,"name":"叶子节点 1-2"},{"id":13,"pId":1,"name":"叶子节点 1-3"},{"id":2,"pId":0,"name":"父节点 2","open":true},{"id":21,"pId":2,"name":"叶子节点 2-1"},{"id":22,"pId":2,"name":"叶子节点 2-2"},{"id":23,"pId":2,"name":"叶子节点 2-3"},{"id":3,"pId":0,"name":"父节点 3","open":true},{"id":31,"pId":3,"name":"叶子节点 3-1"},{"id":32,"pId":3,"name":"叶子节点 3-2"},{"id":33,"pId":3,"name":"叶子节点 3-3"}]';
// $data = json_decode($data, true);
$arr2
=
array
();
foreach
(
$role
as
$k
=>
$v
)
{
$r
=
array
();
$r
[
'id'
]
=
$v
->
id
;
$r
[
'name'
]
=
$v
->
name
;
$r
[
'pId'
]
=
0
;
$arr2
[]
=
$r
;
if
(
!
$v
->
children
||
empty
(
$v
->
children
))
{
continue
;
}
foreach
(
$v
->
children
as
$k2
=>
$v2
)
{
$r2
=
array
();
$r2
[
'id'
]
=
$v2
->
id
;
$r2
[
'name'
]
=
$v2
->
name
;
$r2
[
'pId'
]
=
$v
->
id
;
$arr
[]
=
$r2
;
}
}
foreach
(
$arr
as
$k
=>
$v
)
{
foreach
(
$arr2
as
$k2
=>
$v2
)
{
if
(
$v2
->
checked
==
true
){
$v
[
'checked'
]
=
true
;
break
;
}
}
}
$this
->
output
->
set_content_type
(
'application/json'
)
->
set_output
(
json_encode
(
$arr
));
}
...
...
application/views/perm/roleEdit.php
View file @
4ec0395
...
...
@@ -47,7 +47,7 @@
async: {
enable: true,
// url: '
<?
//=site_url('/perm/organization')?>//',
url
:
'<?=site_url('
/
perm
/
menu
')?>'
,
url
:
'<?=site_url('
/
perm
/
menu
'
.$id
)?>'
,
autoParam
:
[
"id"
]
},
check
:
{
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment