f5533905 by wang

init

1 parent cacfc363
...@@ -152,4 +152,101 @@ class Perm extends CI_Controller { ...@@ -152,4 +152,101 @@ class Perm extends CI_Controller {
152 152
153 $this->output->set_content_type('application/json')->set_output(json_encode($arr)); 153 $this->output->set_content_type('application/json')->set_output(json_encode($arr));
154 } 154 }
155
156 public function menu()
157 {
158 $res = json_decode(file_get_contents($this->config->item('apiBaseUrl') . 'system/menu/getAllMenu'));
159 $data = $res->data;
160 $arr = array();
161 foreach ($data as $k => $v) {
162 $item = array();
163 $item['id'] = $v->id;
164 $item['name'] = $v->name;
165 $item['pId'] = 0;
166 $item['open'] = true;
167 if (!$v->children || empty($v->children)) {
168 continue;
169 }
170 $arr[] = $item;
171 foreach ($v->children as $kk => $vv) {
172 $item2 = array();
173 $item2['id'] = $vv->id;
174 $item2['name'] = $vv->name;
175 $item2['pId'] = $v->id;
176 $item2['open'] = true;
177 $arr[] = $item2;
178 if (!$vv->children || empty($vv->children)) {
179 continue;
180 }
181 foreach ($vv->children as $kkk => $vvv) {
182 $item3 = array();
183 $item3['id'] = $vvv->id;
184 $item3['name'] = $vvv->name;
185 $item3['pId'] = $vv->id;
186 $item3['open'] = true;
187 $arr[] = $item3;
188
189 if (!$vvv->children || empty($vvv->children)) {
190 continue;
191 }
192 foreach ($vvv->children as $kkkk => $vvvv) {
193 $item4 = array();
194 $item4['id'] = $vvvv->id;
195 $item4['name'] = $vvvv->name;
196 $item4['pId'] = $vvv->id;
197 $item4['open'] = true;
198 $arr[] = $item4;
199 if (!$vvvv->children || empty($vvvv->children)) {
200 continue;
201 }
202 foreach ($vvvv->children as $kkkkk => $vvvvv) {
203 $item5 = array();
204 $item5['id'] = $vvvvv->id;
205 $item5['name'] = $vvvvv->name;
206 $item5['pId'] = $vvvv->id;
207 $item5['open'] = true;
208 $arr[] = $item5;
209 if (!$vvvvv->children || empty($vvvvv->children)) {
210 continue;
211 }
212 foreach ($vvvvv->children as $kkkkkk => $vvvvvv) {
213 $item6 = array();
214 $item6['id'] = $vvvvvv->id;
215 $item6['name'] = $vvvvvv->name;
216 $item6['pId'] = $vvvvv->id;
217 $arr[] = $item6;
218 if (!$vvvvvv->children || empty($vvvvvv->children)) {
219 continue;
220 }
221 foreach ($vvvvvv->children as $k7 => $v7) {
222 $item7 = array();
223 $item7['id'] = $v7->id;
224 $item7['name'] = $v7->name;
225 $item7['pId'] = $vvvvvv->id;
226 $arr[] = $item7;
227 if (!$v7->children || empty($v7->children)) {
228 continue;
229 }
230 foreach ($v7->children as $k8 => $v8) {
231 $item8 = array();
232 $item8['id'] = $v8->id;
233 $item8['name'] = $v8->name;
234 $item8['pId'] = $v7->id;
235 $arr[] = $item8;
236 }
237 }
238 }
239
240 }
241 }
242 }
243 }
244
245 }
246 // $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"}]';
247 // $data = json_decode($data, true);
248
249 $this->output->set_content_type('application/json')->set_output(json_encode($arr));
250 }
251
155 } 252 }
......
...@@ -41,7 +41,8 @@ ...@@ -41,7 +41,8 @@
41 var setting = { 41 var setting = {
42 async: { 42 async: {
43 enable: true, 43 enable: true,
44 url: '<?=site_url('/perm/organization')?>', 44 // url: '<?//=site_url('/perm/organization')?>//',
45 url: '<?=site_url('/perm/menu')?>',
45 autoParam:["id"] 46 autoParam:["id"]
46 }, 47 },
47 check: { 48 check: {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!