init
Showing
1 changed file
with
32 additions
and
0 deletions
| ... | @@ -162,6 +162,38 @@ | ... | @@ -162,6 +162,38 @@ |
| 162 | if (btn) btn.bind("click", function(){ | 162 | if (btn) btn.bind("click", function(){ |
| 163 | var zTree = $.fn.zTree.getZTreeObj("tree"); | 163 | var zTree = $.fn.zTree.getZTreeObj("tree"); |
| 164 | zTree.addNodes(treeNode, {id:(100 + newCount), pId:treeNode.id, name:"new node" + (newCount++)}); | 164 | zTree.addNodes(treeNode, {id:(100 + newCount), pId:treeNode.id, name:"new node" + (newCount++)}); |
| 165 | |||
| 166 | var data = { | ||
| 167 | name:'new node', | ||
| 168 | parentId:treeNode.id | ||
| 169 | } | ||
| 170 | var targetUrl1 = 'department/add'; | ||
| 171 | $.ajax({ | ||
| 172 | type: 'put', | ||
| 173 | url: apiBaseUrl + targetUrl1, | ||
| 174 | cache: false, | ||
| 175 | dataType: 'json', | ||
| 176 | data: JSON.stringify(data), | ||
| 177 | contentType: "application/json; charset=UTF-8", | ||
| 178 | success: function (data) { | ||
| 179 | if (data.msg) { | ||
| 180 | layer.alert(data.msg); | ||
| 181 | } else if (data.code != 0) { | ||
| 182 | layer.alert('操作失败'); | ||
| 183 | } else { | ||
| 184 | layer.msg('操作成功'); | ||
| 185 | } | ||
| 186 | setTimeout(function () { | ||
| 187 | if(!data.code) { | ||
| 188 | layer_close(); | ||
| 189 | } | ||
| 190 | },500); | ||
| 191 | }, | ||
| 192 | error: function () { | ||
| 193 | layer.alert("操作失败") | ||
| 194 | } | ||
| 195 | }) | ||
| 196 | |||
| 165 | return false; | 197 | return false; |
| 166 | }); | 198 | }); |
| 167 | }; | 199 | }; | ... | ... |
-
Please register or sign in to post a comment