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
f5533905
authored
2018-03-29 11:43:59 +0800
by
wang
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
init
1 parent
cacfc363
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
99 additions
and
1 deletions
application/controllers/Perm.php
application/views/perm/roleEdit.php
application/controllers/Perm.php
View file @
f553390
...
...
@@ -152,4 +152,101 @@ class Perm extends CI_Controller {
$this
->
output
->
set_content_type
(
'application/json'
)
->
set_output
(
json_encode
(
$arr
));
}
public
function
menu
()
{
$res
=
json_decode
(
file_get_contents
(
$this
->
config
->
item
(
'apiBaseUrl'
)
.
'system/menu/getAllMenu'
));
$data
=
$res
->
data
;
$arr
=
array
();
foreach
(
$data
as
$k
=>
$v
)
{
$item
=
array
();
$item
[
'id'
]
=
$v
->
id
;
$item
[
'name'
]
=
$v
->
name
;
$item
[
'pId'
]
=
0
;
$item
[
'open'
]
=
true
;
if
(
!
$v
->
children
||
empty
(
$v
->
children
))
{
continue
;
}
$arr
[]
=
$item
;
foreach
(
$v
->
children
as
$kk
=>
$vv
)
{
$item2
=
array
();
$item2
[
'id'
]
=
$vv
->
id
;
$item2
[
'name'
]
=
$vv
->
name
;
$item2
[
'pId'
]
=
$v
->
id
;
$item2
[
'open'
]
=
true
;
$arr
[]
=
$item2
;
if
(
!
$vv
->
children
||
empty
(
$vv
->
children
))
{
continue
;
}
foreach
(
$vv
->
children
as
$kkk
=>
$vvv
)
{
$item3
=
array
();
$item3
[
'id'
]
=
$vvv
->
id
;
$item3
[
'name'
]
=
$vvv
->
name
;
$item3
[
'pId'
]
=
$vv
->
id
;
$item3
[
'open'
]
=
true
;
$arr
[]
=
$item3
;
if
(
!
$vvv
->
children
||
empty
(
$vvv
->
children
))
{
continue
;
}
foreach
(
$vvv
->
children
as
$kkkk
=>
$vvvv
)
{
$item4
=
array
();
$item4
[
'id'
]
=
$vvvv
->
id
;
$item4
[
'name'
]
=
$vvvv
->
name
;
$item4
[
'pId'
]
=
$vvv
->
id
;
$item4
[
'open'
]
=
true
;
$arr
[]
=
$item4
;
if
(
!
$vvvv
->
children
||
empty
(
$vvvv
->
children
))
{
continue
;
}
foreach
(
$vvvv
->
children
as
$kkkkk
=>
$vvvvv
)
{
$item5
=
array
();
$item5
[
'id'
]
=
$vvvvv
->
id
;
$item5
[
'name'
]
=
$vvvvv
->
name
;
$item5
[
'pId'
]
=
$vvvv
->
id
;
$item5
[
'open'
]
=
true
;
$arr
[]
=
$item5
;
if
(
!
$vvvvv
->
children
||
empty
(
$vvvvv
->
children
))
{
continue
;
}
foreach
(
$vvvvv
->
children
as
$kkkkkk
=>
$vvvvvv
)
{
$item6
=
array
();
$item6
[
'id'
]
=
$vvvvvv
->
id
;
$item6
[
'name'
]
=
$vvvvvv
->
name
;
$item6
[
'pId'
]
=
$vvvvv
->
id
;
$arr
[]
=
$item6
;
if
(
!
$vvvvvv
->
children
||
empty
(
$vvvvvv
->
children
))
{
continue
;
}
foreach
(
$vvvvvv
->
children
as
$k7
=>
$v7
)
{
$item7
=
array
();
$item7
[
'id'
]
=
$v7
->
id
;
$item7
[
'name'
]
=
$v7
->
name
;
$item7
[
'pId'
]
=
$vvvvvv
->
id
;
$arr
[]
=
$item7
;
if
(
!
$v7
->
children
||
empty
(
$v7
->
children
))
{
continue
;
}
foreach
(
$v7
->
children
as
$k8
=>
$v8
)
{
$item8
=
array
();
$item8
[
'id'
]
=
$v8
->
id
;
$item8
[
'name'
]
=
$v8
->
name
;
$item8
[
'pId'
]
=
$v7
->
id
;
$arr
[]
=
$item8
;
}
}
}
}
}
}
}
}
// $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);
$this
->
output
->
set_content_type
(
'application/json'
)
->
set_output
(
json_encode
(
$arr
));
}
}
...
...
application/views/perm/roleEdit.php
View file @
f553390
...
...
@@ -41,7 +41,8 @@
var setting = {
async: {
enable: true,
url: '
<?=
site_url
(
'/perm/organization'
)
?>
'
,
// url: '
<?
//=site_url('/perm/organization')?>//',
url
:
'<?=site_url('
/
perm
/
menu
')?>'
,
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