|
@@ -26,7 +26,6 @@ var getPath = function (nodeid) { |
|
@@ -26,7 +26,6 @@ var getPath = function (nodeid) { |
26
|
for (var i = 0; i < num; i++) {
|
26
|
for (var i = 0; i < num; i++) {
|
27
|
strPath += paths.pop() + "/";
|
27
|
strPath += paths.pop() + "/";
|
28
|
}
|
28
|
}
|
29
|
-
|
|
|
30
|
return strPath;
|
29
|
return strPath;
|
31
|
}
|
30
|
}
|
32
|
|
31
|
|
|
@@ -102,6 +101,10 @@ var addMObjType = function (nodeid, name) { |
|
@@ -102,6 +101,10 @@ var addMObjType = function (nodeid, name) { |
102
|
var doAddType = function () {
|
101
|
var doAddType = function () {
|
103
|
var pid = $('#tx_type_id').val();
|
102
|
var pid = $('#tx_type_id').val();
|
104
|
var name = $('#tx_new_type_name').val();
|
103
|
var name = $('#tx_new_type_name').val();
|
|
|
104
|
+ if(name==null||$('#tx_new_type_name').val()=="") {
|
|
|
105
|
+ $.toaster('输入类型名' + repjson.code, '提示', 'warning');
|
|
|
106
|
+ return;
|
|
|
107
|
+ }
|
105
|
var isleaf = $('#cb_new_type_isleaf').prop("checked") == true ? 1 : 0;
|
108
|
var isleaf = $('#cb_new_type_isleaf').prop("checked") == true ? 1 : 0;
|
106
|
$.get("type/add", {"pid": pid, "name": name, "isleaf": isleaf},
|
109
|
$.get("type/add", {"pid": pid, "name": name, "isleaf": isleaf},
|
107
|
function (data, state) {
|
110
|
function (data, state) {
|
|
@@ -123,6 +126,7 @@ var doAddType = function () { |
|
@@ -123,6 +126,7 @@ var doAddType = function () { |
123
|
).fail(function () {
|
126
|
).fail(function () {
|
124
|
$.toaster('添加失败:', '提示', 'warning');
|
127
|
$.toaster('添加失败:', '提示', 'warning');
|
125
|
});
|
128
|
});
|
|
|
129
|
+ $('#myModal').dialog('hide');
|
126
|
}
|
130
|
}
|
127
|
var doUpdateType = function () {
|
131
|
var doUpdateType = function () {
|
128
|
var id = $('#tx_type_id').val();
|
132
|
var id = $('#tx_type_id').val();
|
|
@@ -130,6 +134,7 @@ var doUpdateType = function () { |
|
@@ -130,6 +134,7 @@ var doUpdateType = function () { |
130
|
console.log("update " + id + " name " + name);
|
134
|
console.log("update " + id + " name " + name);
|
131
|
$.get("type/update", {"id": id, "name": name},
|
135
|
$.get("type/update", {"id": id, "name": name},
|
132
|
function (data, state) {
|
136
|
function (data, state) {
|
|
|
137
|
+ var repjson = JSON.parse(data);
|
133
|
if (state == "success" && repjson.code == 200) {
|
138
|
if (state == "success" && repjson.code == 200) {
|
134
|
$.toaster('更新成功', '更新', 'info');
|
139
|
$.toaster('更新成功', '更新', 'info');
|
135
|
$("#jstree").jstree('set_text', '#node_' + id, name);
|
140
|
$("#jstree").jstree('set_text', '#node_' + id, name);
|
|
@@ -139,12 +144,14 @@ var doUpdateType = function () { |
|
@@ -139,12 +144,14 @@ var doUpdateType = function () { |
139
|
).fail(function () {
|
144
|
).fail(function () {
|
140
|
$.toaster('更新失败:', '提示', 'warning');
|
145
|
$.toaster('更新失败:', '提示', 'warning');
|
141
|
});
|
146
|
});
|
|
|
147
|
+ $('#myModal').dialog('hide');
|
142
|
}
|
148
|
}
|
143
|
var doDelType = function () {
|
149
|
var doDelType = function () {
|
144
|
var id = $('#tx_type_id').val();
|
150
|
var id = $('#tx_type_id').val();
|
145
|
console.log("delete " + id);
|
151
|
console.log("delete " + id);
|
146
|
$.get("type/del", {"id": id},
|
152
|
$.get("type/del", {"id": id},
|
147
|
function (data, state) {
|
153
|
function (data, state) {
|
|
|
154
|
+ var repjson = JSON.parse(data);
|
148
|
if (state == "success" && repjson.code == 200) {
|
155
|
if (state == "success" && repjson.code == 200) {
|
149
|
$.toaster('删除成功', '删除', 'info');
|
156
|
$.toaster('删除成功', '删除', 'info');
|
150
|
$('#jstree').jstree("delete_node", $("#node_" + id));
|
157
|
$('#jstree').jstree("delete_node", $("#node_" + id));
|
|
@@ -154,6 +161,7 @@ var doDelType = function () { |
|
@@ -154,6 +161,7 @@ var doDelType = function () { |
154
|
).fail(function () {
|
161
|
).fail(function () {
|
155
|
$.toaster('删除失败:', '提示', 'warning');
|
162
|
$.toaster('删除失败:', '提示', 'warning');
|
156
|
});
|
163
|
});
|
|
|
164
|
+ $('#myModal').dialog('hide');
|
157
|
}
|
165
|
}
|
158
|
|
166
|
|
159
|
|
167
|
|
|
@@ -198,7 +206,7 @@ $("#btn4type").click(function () { |
|
@@ -198,7 +206,7 @@ $("#btn4type").click(function () { |
198
|
} else if ($("#tx_type_action").val() == "del") {
|
206
|
} else if ($("#tx_type_action").val() == "del") {
|
199
|
doDelType();
|
207
|
doDelType();
|
200
|
}
|
208
|
}
|
201
|
- $('#myModal').dialog('hide');
|
209
|
+
|
202
|
});
|
210
|
});
|
203
|
|
211
|
|
204
|
|
212
|
|