|
|
@@ -18,9 +18,17 @@ namespace RMYY_CallCenter_Api.Controllers.System
|
|
18
|
18
|
/// <returns></returns>
|
|
19
|
19
|
public ActionResult GetList()
|
|
20
|
20
|
{
|
|
21
|
|
- var list = menuBLL.GetList(" F_State=1 ").Tables[0];
|
|
22
|
|
-
|
|
23
|
|
- return Success("", list);
|
|
|
21
|
+ List<Model.T_Sys_Menu> list =menuBLL.GetModelList(" F_State=1 and (F_Type=1 or F_Type=2) ");
|
|
|
22
|
+ List<Model.T_Sys_Menu> listitem = menuBLL.GetModelList(" F_ParentId in (select F_MenuId from T_Sys_Menu where F_Type=2 group by F_MenuId ) and F_State=1 ");
|
|
|
23
|
+ foreach (var item in list)
|
|
|
24
|
+ {
|
|
|
25
|
+ if (item.F_Type == 2)
|
|
|
26
|
+ {
|
|
|
27
|
+ item.button=listitem.Where(p => p.F_ParentId == item.F_MenuId).ToList();
|
|
|
28
|
+ }
|
|
|
29
|
+ }
|
|
|
30
|
+ list.Sort((x, y) => x.F_Sort ?? 0 - y.F_Sort ?? 0);
|
|
|
31
|
+ return Success("成功", list);
|
|
24
|
32
|
}
|
|
25
|
33
|
|
|
26
|
34
|
/// <summary>
|
|
|
@@ -30,11 +38,10 @@ namespace RMYY_CallCenter_Api.Controllers.System
|
|
30
|
38
|
[HttpGet]
|
|
31
|
39
|
public ActionResult GetTreeList()
|
|
32
|
40
|
{
|
|
33
|
|
- var ds_ModuleInfo = menuBLL.GetAllList();//DataSet
|
|
34
|
|
- List<Model.T_Sys_Menu> list_ModuleInfo = menuBLL.DataTableToList(ds_ModuleInfo.Tables[0]);
|
|
35
|
|
- list_ModuleInfo.Sort((x, y) => x.F_Sort??0 - y.F_Sort??0);//排序
|
|
|
41
|
+ var ds_ModuleInfo = menuBLL.GetModelList("F_Type = 1 or F_Type = 2");
|
|
|
42
|
+ ds_ModuleInfo.Sort((x, y) => x.F_Sort??0 - y.F_Sort??0);//排序
|
|
36
|
43
|
var treeList = new List<TreeModel>();
|
|
37
|
|
- foreach (var item in list_ModuleInfo)
|
|
|
44
|
+ foreach (var item in ds_ModuleInfo)
|
|
38
|
45
|
{
|
|
39
|
46
|
TreeModel treeModel = new TreeModel();
|
|
40
|
47
|
treeModel.id = item.F_MenuId.ToString();
|
|
|
@@ -47,6 +54,25 @@ namespace RMYY_CallCenter_Api.Controllers.System
|
|
47
|
54
|
return Success("获取菜单树成功", treeList.TreeRecursion("0"));
|
|
48
|
55
|
}
|
|
49
|
56
|
|
|
|
57
|
+ private List<Model.T_Sys_Menu> TreeRecursion(List<Model.T_Sys_Menu> data, string parentId = "0")
|
|
|
58
|
+ {
|
|
|
59
|
+ List<Model.T_Sys_Menu> newList = new List<Model.T_Sys_Menu>();
|
|
|
60
|
+ List<Model.T_Sys_Menu> item = data.FindAll(t => t.F_ParentId.ToString() == parentId);//data建议在调用此扩展方法前已经排序过
|
|
|
61
|
+ if (item.Count > 0)
|
|
|
62
|
+ {
|
|
|
63
|
+ foreach (Model.T_Sys_Menu entity in item)
|
|
|
64
|
+ {
|
|
|
65
|
+ if (entity.F_Type == 2 || entity.F_Type==1)
|
|
|
66
|
+ {
|
|
|
67
|
+ newList.Add(entity);
|
|
|
68
|
+ }
|
|
|
69
|
+
|
|
|
70
|
+ }
|
|
|
71
|
+ }
|
|
|
72
|
+
|
|
|
73
|
+ return newList;
|
|
|
74
|
+ }
|
|
|
75
|
+
|
|
50
|
76
|
/// <summary>
|
|
51
|
77
|
/// 获取信息
|
|
52
|
78
|
/// </summary>
|
|
|
@@ -82,7 +108,7 @@ namespace RMYY_CallCenter_Api.Controllers.System
|
|
82
|
108
|
/// <param name="sort"></param>
|
|
83
|
109
|
/// <returns></returns>
|
|
84
|
110
|
[HttpPost]
|
|
85
|
|
- public ActionResult Insert(int pid, string code, string name, int sort, int type, string url, string function,string icon)
|
|
|
111
|
+ public ActionResult Insert(int pid, string code, string name, int sort, int type, string url, string function,string icon,string remark, int state = 1)
|
|
86
|
112
|
{
|
|
87
|
113
|
if (menuBLL.Exists(code))
|
|
88
|
114
|
{
|
|
|
@@ -99,7 +125,8 @@ namespace RMYY_CallCenter_Api.Controllers.System
|
|
99
|
125
|
dModel.F_Url = url;
|
|
100
|
126
|
dModel.F_Action = function;
|
|
101
|
127
|
dModel.F_Icon = icon;
|
|
102
|
|
- dModel.F_State = 1;
|
|
|
128
|
+ dModel.F_State = state;
|
|
|
129
|
+ dModel.F_Remark = remark;
|
|
103
|
130
|
dModel.F_CreateTime = DateTime.Now;
|
|
104
|
131
|
dModel.F_CreateUser = User.F_UserCode;
|
|
105
|
132
|
|
|
|
@@ -124,7 +151,7 @@ namespace RMYY_CallCenter_Api.Controllers.System
|
|
124
|
151
|
/// <param name="sort"></param>
|
|
125
|
152
|
/// <returns></returns>
|
|
126
|
153
|
[HttpPost]
|
|
127
|
|
- public ActionResult Update(int id, int pid, string code, string name, int sort, int type, string url, string function, string icon)
|
|
|
154
|
+ public ActionResult Update(int id, int pid, string code, string name, int sort, int type, string url, string function, string icon,string remark,int state=1)
|
|
128
|
155
|
{
|
|
129
|
156
|
Model.T_Sys_Menu dModel = menuBLL.GetModel(id);
|
|
130
|
157
|
if (dModel != null)
|
|
|
@@ -144,7 +171,8 @@ namespace RMYY_CallCenter_Api.Controllers.System
|
|
144
|
171
|
dModel.F_Url = url;
|
|
145
|
172
|
dModel.F_Action = function;
|
|
146
|
173
|
dModel.F_Icon = icon;
|
|
147
|
|
- dModel.F_State = 1;
|
|
|
174
|
+ dModel.F_State = state;
|
|
|
175
|
+ dModel.F_Remark = remark;
|
|
148
|
176
|
|
|
149
|
177
|
if (menuBLL.Update(dModel))
|
|
150
|
178
|
{
|