Skip to content

Instantly share code, notes, and snippets.

@xx7y7xx
Created Oct 22, 2016
Embed
What would you like to do?
parse从NC百分百上dump的数据
//res = {};
var item, area, project, chuchai,
areaname, projectname,
ret = {};
for ( i in res.data ) {
item = res.data[i];
areaname = item.areaname;
projectname = item.projectname;
if (!ret[areaname]) ret[areaname] = {}; // 创建深圳节点
area = ret[areaname];
if (!area[projectname]) area[projectname] = {}; // 创建项目节点
project = area[projectname];
project["领域"] = item.field;
if (!project["出差人员"]) project["出差人员"] = {}; // 创建出差人员节点
chuchai = project["出差人员"];
chuchai[item.creatorname] = item;
chuchai[item.solvername] = item;
}
//目标数据
/*
{
"深圳": {
"观澜湖(房地产)": {
"领域": "房地产",
"出差人员": {
"马培": {...}
}
}
}
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment