Index: vue/dist/943.0d4a5fdf.js =================================================================== diff -u -r948ecdd327c6dd41fbca46865f9e8dde6345252a -rf25321cc7d88e50b497dabe16731eb739d4ff9e9 --- vue/dist/943.0d4a5fdf.js (.../943.0d4a5fdf.js) (revision 948ecdd327c6dd41fbca46865f9e8dde6345252a) +++ vue/dist/943.0d4a5fdf.js (.../943.0d4a5fdf.js) (revision f25321cc7d88e50b497dabe16731eb739d4ff9e9) @@ -2,7 +2,10 @@ setSideMenu("sidebar_menu_product", "sidebar_menu_product_regist"); jsTreeBuild("#demo"); //서비스 등록 - $(".btn-info").on("click", registNewServie); + $(".btn-info").on("click", function () { + var index = $("label.btn-sm.active").index() + index === 0 ? registNewServie() : updateServie() + }); }); // --- 에디터 설정 --- // @@ -131,8 +134,8 @@ } // Code for the menu buttons - function registNewServie () { - var refNum; +function registNewServie() { + var refNum; var checkedService = $("#demo").find("a.jstree-clicked").parent() checkedService.attr("rel") === "default" ? refNum = checkedService.parent().closest("li") : refNum = checkedService; var positionIndex = refNum.children().find("li").length; @@ -156,11 +159,39 @@ console.log("성공!") jsTreeBuild("#demo") }, - 400:function() {} + 400: function () {} } }) } +} + +function updateServie() { + var checkedService = $("#demo").find("a.jstree-clicked").parent(); + if (!$("#prepended-input").val() || $("#prepended-input").val().trim() === "") { + alert("Please write service name!"); + $("#prepended-input").focus(); + } else { + $.ajax({ + url: "http://localhost:9999/auth-user/api/arms/pdservice/alterNode.do", + type: "POST", + data: { + c_id: checkedService.attr("id").replace("node_", "").replace("copy_", ""), + c_title: $("#prepended-input").val(), + c_type: checkedService.attr("rel"), + }, + statusCode: { + 200: function () { + console.log("성공!") + jsTreeBuild("#demo") + }, + 400: function () {} + } + + }) + + } + } \ No newline at end of file