This commit is contained in:
dev02 2022-12-14 11:57:45 +08:00
commit 3bb318e5f1
4 changed files with 42 additions and 26 deletions

View File

@ -188,7 +188,7 @@
{ {
"title": "功能", "title": "功能",
"data": "userinfo_guid", "data": "id",
"render": function (data, type, row, meta) { "render": function (data, type, row, meta) {
let btnDiv = creDiv(["row", "m-0", "justify-content-center"], { "style": "gap:10px" }); let btnDiv = creDiv(["row", "m-0", "justify-content-center"], { "style": "gap:10px" });
btnDiv.append(creBtnHtml("修改", "graEdiBtn" + data, null, ["btn", "btn-info"])); btnDiv.append(creBtnHtml("修改", "graEdiBtn" + data, null, ["btn", "btn-info"]));
@ -266,6 +266,11 @@
}); });
}); });
onEvent("click", "button[id^=graEdiBtn]", function () {
let id = $(this).prop("id").split("graEdiBtn")[1];
readGraph(id);
})
// 上傳檔案 // 上傳檔案
var oriImg; var oriImg;
$("#upMyDesignDiagram").on("change", function (e) { $("#upMyDesignDiagram").on("change", function (e) {
@ -281,9 +286,7 @@
fileHelper.readAndPreviewImages(this.files, 'upForAsBuilt', 0, 86, '<div class="file-item">', '<button class="del-small-trash" name="btnDelImg" ><i class="fa fa-times"></i></button></div>'); fileHelper.readAndPreviewImages(this.files, 'upForAsBuilt', 0, 86, '<div class="file-item">', '<button class="del-small-trash" name="btnDelImg" ><i class="fa fa-times"></i></button></div>');
}); });
onEvent("click", "button[id^=graEdiBtn]", function () {
})
// 關閉 modal // 關閉 modal
$('#uploadPicture').on('hidden.bs.modal', function (e) { $('#uploadPicture').on('hidden.bs.modal', function (e) {
@ -347,7 +350,6 @@
types: { types: {
default: { default: {
max_depth: 3, max_depth: 3,
/*valid_children: "default",*/
icon: "fas fa-folder text-warning" icon: "fas fa-folder text-warning"
}, },
}, },
@ -409,18 +411,8 @@
dtAjaxResetSendData(graTable, { layer_id: parseInt(data.node.id) }); dtAjaxResetSendData(graTable, { layer_id: parseInt(data.node.id) });
graTable.ajax.reload(); graTable.ajax.reload();
let names = [];
let curNode = $('#graTree').jstree(true).get_node(data.node);
curLayerId = parseInt(data.node.id); curLayerId = parseInt(data.node.id);
$.each(curNode.parents, (idx, nodeId) => { $("#graLayer").text(levelNameByNodeId(data.node));
if (nodeId != "#") {
let node = $('#graTree').jstree(true).get_node(nodeId);
names.push(node.text);
}
})
names.push(data.node.text);
$("#graLayer").text(names.join("/"));
}) })
$("#graTree").on('create_node.jstree', function (e, data) { $("#graTree").on('create_node.jstree', function (e, data) {
let main = {}; let main = {};
@ -483,19 +475,35 @@
}) })
} }
function readGraph() { function readGraph(id) {
let url = baseApiUrl + "/GraphManage/GraManRead"; let url = baseApiUrl + "/GraphManage/GraManRead";
objSendData.Data = { id: parseInt(id) };
ytAjax = new YourTeam.Ajax(url, null, function (res) { ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
if (!res || res.code != "0000" || !res.data) { if (!res || res.code != "0000" || !res.data) {
} else { } else {
res.data.forEach(x => x.parent = x.system_parent_id); $("#graPicNum").text(res.data?.code);
res.data.forEach(x => x.text = x.system_key); $("#graPicName").text(res.data?.name);
res.data.forEach(x => x.parent = x.parent == 0 ? "#" : x.parent); $("#graLayer").text(levelNameByNodeId(res.data?.layer_id));
callback ? callback(res.data) : "";
$("#graModal").modal("show");
} }
}, null, "POST").send(); }, null, "POST").send();
} }
function levelNameByNodeId(node) {
let names = [];
let curNode = $('#graTree').jstree(true).get_node(node);
$.each(curNode.parents, (idx, nodeId) => {
if (nodeId != "#") {
let node = $('#graTree').jstree(true).get_node(nodeId);
names.push(node.text);
}
})
names.push(curNode.text);
return names.join("/");
}
</script> </script>

View File

@ -2128,6 +2128,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
function loadedBasePack() { function loadedBasePack() {
require( require(
[ [
"lib/bootstrap/bootstrap.bundle.min",
"lib/app.bundle", "lib/app.bundle",
"lib/app.menu", "lib/app.menu",
"datatables.net.b4", "datatables.net.b4",

File diff suppressed because one or more lines are too long

View File

@ -229,10 +229,10 @@ namespace FrontendWebApi.ApiControllers
var sqlString = @$"SELECT * var sqlString = @$"SELECT *
FROM graph_manage gm FROM graph_manage gm
JOIN variable v1 ON convert(v1.id, nchar) = gm.layer_id and v1.system_type = @graph_manage_layer and v1.deleted = 0 JOIN variable v1 ON convert(v1.id, nchar) = gm.layer_id and v1.system_type = @graph_manage_layer and v1.deleted = 0
WHERE gm.id = @id WHERE gm.id = @id AND gm.deleted = 0
ORDER BY gm.priority, gm.created_at desc"; ORDER BY gm.priority, gm.created_at desc";
var param = new { @id = gi.id, @layer_id = gi.layer_id }; var param = new { @id = gi.id, @graph_manage_layer = graph_manage_layer };
graManList = await backendRepository.GetOneAsync<GraphList>(sqlString, param); graManList = await backendRepository.GetOneAsync<GraphList>(sqlString, param);