4ec0395e by yangjianbin

init

1 parent 4dafe548
......@@ -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));
}
......
......@@ -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: {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!