Authored by FengRuwei

bug fix

... ... @@ -64,10 +64,10 @@ public class TypeCtrl {
@ResponseBody
public String delType(@RequestParam int id) {
String rel = "";
logger.info("update type id {} ", id);
logger.info("del type id {} ", id);
rel = httpClient.defaultGet(HttpUriContants.TYPE_DEL+"/"+id,String.class);
logger.info("update type: {}", rel);
return "ok";
logger.info("del type: {}", rel);
return rel;
}
... ...
... ... @@ -26,7 +26,6 @@ var getPath = function (nodeid) {
for (var i = 0; i < num; i++) {
strPath += paths.pop() + "/";
}
return strPath;
}
... ... @@ -102,6 +101,10 @@ var addMObjType = function (nodeid, name) {
var doAddType = function () {
var pid = $('#tx_type_id').val();
var name = $('#tx_new_type_name').val();
if(name==null||$('#tx_new_type_name').val()=="") {
$.toaster('输入类型名' + repjson.code, '提示', 'warning');
return;
}
var isleaf = $('#cb_new_type_isleaf').prop("checked") == true ? 1 : 0;
$.get("type/add", {"pid": pid, "name": name, "isleaf": isleaf},
function (data, state) {
... ... @@ -123,6 +126,7 @@ var doAddType = function () {
).fail(function () {
$.toaster('添加失败:', '提示', 'warning');
});
$('#myModal').dialog('hide');
}
var doUpdateType = function () {
var id = $('#tx_type_id').val();
... ... @@ -130,6 +134,7 @@ var doUpdateType = function () {
console.log("update " + id + " name " + name);
$.get("type/update", {"id": id, "name": name},
function (data, state) {
var repjson = JSON.parse(data);
if (state == "success" && repjson.code == 200) {
$.toaster('更新成功', '更新', 'info');
$("#jstree").jstree('set_text', '#node_' + id, name);
... ... @@ -139,12 +144,14 @@ var doUpdateType = function () {
).fail(function () {
$.toaster('更新失败:', '提示', 'warning');
});
$('#myModal').dialog('hide');
}
var doDelType = function () {
var id = $('#tx_type_id').val();
console.log("delete " + id);
$.get("type/del", {"id": id},
function (data, state) {
var repjson = JSON.parse(data);
if (state == "success" && repjson.code == 200) {
$.toaster('删除成功', '删除', 'info');
$('#jstree').jstree("delete_node", $("#node_" + id));
... ... @@ -154,6 +161,7 @@ var doDelType = function () {
).fail(function () {
$.toaster('删除失败:', '提示', 'warning');
});
$('#myModal').dialog('hide');
}
... ... @@ -198,7 +206,7 @@ $("#btn4type").click(function () {
} else if ($("#tx_type_action").val() == "del") {
doDelType();
}
$('#myModal').dialog('hide');
});
... ...