zhupei 3 年 前
コミット
831f6f69ce

+ 3 - 2
RMYY_CallCenter_Api.Bll/T_Wowo_repairyqbll.cs

@@ -47,8 +47,9 @@ namespace RMYY_CallCenter_Api.Bll
47 47
         /// </summary>
48 48
         public List<T_Wowo_repairyq> GetListall()
49 49
         {
50
-            DataSet ds = dal.GetListall();
51
-            return DataTableToList(ds.Tables[0]);
50
+            //DataSet ds = dal.GetListall();
51
+            //return DataTableToList(ds.Tables[0]);
52
+            return dal.GetListall();
52 53
         }
53 54
         /// <summary>
54 55
         /// 分页获取数据列表

+ 1 - 1
RMYY_CallCenter_Api.Bll/T_Wowo_wocodetypebll.cs

@@ -51,7 +51,7 @@ namespace RMYY_CallCenter_Api.Bll
51 51
         /// <summary>
52 52
         /// 获取院区信息
53 53
         /// </summary>
54
-        public DataSet GetListall()
54
+        public List<RMYY_CallCenter_Api.Model.T_Wowo_wocodetype> GetListall()
55 55
         {
56 56
             return dal.GetListall();
57 57
         }

+ 23 - 2
RMYY_CallCenter_Api.Dal/T_Wowo_repairyqdal.cs

@@ -96,11 +96,12 @@ namespace RMYY_CallCenter_Api.Dal
96 96
         /// <summary>
97 97
         /// 获取院区信息
98 98
         /// </summary>
99
-        public DataSet GetListall()
99
+        public List<RMYY_CallCenter_Api.Model.T_Wowo_repairyq> GetListall()
100 100
         {
101 101
             StringBuilder strSql = new StringBuilder();
102 102
             strSql.Append("SELECT * FROM  T_Wowo_repairyq ");
103
-            return DbHelperSQL.Query(strSql.ToString());
103
+            DataSet ds= DbHelperSQL.Query(strSql.ToString());
104
+            return DataTableToList(ds.Tables[0]);
104 105
         }
105 106
         /// <summary>
106 107
         /// 分页获取
@@ -157,6 +158,26 @@ namespace RMYY_CallCenter_Api.Dal
157 158
                 return null;
158 159
             }
159 160
         }
161
+
162
+        public List<RMYY_CallCenter_Api.Model.T_Wowo_repairyq> DataTableToList(DataTable dt)
163
+        {
164
+            List<RMYY_CallCenter_Api.Model.T_Wowo_repairyq> modelList = new List<RMYY_CallCenter_Api.Model.T_Wowo_repairyq>();
165
+            int rowsCount = dt.Rows.Count;
166
+            if (rowsCount > 0)
167
+            {
168
+                RMYY_CallCenter_Api.Model.T_Wowo_repairyq model;
169
+                for (int n = 0; n < rowsCount; n++)
170
+                {
171
+                    model = DataRowToModel(dt.Rows[n]);
172
+                    if (model != null)
173
+                    {
174
+                        modelList.Add(model);
175
+                    }
176
+                }
177
+            }
178
+            return modelList;
179
+        }
180
+
160 181
         /// <summary>
161 182
         /// 得到一个对象实体
162 183
         /// </summary>

+ 24 - 2
RMYY_CallCenter_Api.Dal/T_Wowo_wocodetypedal.cs

@@ -93,11 +93,12 @@ namespace RMYY_CallCenter_Api.Dal
93 93
         /// <summary>
94 94
         /// 获取院区信息
95 95
         /// </summary>
96
-        public DataSet GetListall()
96
+        public List<RMYY_CallCenter_Api.Model.T_Wowo_wocodetype> GetListall()
97 97
         {
98 98
             StringBuilder strSql = new StringBuilder();
99 99
             strSql.Append("SELECT * FROM  T_Wowo_wocodetype ");
100
-            return DbHelperSQL.Query(strSql.ToString());
100
+            DataSet ds = DbHelperSQL.Query(strSql.ToString());
101
+            return DataTableToList(ds.Tables[0]);
101 102
         }
102 103
         /// <summary>
103 104
         /// 分页获取
@@ -154,6 +155,27 @@ namespace RMYY_CallCenter_Api.Dal
154 155
                 return null;
155 156
             }
156 157
         }
158
+
159
+
160
+        public List<RMYY_CallCenter_Api.Model.T_Wowo_wocodetype> DataTableToList(DataTable dt)
161
+        {
162
+            List<RMYY_CallCenter_Api.Model.T_Wowo_wocodetype> modelList = new List<RMYY_CallCenter_Api.Model.T_Wowo_wocodetype>();
163
+            int rowsCount = dt.Rows.Count;
164
+            if (rowsCount > 0)
165
+            {
166
+                RMYY_CallCenter_Api.Model.T_Wowo_wocodetype model;
167
+                for (int n = 0; n < rowsCount; n++)
168
+                {
169
+                    model = DataRowToModel(dt.Rows[n]);
170
+                    if (model != null)
171
+                    {
172
+                        modelList.Add(model);
173
+                    }
174
+                }
175
+            }
176
+            return modelList;
177
+        }
178
+
157 179
         /// <summary>
158 180
         /// 得到一个对象实体
159 181
         /// </summary>

+ 1 - 1
RMYY_CallCenter_Api.Utility/Tree/TreeModel.cs

