Przeglądaj źródła

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

machenyang 8 lat temu
rodzic
commit
e2db4e5ed4

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

97
             try
97
             try
98
             {//set
98
             {//set
99
                 T_RepositoryCategory = new BLL.T_RepositoryCategory().GetModel(Convert.ToInt32(id));
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
                 var obj = new
109
                 var obj = new
101
                 {
110
                 {
102
                     catagoryname = name,
111
                     catagoryname = name,
103
                     parentid = pid,
112
                     parentid = pid,
104
-                    sort = sort
113
+                    sort = sort,
114
+                    pname = pname
105
                 };
115
                 };
106
                 res = Success("获取成功", obj);
116
                 res = Success("获取成功", obj);
107
             }
117
             }
118
         public ActionResult Save()
128
         public ActionResult Save()
119
         {
129
         {
120
             ActionResult res = NoToken("未知错误,请重新登录");
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
             else
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
             return res;
152
             return res;
131
         }
153
         }