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": "功能",
"data": "userinfo_guid",
"data": "id",
"render": function (data, type, row, meta) {
let btnDiv = creDiv(["row", "m-0", "justify-content-center"], { "style": "gap:10px" });
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;
$("#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>');
});
onEvent("click", "button[id^=graEdiBtn]", function () {
})
// 關閉 modal
$('#uploadPicture').on('hidden.bs.modal', function (e) {
@ -347,7 +350,6 @@
types: {
default: {
max_depth: 3,
/*valid_children: "default",*/
icon: "fas fa-folder text-warning"
},
},
@ -409,18 +411,8 @@
dtAjaxResetSendData(graTable, { layer_id: parseInt(data.node.id) });
graTable.ajax.reload();
let names = [];
let curNode = $('#graTree').jstree(true).get_node(data.node);
curLayerId = parseInt(data.node.id);
$.each(curNode.parents, (idx, nodeId) => {
if (nodeId != "#") {
let node = $('#graTree').jstree(true).get_node(nodeId);
names.push(node.text);
}
})
names.push(data.node.text);
$("#graLayer").text(names.join("/"));
$("#graLayer").text(levelNameByNodeId(data.node));
})
$("#graTree").on('create_node.jstree', function (e, data) {
let main = {};
@ -483,19 +475,35 @@
})
}
function readGraph() {
function readGraph(id) {
let url = baseApiUrl + "/GraphManage/GraManRead";
ytAjax = new YourTeam.Ajax(url, null, function (res) {
objSendData.Data = { id: parseInt(id) };
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
if (!res || res.code != "0000" || !res.data) {
} else {
res.data.forEach(x => x.parent = x.system_parent_id);
res.data.forEach(x => x.text = x.system_key);
res.data.forEach(x => x.parent = x.parent == 0 ? "#" : x.parent);
callback ? callback(res.data) : "";
$("#graPicNum").text(res.data?.code);
$("#graPicName").text(res.data?.name);
$("#graLayer").text(levelNameByNodeId(res.data?.layer_id));
$("#graModal").modal("show");
}
}, 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>

View File

@ -2128,6 +2128,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
function loadedBasePack() {
require(
[
"lib/bootstrap/bootstrap.bundle.min",
"lib/app.bundle",
"lib/app.menu",
"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 *
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
WHERE gm.id = @id
WHERE gm.id = @id AND gm.deleted = 0
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);