Exemple #1
0
 /// <summary>
 /// 获取组织架构gojs框架数据
 /// </summary>
 /// <param name="pid"></param>
 /// <returns></returns>
 public JsonResult GetOrganizationGoJsData(int pid)
 {
     try
     {
         GoJSModel model = baseOrganizationBLL.GetOrganizationGoJsData(pid);
         return(Json(new { status = 0, msg = model }));
     }
     catch (Exception ex)
     {
         return(Json(new { status = 1, msg = ex.Message }));
     }
 }
 /// <summary>
 /// 根据parent_node获取gojs展示所需数据和关联关系
 /// </summary>
 /// <param name="pid"></param>
 /// <returns></returns>
 public GoJSModel GetOrganizationGoJsData(int pid)
 {
     try
     {
         ServOrganizationChartQuery query = new ServOrganizationChartQuery();
         //query.parent_node = pid.ToString();
         List <ServOrganizationChartModel> orgList = new List <ServOrganizationChartModel>();
         if (pid == -1)
         {
             orgList = servOrganizationChartDAL.GetOrganizationChar(query);
         }
         else
         {
             query.child_node = pid.ToString();
             orgList          = servOrganizationChartDAL.GetOrganizationCharByChildNode(query);
         }
         List <GoJSNodeDataCustom> nodeList = new List <GoJSNodeDataCustom>();
         List <GoJSLinkDataCustom> linkList = new List <GoJSLinkDataCustom>();
         for (int i = 0; i < orgList.Count; i++)
         {
             GoJSNodeDataCustom node = new GoJSNodeDataCustom();
             node.key  = orgList[i].child_node;
             node.name = orgList[i].content;
             GoJSLinkDataCustom link = new GoJSLinkDataCustom();
             link.from = orgList[i].parent_node;
             link.to   = orgList[i].child_node;
             nodeList.Add(node);
             linkList.Add(link);
         }
         //if (pid == -1)
         //{
         //    GoJSNodeDataCustom node1 = new GoJSNodeDataCustom();
         //    node1.key = "-1";
         //    node1.name = "组织架构";
         //    nodeList.Add(node1);
         //}
         GoJSModel goJSModel = new GoJSModel();
         goJSModel.nodeList = nodeList;
         goJSModel.linkList = linkList;
         return(goJSModel);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }