From 58c95ae8064e87e6e20b30b848998d9cca1ce55e Mon Sep 17 00:00:00 2001 From: dev01 Date: Wed, 4 Jan 2023 18:49:37 +0800 Subject: [PATCH 1/3] =?UTF-8?q?[Frontend][=E7=B3=BB=E7=B5=B1=E7=9B=A3?= =?UTF-8?q?=E6=8E=A7]=20=E5=A2=9E=E5=8A=A0=E8=AE=80=E5=8F=96=20forge=203D?= =?UTF-8?q?=20Loading=20=E9=81=AE=E7=BD=A9=20|=20=E7=B8=BD=E6=94=AC?= =?UTF-8?q?=E5=8F=8A=E9=9B=BB=E6=A2=AF=E7=B3=BB=E7=B5=B1=E9=9A=B1=E8=97=8F?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E7=89=A9=E4=BB=B6(=E4=B8=8D=E5=8C=85?= =?UTF-8?q?=E5=90=AB=E8=A8=AD=E5=82=99)=E7=A8=8B=E5=BA=8F=E5=BB=BA?= =?UTF-8?q?=E7=BD=AE=20|=20[=E5=9C=96=E8=B3=87=E7=AE=A1=E7=90=86]=20?= =?UTF-8?q?=E9=9A=8E=E5=B1=A4=E6=96=B0=E5=A2=9E=E9=81=B8=E6=93=87=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E8=AA=BF=E6=95=B4=20|=20[=E5=85=A8=E5=9F=9F=E5=8A=9F?= =?UTF-8?q?=E8=83=BD]=20forge3D=20=E5=A2=9E=E5=8A=A0=E8=AE=80=E5=8F=96?= =?UTF-8?q?=E5=A4=B1=E6=95=97=E5=9B=9E=E8=AA=BF=20Callback=20|=20hideAllOb?= =?UTF-8?q?jects=20=E9=9A=B1=E8=97=8F=E5=85=A8=E7=89=A9=E4=BB=B6=20?= =?UTF-8?q?=E4=B8=8D=E5=8C=85=E5=90=AB=E6=9F=90=E4=BA=9B=20dbid=20?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frontend/_graphManagement.html | 53 +++++++++++++++++++++++---------- Frontend/_sysElevator.html | 7 ++++- Frontend/_sysMonAll.html | 47 ++++------------------------- Frontend/_sysMonFloor.html | 9 ++++-- Frontend/index.html | 16 ++-------- Frontend/js/forge/forgemodel.js | 35 +++++++++++++++------- Frontend/js/site.js | 4 +++ 7 files changed, 87 insertions(+), 84 deletions(-) diff --git a/Frontend/_graphManagement.html b/Frontend/_graphManagement.html index 55749cb..8ecee15 100644 --- a/Frontend/_graphManagement.html +++ b/Frontend/_graphManagement.html @@ -16,7 +16,7 @@
-
+
+新增 @@ -65,7 +65,7 @@
- +
@@ -278,8 +278,8 @@ let dowLoaEle = YT.Alert.Tip("準備下載中...", "show", true); let rowData = graTable.row($(this).closest("tr")).data(); let apiUrl = baseApiUrl + `/File/Download?type=graph&savename=${rowData.oriSavName}&oriname=${rowData.oriOrgName}`; - let extname = rowData.oriOrgName?.split(".").slice(-1) || "dwg"; - download(token, apiUrl, rowData.name + "_原設計圖" + "." + extname, function () { + + download(token, apiUrl, rowData.oriOrgName, function () { $(dowLoaEle.ele).YTAlert().hide(); }); }) @@ -390,8 +390,8 @@ Create: { label: "新增", _disabled: function (data) { - if (depth >= 3) { - return true; //第五層後無法新增 + if (depth >= 4) { + return true; //第三層後無法新增 } return false; }, @@ -405,6 +405,12 @@ }, Rename: { label: "重新命名", + _disabled: function (data) { + if ($node.id == "0") { + return true; //最上層無法編輯 + } + return false; + }, action: function (obj) { tree.edit($node); /* tree.sort($node, true)*/ @@ -412,6 +418,12 @@ }, Remove: { label: "移除", + _disabled: function (data) { + if ($node.id == "0") { + return true; //最上層無法移除 + } + return false; + }, action: function (obj) { tree.delete_node($node); } @@ -426,18 +438,27 @@ } function treeEvent() { + let selectedNode = []; $('#graTree').on("loaded.jstree", function (e, data) { - let topNode = $('#graTree').jstree(true).get_node("#"); + let topNode = $('#graTree').jstree(true).get_node("0"); $('#graTree').jstree(true).select_node(topNode.children[0]); $("#graTree").jstree("open_node", 0); }) $('#graTree').on("select_node.jstree", function (e, data) { - dtAjaxResetSendData(graTable, { layer_id: parseInt(data.node.id) }); - graTable.ajax.reload(); - - curLayerId = parseInt(data.node.id); - $("#graLayer").text(levelNameByNodeId(data.node)); - $("#curLevText").text(levelNameByNodeId(data.node)); + if (data.node.id != "0") { + dtAjaxResetSendData(graTable, { layer_id: parseInt(data.node.id) }); + graTable.ajax.reload(); + selectedNode.unshift(data.node.id); + if (selectedNode.length > 3) { + selectedNode.splice(selectedNode.length - 1, 1); + } + curLayerId = parseInt(data.node.id); + $("#graLayer").text(levelNameByNodeId(data.node)); + $("#curLevText").text(levelNameByNodeId(data.node)); + } else { + $("#graTree").jstree(true).deselect_node(data.node); + $("#graTree").jstree(true).select_node(selectedNode[0]); + } }) $("#graTree").on('create_node.jstree', function (e, data) { let main = {}; @@ -537,14 +558,14 @@ let names = []; let curNode = $('#graTree').jstree(true).get_node(node); let parents = curNode.parents.reverse(); - + for (let i = parents.length - 1; i >= 0; i--) { - if (parents[i] != "#") { + if (parents[i] != "#") { let node = $('#graTree').jstree(true).get_node(parents[i]); names.push(node.text); } } - + names.push(curNode.text); return names.join("/"); diff --git a/Frontend/_sysElevator.html b/Frontend/_sysElevator.html index 43e788f..084a7dd 100644 --- a/Frontend/_sysElevator.html +++ b/Frontend/_sysElevator.html @@ -2371,8 +2371,9 @@ //載入3D模型 function load3DModel() { - launchViewer(pageAct.urn, (viewer) => { + + let elevOption = { selector: "#forgeViewer", viewer: viewer, @@ -2382,12 +2383,16 @@ // 電梯移動訂閱程序載入 let forge3DElev = new Forge3DElevFull(elevOption); forge3DElev.bajaEndCallback = function () { + debugger + hideAllObjects(this.getNodeIds()); endPageLoading(); } forge3DElev.bajaChaCallback = function (data) { subDeviceSetStatus(data); } forge3DElev.init(); + + }); } diff --git a/Frontend/_sysMonAll.html b/Frontend/_sysMonAll.html index c7473f0..53220b8 100644 --- a/Frontend/_sysMonAll.html +++ b/Frontend/_sysMonAll.html @@ -45,9 +45,7 @@ setLightColor(); } if (arr.indexOf(3) != -1) { - getHotspotPoint(() => { - getLightDevice(); show3DModel(data.urn_3D); }); @@ -264,7 +262,11 @@ } function show3DModel(urn) { + $(loadEle).Loading("start"); launchViewerForHotspot(urn, (viewer, nodeIds) => { + let devDbIds = allDevList.map(x => x.forge_dbid); + hideAllObjects(devDbIds); + $(loadEle).Loading("close"); let devices = allDevList.map(x => { return { roomDbId: !isNaN(parseInt(x.room_dbid)) ? parseInt(x.room_dbid) : -1, @@ -300,6 +302,8 @@ endPageLoading(); } forge3DElev.init(); + }, () => { + $(loadEle).Loading("close"); }, "[name=forgeViewer]"); } @@ -337,50 +341,11 @@ } - async function getLightDevice() {//callback = null - getLightData(null); - let url = baseApiUrl + "/api/GetDevNodeForCor"; - let sendData = { - "device_area_tag": pageAct.AreaTag, - "device_building_tag": pageAct.buiTag, - "device_system_tag": pageAct.sysMainTag, - "device_name_tag": pageAct.sysSubTag, - }; - objSendData.Data = sendData; - ytAjax = new YourTeam.Ajax(url, objSendData, function (res) { - if (!res || res.code != "0000" || !res.data) { - - } else { - - let myLightList = []; - $.each(res.data, (idx, data) => { - let item = {}; - item.position = {}; - if (data.device_node_coordinate_3d != null && isJSON(data.device_node_coordinate_3d)) { - item.position = JSON.parse(data.device_node_coordinate_3d); - } - $.extend(item, data); - myLightList.push(item); - }) - - console.log("2", myLightList); - setLightList(myLightList); - //callback ? callback() : ""; - } - }, null, "POST").send(); - - } - function setHotspotPoint(myDataList = []) { console.log(myDataList) getHopspotPoint(myDataList); } - async function setLightList(myDataList = []) { - console.log(myDataList); - getLightData(myDataList); - } - var parentEle = ""; onEvent("autodesk:click:sprite", "[name=forgeViewer]", function (e, obj) { forgeUnFocusAll(); diff --git a/Frontend/_sysMonFloor.html b/Frontend/_sysMonFloor.html index a656da7..ff6ff9b 100644 --- a/Frontend/_sysMonFloor.html +++ b/Frontend/_sysMonFloor.html @@ -1034,10 +1034,11 @@ // show 3D 模型 function show3DModel(urn) { + $(loadEle).Loading("start"); launchViewerForHotspot(urn, (viewer, nodeIds) => { let nextFloor = getNextFloor(pageAct.floGuid); let curFloTag = pageAct.floTag; - debugger + if (!nextFloor) { toast_warning("超出樓層範圍"); return; @@ -1050,7 +1051,9 @@ nextFloor = nextFloor.split("U")[1]; } - getLevelsData(curFloTag, nextFloor); + getLevelsData(curFloTag, nextFloor, function () { + $(loadEle).Loading("close"); + }); setHeatMap(); let elevOption = { @@ -1066,6 +1069,8 @@ endPageLoading(); } forge3DElev.init(); + + }); } diff --git a/Frontend/index.html b/Frontend/index.html index a9afa74..1408eb2 100644 --- a/Frontend/index.html +++ b/Frontend/index.html @@ -140,7 +140,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li @@ -191,7 +195,9 @@