var step = 0; var gwf; $(function () { var workid = GetQueryString("WorkID"); var handler = new HttpHandler("BP.WF.HttpHandler.WF_WorkOpt_OneWork"); handler.AddPara("WorkID", workid); var ds = handler.DoMethodReturnJSON("JobSchedule_Init"); gwf= ds["WF_GenerWorkFlow"][0]; //工作记录. var tempNodes = ds["WF_Node"]; //节点. var tempDirs = ds["WF_Direction"]; //连接线. var tracks = ds["Track"]; //历史记录. var transf = ds["WF_TransferCustom"];//游离态的节点 var nodes = {}; for (var i = 0; i < tempNodes.length; i++) { var nodeID = tempNodes[i].NodeID; if (!$.isArray(nodes[nodeID])) { nodes[nodeID] = []; } nodes[nodeID].push(tempNodes[i]); } var dirs = {}; //每个节点的连线 for (var i = 0; i < tempNodes.length; i++) { var nodeDir = []; var nodeID = tempNodes[i].NodeID; for (var k = 0; k < tempDirs.length; k++) { if (tempDirs[k].Node == nodeID) nodeDir.push({ ToNodeID: tempDirs[k].ToNode }); else continue; } if (nodeDir.length == 0) continue; if (!$.isArray(dirs[nodeID])) { dirs[nodeID] = []; } dirs[nodeID].push(nodeDir); } var step = 0; //获取走过的节点, 生成唯一的节点连续字符串比如 101,102,103 var nds = ""; for (var i = 0; i < tracks.length; i++) { var tk = tracks[i]; if (nds.indexOf(tk.FK_Node) != -1) continue; nds += "," + tk.FK_Node; } //把节点转化为数组. var nds = nds.split(","); for (var i = 0; i < nds.length; i++) { var nodeID = nds[i]; if (nodeID == "") continue; var currTrack = getTracksByNodeID(tracks,nodeID); if (currTrack.length != 0) {//$(".DashbCon") $("#JobSchedule").append('
'+ (currTrack[0].EmpName == null?'':currTrack[0].EmpName == 0?'':currTrack[0].EmpName)+'
'+ (currTrack[0].SDT == null?'':currTrack[0].SDT == 0?'':currTrack[0].SDT) +'