@@ -42,7 +42,7 @@ namespace RMYY_CallCenter_Api.Utility
42 42
             get { return _text; }
43 43
         }
44 44
         /// <summary>
45
-        /// 工单级别类型
45
+        /// 工单级别类型  (部门类型  1 院区  2 部门)
46 46
         /// </summary>
47 47
         public int? TypeId { get; set; }
48 48
         private List<TreeModel> _children;

+ 39 - 23
RMYY_CallCenter_Api/Controllers/System/DepartmentController.cs

@@ -11,6 +11,7 @@ namespace RMYY_CallCenter_Api.Controllers.System
11 11
     public class DepartmentController : BaseController
12 12
     {
13 13
         private Bll.T_Sys_Department departmentBLL = new Bll.T_Sys_Department();
14
+        private Bll.T_Wowo_repairyqbll yqBll = new Bll.T_Wowo_repairyqbll();
14 15
 
15 16
         // GET: Department
16 17
         /// <summary>
@@ -61,45 +62,60 @@ namespace RMYY_CallCenter_Api.Controllers.System
61 62
         /// </summary>
62 63
         /// <returns></returns>
63 64
         [HttpGet]
64
-        public ActionResult GetTreeList()
65
+        public ActionResult GetTreeList(int hosid=0,int pid=0)
65 66
         {
67
+            var hoslist = yqBll.GetListall();
66 68
             var dptmodel = departmentBLL.GetModelList(" F_State=1");
67 69
             dptmodel.Sort((x, y) => x.F_Sort ?? 0 - y.F_Sort ?? 0);//排序
68 70
             var treeList = new List<TreeModel>();
69
-            foreach (var item in dptmodel.Where(p =>p.F_ParentId == 0).ToList())
71
+            if (hoslist.Count > 0)
70 72
             {
71
-                TreeModel treeModel = new TreeModel();
72
-                treeModel.id = item.F_DeptId.ToString();
73
-                treeModel.IconCls = "";
74
-                treeModel.text = item.F_DeptName;
75
-                treeModel.parentid = item.F_ParentId.ToString();
76
-                treeModel.children = TreeRecursion(dptmodel, item.F_DeptId.ToString());
77
-                treeList.Add(treeModel);
73
+                foreach (var hositem in hoslist)
74
+                {
75
+                    TreeModel treeModel = new TreeModel();
76
+                    treeModel.id = hositem.T_Woid.ToString();
77
+                    treeModel.IconCls = "";
78
+                    treeModel.text = hositem.T_Woname;
79
+                    treeModel.parentid = "-1";
80
+                    treeModel.TypeId = 1;
81
+                    treeModel.children = TreeRecursion(dptmodel, "0", hositem.T_Woid);
82
+                    treeList.Add(treeModel);
83
+                    //var dptlist = dptmodel.Where(p => p.F_ParentId == 0 && p.T_Woid == hositem.T_Woid).ToList();
84
+                }
78 85
             }
79 86
             //return Content(treeList.ToJson());
80 87
             return Success("获取菜单树成功", treeList);
81 88
         }
82 89
 
83
-        private List<TreeModel> TreeRecursion(List<Model.T_Sys_Department> data, string parentId = "0")
90
+        private List<TreeModel> TreeRecursion(List<Model.T_Sys_Department> data, string parentId = "0", int hosid = 0)
84 91
         {
92
+            List<Model.T_Sys_Department> item = null;
85 93
             List<TreeModel> newList = new List<TreeModel>();
86
-            if (parentId != "0")
94
+            //if (parentId != "0")
95
+            //{
96
+            if (hosid != 0)
97
+            {
98
+                item = data.FindAll(t => t.F_ParentId.ToString() == parentId && t.T_Woid == hosid);//data建议在调用此扩展方法前已经排序过
99
+            }
100
+            else
101
+            {
102
+                item = data.FindAll(t => t.F_ParentId.ToString() == parentId);//data建议在调用此扩展方法前已经排序过
103
+            }
104
+            if (item.Count > 0)
87 105
             {
88
-                List<Model.T_Sys_Department> item = data.FindAll(t => t.F_ParentId.ToString() == parentId);//data建议在调用此扩展方法前已经排序过
89
-                if (item.Count > 0)
106
+                foreach (Model.T_Sys_Department entity in item)
90 107
                 {
91
-                    foreach (Model.T_Sys_Department entity in item)
92
-                    {
93
-                        TreeModel treeModel = new TreeModel();
94
-                        treeModel.id = entity.F_DeptId.ToString();
95
-                        treeModel.IconCls = "";
96
-                        treeModel.text = entity.F_DeptName;
97
-                        treeModel.parentid = entity.F_ParentId.ToString();
98
-                        treeModel.children = TreeRecursion(item, entity.F_DeptId.ToString());
99
-                        newList.Add(treeModel);
100
-                    }
108
+                    TreeModel treeModel = new TreeModel();
109
+                    treeModel.id = entity.F_DeptId.ToString();
110
+                    treeModel.IconCls = "";
111
+                    treeModel.text = entity.F_DeptName;
112
+                    treeModel.parentid = entity.F_ParentId.ToString();
113
+                    treeModel.TypeId = 2;
114
+                    treeModel.children = TreeRecursion(item, entity.F_DeptId.ToString());
115
+                    newList.Add(treeModel);
101 116
                 }
102 117
             }
118
+            //}
103 119
             return newList;
104 120
         }
105 121