| | |
| | | form.on('submit(save)', function () { |
| | | var param = []; |
| | | var checkData = tree.getChecked('powerTree'); |
| | | if (!checkData || !Array.isArray(checkData)) { |
| | | layer.msg('没有选中的权限数据'); |
| | | return false; |
| | | } |
| | | checkData.map(function (obj) { |
| | | obj.children.map(function (resource) { |
| | | |
| | | var childrens = []; |
| | | resource.children.map(function (resource) { |
| | | childrens.push(resource.id); |
| | | // 检查 obj.children 是否存在且为数组 |
| | | if (obj.children && Array.isArray(obj.children)) { |
| | | obj.children.map(function (resource) { |
| | | var childrens = []; |
| | | // 检查 resource.children 是否存在且为数组 |
| | | if (resource.children && Array.isArray(resource.children)) { |
| | | resource.children.map(function (resource) { |
| | | childrens.push(resource.id); |
| | | }); |
| | | } |
| | | var one = { |
| | | 'two': resource.id, |
| | | 'three': childrens |
| | | }; |
| | | param.push(one); |
| | | }); |
| | | var one = { |
| | | 'two': resource.id, |
| | | 'three': childrens |
| | | }; |
| | | param.push(one); |
| | | }) |
| | | } |
| | | }); |
| | | $.ajax({ |
| | | url: baseUrl+"/power/auth", |