function getobjArr  (data) {
var result = [];
data.HELMET.system = '系统分类'
// console.log(data)
$.each(data.HELMET, function (index_h, elem_h) {
var h = {
id: index_h,
name: elem_h,
Projects: []
}
$(data.sonProjects).each(function (index_p, elem_p) {
elem_p.AppCategorys = [];
if (elem_p.sysCategory == 1) {
if (index_h == 'system') {
h.Projects.push(elem_p);
}
} else {
if (index_h != 'system') {
$(data.sonProjectAppCategorys).each(function (index_c, elem_c) {
elem_c.childsList = [];
if (elem_c.childs == '0') {
if (elem_c.helmet == index_h && elem_c.spId == elem_p.spId && elem_c.pId == 0) {
elem_p.AppCategorys.push(elem_c); // console.log(elem_p.AppCategorys)
}
} else {
$(elem_c.childs.split(',')).each(function (index_ch, elem_ch) {
var parent = $$.getobj(data.sonProjectAppCategorys, 'spacId', elem_ch);
if (parent) {
parent.childsList = [];
if (parent.childs == '0') {
elem_c.childsList.push($.extend(true, {}, parent));
} else {
$(parent.childs.split(',')).each(function (index_cht, elem_cht) {
var child = $$.getobj(data.sonProjectAppCategorys, 'spacId', elem_cht);
parent.childsList.push($.extend(true, {}, child));
});
elem_c.childsList.push($.extend(true, {}, parent));
}
}
});
if (elem_c.helmet == index_h && elem_c.spId == elem_p.spId && elem_c.pId == 0) { elem_p.AppCategorys.push(elem_c); }
}
}) h.Projects.push(elem_p);
}
}
})
result.push($.extend(true, {}, h)); // 深复制
})
// console.log(result)
return result;
};

  

最新文章

  1. 【超级干货】手机移动端WEB资源整合
  2. jQuery.is() 函数
  3. 使用Navicat导入导出表的数据做测试(转载)
  4. 第一次Sprint总结
  5. [C语言](一)第一个Windows 32 API的窗口程序
  6. poj 2507Crossed ladders <计算几何>
  7. 《VC++ 6简明教程》即VC++ 6.0入门精讲 学习进度及笔记
  8. mybatis 学习笔记(4) —— 批量新增数据
  9. EMV/PBOC 解析(一) 卡片文件结构
  10. linux 内核的spinlock
  11. [LeetCode] 二叉树相关题目(不完全)
  12. Linux配置文件系统及程序的限制 - ulimit
  13. laravel 【error】MethodNotAllowedHttpException No message
  14. django url 反响解析,视图
  15. IVIEW TREE问题总结
  16. 如何实现从 Redis 中订阅消息转发到 WebSocket 客户端
  17. C# asp.net webapi下支持文件下载输出接口
  18. win7 任务计划运行批处理,不能正常运行,需用绝对路径
  19. idea中使用tomcat 方式启动spring boot项目
  20. mysql中参数--init-file的作用是什么呢?

热门文章

  1. ubuntu18.04虚拟机安装docker
  2. Eclipse 在高分辨率4K显示器下图标按钮过小
  3. Python开发爆破字典
  4. Kali学习笔记8:四层发现
  5. spring cloud config配置记录
  6. 树莓派连接不上WiFi
  7. SpringDataJPA与Mybatis的优异性
  8. TypeError: Cannot red property 'style' of null 错误解决
  9. spark最新源码下载并导入到开发环境下助推高质量代码(Scala IDEA for Eclipse和IntelliJ IDEA皆适用)(以spark2.2.0源码包为例)(图文详解)
  10. Selenuim自动化测试模型