[Frontend][圖資管理] jsTree新增 node 程序調整
This commit is contained in:
parent
ff31936174
commit
909f528e11
@ -338,7 +338,7 @@
|
||||
treeEvent();
|
||||
let option = {
|
||||
core: {
|
||||
check_callback: true,
|
||||
"check_callback": true,
|
||||
data: data,
|
||||
themes: {
|
||||
name: "default-dark"
|
||||
@ -347,11 +347,11 @@
|
||||
types: {
|
||||
default: {
|
||||
max_depth: 3,
|
||||
valid_children: "default",
|
||||
/*valid_children: "default",*/
|
||||
icon: "fas fa-folder text-warning"
|
||||
},
|
||||
},
|
||||
plugins: ["themes", "contextmenu", "sort", "search", "types"],
|
||||
plugins: ["themes", "contextmenu", "sort", "conditionalselect", "search", "types"],
|
||||
|
||||
search: {
|
||||
case_insensitive: true,
|
||||
@ -368,12 +368,14 @@
|
||||
if (depth >= 3) {
|
||||
return true; //第五層後無法新增
|
||||
}
|
||||
return false;
|
||||
},
|
||||
action: function (obj) {
|
||||
$node = tree.create_node($node, { text: '新類別', type: 'default' });
|
||||
tree.deselect_all();
|
||||
tree.select_node($node);
|
||||
tree.edit($node);
|
||||
|
||||
}
|
||||
},
|
||||
Rename: {
|
||||
@ -404,7 +406,7 @@
|
||||
$('#graTree').jstree(true).select_node(topNode.children[0]);
|
||||
})
|
||||
$('#graTree').on("select_node.jstree", function (e, data) {
|
||||
dtAjaxResetSendData(graTable, { layer_id: parseInt(data.node.id)});
|
||||
dtAjaxResetSendData(graTable, { layer_id: parseInt(data.node.id) });
|
||||
graTable.ajax.reload();
|
||||
|
||||
let names = [];
|
||||
@ -429,9 +431,12 @@
|
||||
|
||||
ytAjax = new YourTeam.Ajax(baseApiUrl + "/GraphManage/SaveVar", objSendData, function (res) {
|
||||
if (!res || res.code != "0000") {
|
||||
|
||||
data.instance.delete_node(data.node);
|
||||
toast_error(res.msg || common.SysErr);
|
||||
} else {
|
||||
data.instance.set_id(data.node, res.data);
|
||||
|
||||
|
||||
}
|
||||
}, null, "POST").send();
|
||||
|
||||
@ -445,10 +450,10 @@
|
||||
objSendData.Data = main;
|
||||
ytAjax = new YourTeam.Ajax(baseApiUrl + "/GraphManage/EditVar", objSendData, function (res) {
|
||||
if (!res || res.code != "0000" || !res.data) {
|
||||
|
||||
toast_error(res.msg || common.SysErr);
|
||||
} else {
|
||||
getGraCatList((graCatData) => {
|
||||
data.settings.core.data = graCatData;
|
||||
data.instance.settings.core.data = graCatData;
|
||||
data.instance.refresh(true);
|
||||
})
|
||||
}
|
||||
@ -457,19 +462,20 @@
|
||||
});
|
||||
$("#graTree").on('delete_node.jstree', function (e, data) {
|
||||
let main = {};
|
||||
main.id = parseInt(data.node.id);
|
||||
objSendData.Data = main;
|
||||
ytAjax = new YourTeam.Ajax(baseApiUrl + "/GraphManage/DelVar", objSendData, function (res) {
|
||||
if (!res || res.code != "0000" || !res.data) {
|
||||
|
||||
} else {
|
||||
getGraCatList((graCatData) => {
|
||||
data.settings.core.data = graCatData;
|
||||
data.instance.refresh(true);
|
||||
})
|
||||
}
|
||||
}, null, "POST").send();
|
||||
|
||||
if (!isNaN(parseInt(data.node.id))) {
|
||||
main.id = parseInt(data.node.id);
|
||||
objSendData.Data = main;
|
||||
ytAjax = new YourTeam.Ajax(baseApiUrl + "/GraphManage/DelVar", objSendData, function (res) {
|
||||
if (!res || res.code != "0000" || !res.data) {
|
||||
toast_error(res.msg || common.SysErr);
|
||||
} else {
|
||||
getGraCatList((graCatData) => {
|
||||
data.settings.core.data = graCatData;
|
||||
data.instance.refresh(true);
|
||||
})
|
||||
}
|
||||
}, null, "POST").send();
|
||||
}
|
||||
});
|
||||
|
||||
onEvent("keyup", "#graCatSearch", function () {
|
||||
|
@ -79,13 +79,13 @@ namespace FrontendWebApi.ApiControllers
|
||||
try
|
||||
{
|
||||
Dictionary<string, object> variable = new Dictionary<string, object>();
|
||||
var system_value = backendRepository.GetOneAsync<string>("select system_priority from variable where system_type = @graph_manage_layer and deleted = 0 order by system_priority desc limit 1", new { @system_type = graph_manage_layer }).Result;
|
||||
var system_priority = backendRepository.GetOneAsync<string>("select system_priority from variable where system_type = @graph_manage_layer and deleted = 0 order by system_priority desc limit 1", new { graph_manage_layer = graph_manage_layer }).Result;
|
||||
variable.Add("@deleted", 0);
|
||||
variable.Add("@graph_manage_layer", graph_manage_layer);
|
||||
variable.Add("@system_type", graph_manage_layer);
|
||||
variable.Add("@system_key", gv.system_key);
|
||||
variable.Add("@system_parent_id", gv.system_parent_id);
|
||||
variable.Add("@system_remark", "圖資管理-" + gv.system_key);
|
||||
variable.Add("@system_priority", Int32.Parse(system_value) + 1);
|
||||
variable.Add("@system_priority", Int32.Parse(system_priority) + 1);
|
||||
|
||||
variable.Add("@created_by", myUser.userinfo_guid);
|
||||
variable.Add("@created_at", DateTime.Now);
|
||||
|
Loading…
Reference in New Issue
Block a user