Parcourir la Source

工单类型树 添加父节点文本

machenyang il y a 8 ans
Parent
commit
e2db4e5ed4

+ 27 - 5
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkTypeController.cs

@@ -97,11 +97,21 @@ namespace CallCenterApi.Interface.Controllers.workorder
97 97
             try
98 98
             {//set
99 99
                 T_RepositoryCategory = new BLL.T_RepositoryCategory().GetModel(Convert.ToInt32(id));
100
+                string pname = "";
101
+                if (!string.IsNullOrEmpty(pid) && pid != "0")
102
+                {
103
+                    var pmodel = new BLL.T_RepositoryCategory().GetModel(Convert.ToInt32(pid));
104
+                    if (pmodel != null)
105
+                    {
106
+                        pname = pmodel.F_CategoryName;
107
+                    }
108
+                }
100 109
                 var obj = new
101 110
                 {
102 111
                     catagoryname = name,
103 112
                     parentid = pid,
104
-                    sort = sort
113
+                    sort = sort,
114
+                    pname = pname
105 115
                 };
106 116
                 res = Success("获取成功", obj);
107 117
             }
@@ -118,14 +128,26 @@ namespace CallCenterApi.Interface.Controllers.workorder
118 128
         public ActionResult Save()
119 129
         {
120 130
             ActionResult res = NoToken("未知错误,请重新登录");
121
-            int bl = new BLL.T_RepositoryCategory().Add(T_RepositoryCategory);
122
-            if (bl > 0)
131
+            id = RequestString.GetFormString("id");
132
+            if (!string.IsNullOrEmpty(id))
123 133
             {
124
-                res = Success("新增成功", T_RepositoryCategory);
134
+                bool b = new BLL.T_RepositoryCategory().Update(T_RepositoryCategory);
135
+                if (b)
136
+                    res = Success("修改成功", T_RepositoryCategory);
137
+                else
138
+                    res = Success("修改失败");
125 139
             }
126 140
             else
127 141
             {
128
-                res = Error("新增失败");
142
+                int bl = new BLL.T_RepositoryCategory().Add(T_RepositoryCategory);
143
+                if (bl > 0)
144
+                {
145
+                    res = Success("新增成功", T_RepositoryCategory);
146
+                }
147
+                else
148
+                {
149
+                    res = Error("新增失败");
150
+                }
129 151
             }
130 152
             return res;
131 153
         }