...
|
...
|
@@ -102,13 +102,18 @@ var addMObjType = function (nodeid, name) { |
|
|
var doAddType = function () {
|
|
|
var pid = $('#tx_type_id').val();
|
|
|
var name = $('#tx_new_type_name').val();
|
|
|
var isleaf = 1;
|
|
|
var isleaf = $('#cb_new_type_isleaf').prop("checked") == true ? 1 : 0;
|
|
|
$.get("type/add", {"pid": pid, "name": name, "isleaf": isleaf},
|
|
|
function (data, state) {
|
|
|
$.toaster('添加成功', '添加', 'info');
|
|
|
refreshTypeTree();
|
|
|
if (state == "success" && data.code == 200) {
|
|
|
$.toaster('添加成功', '提示', 'info');
|
|
|
refreshTypeTree();
|
|
|
} else
|
|
|
$.toaster('添加失败' + data.code, '提示', 'warning');
|
|
|
}
|
|
|
);
|
|
|
).fail(function () {
|
|
|
$.toaster('添加失败:', '提示', 'warning');
|
|
|
});
|
|
|
}
|
|
|
var doUpdateType = function () {
|
|
|
var id = $('#tx_type_id').val();
|
...
|
...
|
@@ -119,7 +124,9 @@ var doUpdateType = function () { |
|
|
$.toaster('更新成功', '更新', 'info');
|
|
|
refreshTypeTree();
|
|
|
}
|
|
|
);
|
|
|
).fail(function () {
|
|
|
$.toaster('更新失败:', '提示', 'warning');
|
|
|
});;
|
|
|
}
|
|
|
var doDelType = function () {
|
|
|
var id = $('#tx_type_id').val();
|
...
|
...
|
@@ -128,7 +135,9 @@ var doDelType = function () { |
|
|
function (data, state) {
|
|
|
$('#jstree').jstree("delete_node", $("#" + id));
|
|
|
}
|
|
|
);
|
|
|
).fail(function () {
|
|
|
$.toaster('删除失败:', '提示', 'warning');
|
|
|
});;
|
|
|
}
|
|
|
|
|
|
|
...
|
...
|
@@ -216,9 +225,11 @@ $(function () { |
|
|
"action": function (obj) {
|
|
|
var inst = jQuery.jstree.reference(obj.reference);
|
|
|
var clickedNode = inst.get_node(obj.reference);
|
|
|
console.log(obj);
|
|
|
console.log(clickedNode);
|
|
|
console.log("add operation--clickedNode's id is:" + clickedNode.id);
|
|
|
console.log("add operation--clickedNode's id is:" + clickedNode.id + " " + clickedNode);
|
|
|
if (clickedNode.data != 0) {
|
|
|
$.toaster('叶子节点无法添加子类型', '提示', 'info');
|
|
|
return;
|
|
|
}
|
|
|
addType(clickedNode);
|
|
|
}
|
|
|
}, "UPDATE": {
|
...
|
...
|
@@ -234,6 +245,10 @@ $(function () { |
|
|
var inst = jQuery.jstree.reference(obj.reference);
|
|
|
var clickedNode = inst.get_node(obj.reference);
|
|
|
console.log("del operation--clickedNode's id is:" + clickedNode.id);
|
|
|
if (clickedNode.chindlen.size() > 0) {
|
|
|
$.toaster('无法直接删除还有子类型的节点', '提示', 'info');
|
|
|
return;
|
|
|
}
|
|
|
delType(clickedNode.id);
|
|
|
}
|
|
|
}, "ADDM": {
|
...
|
...
|
@@ -242,6 +257,10 @@ $(function () { |
|
|
var inst = jQuery.jstree.reference(obj.reference);
|
|
|
var clickedNode = inst.get_node(obj.reference);
|
|
|
console.log("add minfo--clickedNode's id is : " + clickedNode.id);
|
|
|
if (clickedNode.data != 1) {
|
|
|
$.toaster('非叶子节点无法添加子类型', '提示', 'info');
|
|
|
return;
|
|
|
}
|
|
|
addMObjType(clickedNode.id, clickedNode.text);
|
|
|
}
|
|
|
}
|
...
|
...
|
|