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;
};

  

js (jQuery)分组数据的更多相关文章

  1. js,jquery,css,html5特效

    包含js,jquery,css,html5特效,源代码 本文地址:http://www.cnblogs.com/roucheng/p/texiao.html 2017新年快乐特效 jQuery最新最全 ...

  2. Js/Jquery获取iframe中的元素

    转载: Js/Jquery获取iframe中的元素 - - ITeye技术网站http://java-my-life.iteye.com/blog/1275205 在web开发中,经常会用到ifram ...

  3. js/jquery/html前端开发常用到代码片段

    1.IE条件注释 条件注释简介 IE中的条件注释(Conditional comments)对IE的版本和IE非IE有优秀的区分能力,是WEB设计中常用的hack方法.条件注释只能用于IE5以上,IE ...

  4. js jquery 页面加载初始化方法

    js jquery 页面加载初始化方法 一.js页面加载初始化方法 // 1.在body里面写初始化方法. <body onload='init()'> </body> < ...

  5. js jquery 选择器总结

    js jquery 选择器总结 一.原始JS选择器. id选择器:document.getElementById("test"); name选择器:document.getElem ...

  6. [JS]jQuery,javascript获得网页的高度和宽度

    [JS]jQuery,javascript获得网页的高度和宽度网页可见区域宽: document.body.clientWidth 网页可见区域高: document.body.clientHeigh ...

  7. spring访问静态资源出错,No mapping found for HTTP request with URI xxx/resources/js/jquery.min.js...

    问题:spring访问静态资源出错,No mapping found for HTTP request with URI xxx/resources/js/jquery.min.js... web.x ...

  8. js jquery中 的数据类型

    任何一门语言, buguan 是动态的, 还是像C语言的, 都有严格的 类型 "概念的", 这个是由于 编译器和解释器要求的, 需要的. 所以在是使用像 js, jquey ,ph ...

  9. paip.提升效率--数据绑定到table原理和流程Angular js jquery实现

    paip.提升效率--数据绑定到table原理和流程Angular js  jquery实现 html #--keyword 1 #---原理和流程 1 #----jq实现的代码 1 #-----An ...

  10. JS Jquery去除数组重复元素

    js jquery去除数组中的重复元素 第一种:$.unique() 第二种: for(var i = 0,len = totalArray_line.length;i < len;i++) { ...

随机推荐

  1. 生成uuid唯一标识符

    generate_uuid: function(){ var d = new Date().getTime(); if(window.performance && typeof win ...

  2. JDK8 新增的日期时间API

    背景 JDK8中增加了一套全新的日期时间API,这里进行总结下,方便查询使用. 新的时间及日期API位于 java.time 包中,下面是一些关键类. Instant:代表的是时间戳. LocalDa ...

  3. 基于.NET框架的消息通信组件ZMQ资料汇编-总目录

    ZMQ是一个比较轻量级的消息通信组件,引用官方的说法: “ZMQ (以下 ZeroMQ 简称 ZMQ)是一个简单好用的传输层,像框架一样的一个 socket library,他使得 Socket 编程 ...

  4. python常用的十进制、16进制之间的转换

    一 整数之间的进制转换: hex(16) # 10进制转16进制 oct(8) # 10进制转8进制 bin(8) # 10进制转2进制 二 字符串转整数 int(') # 字符串转换成10进制整数 ...

  5. ubuntu16.04 uninstall cuda 9.0 completely and install 8.0 instead

    卸载cuda 9.0sudo apt-get --purge remove cudasudo apt autoremoveto remove cuda 9.0 Thensudo apt-get cle ...

  6. Java 程序员必备的 15 个框架,前 3 个地位无可动摇!

    Java 程序员方向太多,且不说移动开发.大数据.区块链.人工智能这些,大部分 Java 程序员都是 Java Web/后端开发.那作为一名 Java Web 开发程序员必须需要熟悉哪些框架呢? 今天 ...

  7. java开发之多线程基础篇

    首先我们先来了解下线程的生命周期上一张图: Java线程具有五中基本状态 新建状态(New):当线程对象对创建后,即进入了新建状态,如:Thread t = new MyThread(); 就绪状态( ...

  8. ASCII码字符串普通加密解密-android

    //android后台Java //ASCII加密 String str = e.getText().toString(); StringBuilder s = new StringBuilder() ...

  9. 古典音乐 (java基础 继承)

    摘要: 原创出处: http://www.cnblogs.com/Alandre/ 泥沙砖瓦浆木匠 希望转载,保留摘要,谢谢! 一.前言 小朽不才,最近爱上了听古典音乐收录了,mozart ,贝多芬… ...

  10. Centos创建ftp服务器

    整理的ftp服务的笔记: http://services.linuxpanda.tech/%E7%BD%91%E7%BB%9C%E6%96%87%E4%BB%B6%E5%85%B1%E4%BA%AB/ ...