|
|
@@ -438,7 +438,7 @@ namespace YTSoft.BaseCallCenter.DAL
|
|
438
|
438
|
{
|
|
439
|
439
|
List<TreeNodeModel> modelList = new List<TreeNodeModel>();
|
|
440
|
440
|
model.id = 0;
|
|
441
|
|
- model.name = "部门列表";
|
|
|
441
|
+ model.name = "郑州地铁";
|
|
442
|
442
|
model.code = 0;
|
|
443
|
443
|
model.iconClose = "../../Content/layui/zTree/v3/css/zTreeStyle/img/diy/1_close.png";
|
|
444
|
444
|
model.iconOpen = "../../Content/layui/zTree/v3/css/zTreeStyle/img/diy/1_open.png";
|
|
|
@@ -513,18 +513,39 @@ namespace YTSoft.BaseCallCenter.DAL
|
|
513
|
513
|
}
|
|
514
|
514
|
|
|
515
|
515
|
|
|
516
|
|
-
|
|
517
|
516
|
/// <summary>
|
|
518
|
517
|
/// 获得当前节点下的所有子集以tree的格式
|
|
519
|
518
|
/// </summary>
|
|
520
|
|
- public TreeNodeModel GetDepartmentJsonModeldic(int parentId, bool AddUser = false)
|
|
|
519
|
+ public TreeNodeModel GetDepartmentJsonModelTurn(int parentId, string key = "")
|
|
521
|
520
|
{
|
|
522
|
521
|
TreeNodeModel returnModel = new TreeNodeModel();
|
|
523
|
522
|
StringBuilder strSql = new StringBuilder();
|
|
524
|
|
- strSql.Append("select * ");
|
|
525
|
|
- strSql.Append(" FROM T_Sys_Department order by F_Sort asc");
|
|
|
523
|
+ strSql.Append("SELECT * FROM T_Sys_Department ");
|
|
|
524
|
+ if (!string.IsNullOrEmpty(key))
|
|
|
525
|
+ {
|
|
|
526
|
+ strSql.AppendFormat("WHERE (F_DeptName LIKE '%{0}%' OR F_DeptId IN(SELECT F_DeptId FROM dbo.T_Sys_UserAccount WHERE F_UserName LIKE '%{0}%'))", key);
|
|
|
527
|
+ }
|
|
|
528
|
+ strSql.Append(" order by F_Sort asc");
|
|
526
|
529
|
|
|
527
|
530
|
DataSet ds = DbHelperSQL.Query(strSql.ToString());
|
|
|
531
|
+ if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0&& !string.IsNullOrEmpty(key))
|
|
|
532
|
+ {
|
|
|
533
|
+
|
|
|
534
|
+ string strlist = "0";
|
|
|
535
|
+ foreach (DataRow row in ds.Tables[0].Rows)
|
|
|
536
|
+ {
|
|
|
537
|
+ strlist += ",";
|
|
|
538
|
+ strlist += row["F_DeptId"];
|
|
|
539
|
+ strlist += ",";
|
|
|
540
|
+ strlist += row["F_ParentId"];
|
|
|
541
|
+ }
|
|
|
542
|
+ strSql.Clear();
|
|
|
543
|
+ strSql.Append("SELECT * FROM T_Sys_Department ");
|
|
|
544
|
+ strSql.AppendFormat("WHERE F_DeptId IN({0})", strlist);
|
|
|
545
|
+
|
|
|
546
|
+ strSql.Append(" order by F_Sort asc");
|
|
|
547
|
+ ds = DbHelperSQL.Query(strSql.ToString());
|
|
|
548
|
+ }
|
|
528
|
549
|
|
|
529
|
550
|
if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
|
|
530
|
551
|
{
|
|
|
@@ -533,14 +554,14 @@ namespace YTSoft.BaseCallCenter.DAL
|
|
533
|
554
|
{
|
|
534
|
555
|
List<TreeNodeModel> modelList = new List<TreeNodeModel>();
|
|
535
|
556
|
model.id = 0;
|
|
536
|
|
- model.name = "常用人员";
|
|
|
557
|
+ model.name = "郑州地铁";
|
|
537
|
558
|
model.code = 0;
|
|
538
|
559
|
model.iconClose = "../../Content/layui/zTree/v3/css/zTreeStyle/img/diy/1_close.png";
|
|
539
|
560
|
model.iconOpen = "../../Content/layui/zTree/v3/css/zTreeStyle/img/diy/1_open.png";
|
|
540
|
561
|
model.open = "true";
|
|
541
|
562
|
model.children = modelList;
|
|
542
|
563
|
}
|
|
543
|
|
- returnModel = GetTreeModel(ds.Tables[0], model, AddUser);
|
|
|
564
|
+ returnModel = GetTreeModelTurnDept(ds.Tables[0], model, key);
|
|
544
|
565
|
|
|
545
|
566
|
}
|
|
546
|
567
|
return returnModel;
|
|
|
@@ -553,7 +574,7 @@ namespace YTSoft.BaseCallCenter.DAL
|
|
553
|
574
|
/// <param name="table">数据结合</param>
|
|
554
|
575
|
/// <param name="model">当前model</param>
|
|
555
|
576
|
/// <returns></returns>
|
|
556
|
|
- public TreeNodeModel GetTreeModeldic(DataTable table, TreeNodeModel model, bool AddUser)
|
|
|
577
|
+ public TreeNodeModel GetTreeModelTurnDept(DataTable table, TreeNodeModel model, string key = "")
|
|
557
|
578
|
{
|
|
558
|
579
|
DataRow[] rows = table.Select("F_ParentId=" + model.code);
|
|
559
|
580
|
if (rows != null && rows.Length > 0)
|
|
|
@@ -565,17 +586,25 @@ namespace YTSoft.BaseCallCenter.DAL
|
|
565
|
586
|
childModel.id = int.Parse(row["F_DeptId"].ToString());
|
|
566
|
587
|
childModel.name = row["F_DeptName"].ToString();
|
|
567
|
588
|
childModel.code = int.Parse(row["F_DeptId"].ToString());
|
|
568
|
|
- childModel.iconClose = "../../Content/layui/zTree/v3/css/zTreeStyle/img/diy/1_close.png";
|
|
569
|
|
- childModel.iconOpen = "../../Content/layui/zTree/v3/css/zTreeStyle/img/diy/1_open.png";
|
|
|
589
|
+ if (model.code==0)
|
|
|
590
|
+ {
|
|
|
591
|
+ childModel.iconClose = "../../Content/layui/zTree/v3/css/zTreeStyle/img/diy/1_close.png";
|
|
|
592
|
+ childModel.iconOpen = "../../Content/layui/zTree/v3/css/zTreeStyle/img/diy/1_open.png";
|
|
|
593
|
+ }
|
|
|
594
|
+ else
|
|
|
595
|
+ {
|
|
|
596
|
+ childModel.iconClose = "../../Content/layui/zTree/v3/css/zTreeStyle/img/diy/2_close.png";
|
|
|
597
|
+ childModel.iconOpen = "../../Content/layui/zTree/v3/css/zTreeStyle/img/diy/2_close.png";
|
|
|
598
|
+ }
|
|
570
|
599
|
//childModel.iconClose = row["F_Header"].ToMyString();
|
|
571
|
600
|
//childModel.iconOpen = childModel.iconClose + ".png";
|
|
572
|
601
|
childModel.open = "true";
|
|
573
|
602
|
childModel.children = modelList;
|
|
574
|
603
|
model.children.Add(childModel);
|
|
575
|
|
- GetTreeModel(table, childModel, AddUser);
|
|
|
604
|
+ GetTreeModelTurnDept(table, childModel, key);
|
|
576
|
605
|
}
|
|
577
|
606
|
}
|
|
578
|
|
- else if (AddUser)
|
|
|
607
|
+ else if (model.name.Contains(key) || string.IsNullOrEmpty(key))
|
|
579
|
608
|
{
|
|
580
|
609
|
StringBuilder strSql = new StringBuilder();
|
|
581
|
610
|
strSql.Append("select * ");
|
|
|
@@ -603,6 +632,34 @@ namespace YTSoft.BaseCallCenter.DAL
|
|
603
|
632
|
|
|
604
|
633
|
}
|
|
605
|
634
|
}
|
|
|
635
|
+ else
|
|
|
636
|
+ {
|
|
|
637
|
+ StringBuilder strSql = new StringBuilder();
|
|
|
638
|
+ strSql.Append("select * ");
|
|
|
639
|
+ strSql.AppendFormat(" FROM T_Sys_UserAccount where F_DeptId={0} AND F_UserName LIKE '%{1}%'", model.code,key);
|
|
|
640
|
+
|
|
|
641
|
+ DataSet ds = DbHelperSQL.Query(strSql.ToString());
|
|
|
642
|
+
|
|
|
643
|
+ if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
|
|
|
644
|
+ {
|
|
|
645
|
+
|
|
|
646
|
+ foreach (DataRow row in ds.Tables[0].Rows)
|
|
|
647
|
+ {
|
|
|
648
|
+ List<TreeNodeModel> modelList = new List<TreeNodeModel>();
|
|
|
649
|
+ TreeNodeModel childModel = new TreeNodeModel();
|
|
|
650
|
+ childModel.id = int.Parse(row["F_UserId"].ToString());
|
|
|
651
|
+ childModel.name = row["F_UserName"].ToString();
|
|
|
652
|
+ childModel.code = int.Parse(row["F_UserId"].ToString());
|
|
|
653
|
+ childModel.iconClose = "../../Content/layui/zTree/v3/css/zTreeStyle/img/diy/1_close.png";
|
|
|
654
|
+ childModel.iconOpen = "../../Content/layui/zTree/v3/css/zTreeStyle/img/diy/1_open.png";
|
|
|
655
|
+ childModel.open = "false";
|
|
|
656
|
+ childModel.IsOrPrivate = 1;
|
|
|
657
|
+ childModel.children = modelList;
|
|
|
658
|
+ model.children.Add(childModel);
|
|
|
659
|
+ }
|
|
|
660
|
+
|
|
|
661
|
+ }
|
|
|
662
|
+ }
|
|
606
|
663
|
return model;
|
|
607
|
664
|
|
|
608
|
665
|
}
|