diff --git a/Frontend/_dashboard.html b/Frontend/_dashboard.html index c61fae7..b830198 100644 --- a/Frontend/_dashboard.html +++ b/Frontend/_dashboard.html @@ -266,6 +266,8 @@ ]; $(document).ready(function () { + + $(loadEle).Loading("start"); show3DModel(); getSubList(); getFirstEletric(); @@ -331,7 +333,6 @@ } else { subSysElecList = res.data; tarElePath = subSysElecList.filter(x => x.mainSubTag == "total")[0]?.system_device_tag ?? ""; - startPageLoading(); getSubBaja(); getElectricBaja(); } @@ -430,8 +431,8 @@ chartErrChk(["已確認異常", "未確認異常"], [chartDataCnt.chkedErrCnt, chartDataCnt.unChkedErrCnt]); chartWorOrdErr(); chartWorOrdFin(); - - endPageLoading(); + + $(loadEle).Loading("close"); } } diff --git a/Frontend/_sysElevator.html b/Frontend/_sysElevator.html index 7e03d59..b83f6d9 100644 --- a/Frontend/_sysElevator.html +++ b/Frontend/_sysElevator.html @@ -891,8 +891,11 @@ var zoomToggle = 3; var isFirstLoad3D = true; var isFirstLoadSub = true; + var forgeInvType = null; + var forgeInvTypeDef = null; $(function () { initChart(); + getInviForge(); setBuildFloor(); setCards(); @@ -2371,6 +2374,31 @@ // ↑ 樓層平面圖 ↑ //===================================================================== + // 設置 模型隱藏或透明 + function setInviForge(type, devDbIds) { + console.log("devDbIds", devDbIds) + if (type == "Hide") { + hideAllObjects(devDbIds); + } else if (type == "Opacity") { + setTransparentBuilding(0, devDbIds); + } + } + + // 取得 不可視 3D 模型類型 + function getInviForge() { + let url = baseApiUrl + "/api/Device/GetForgeInvType"; + + ytAjax = new YourTeam.Ajax(url, null, function (res) { + if (!res || res.code != "0000" || !res.data) { + + } else { + let datas = res.data; + forgeInvType = datas.filter(x => x.sub_system_tag == pageAct.sysSubTag)[0]?.invisible_value; + forgeInvTypeDef = datas.filter(x => x.invisible_type == "default_value")[0]?.invisible_value; + } + }, null, "POST").send(); + } + //載入3D模型 function load3DModel() { launchViewer(pageAct.urn, (viewer) => { @@ -2385,8 +2413,12 @@ // 電梯移動訂閱程序載入 let forge3DElev = new Forge3DElevFull(elevOption); forge3DElev.bajaEndCallback = function () { - debugger - /*hideAllObjects(this.getNodeIds());*/ + // 從資料庫設定不可視模型的類型,若沒有取道該小類不可視類型,則套用資料庫設定預設類型 + if (forgeInvType) { + setInviForge(forgeInvType, this.getNodeIds); + } else { + setInviForge(forgeInvTypeDef, this.getNodeIds); + } setTransparentBuilding(0); endPageLoading(); } diff --git a/Frontend/_sysMonFloor.html b/Frontend/_sysMonFloor.html index 81b429c..013def5 100644 --- a/Frontend/_sysMonFloor.html +++ b/Frontend/_sysMonFloor.html @@ -367,7 +367,7 @@ let option = floChart.getOption(); option.series.forEach(function (series) { - series.data.forEach(function (point) { + (series.data ?? []).forEach(function (point) { let dbid = obj.myDataList.filter(x => x.device_number == point.device_number)[0]?._dbId; point._dbId = dbid; currentData.forEach(function (cData) { diff --git a/Frontend/css/site.css b/Frontend/css/site.css index 7c0e702..65ee5ca 100644 --- a/Frontend/css/site.css +++ b/Frontend/css/site.css @@ -86,7 +86,7 @@ input:-webkit-autofill { background-color: rgba(0, 0, 0, 0.15) !important; } .yt-navbar-content ul li { position: relative; display: flex; flex-wrap: wrap; } .yt-navbar-content ul li a { font-size: 0.9rem; padding: 0.75rem 2rem; position: relative; width: 100%; } .yt-navbar-content ul li a:hover { background-color: var(--theme-fusion-600); } -.yt-navbar-content ul li a:active, .yt-navbar-content ul li a.active { background-color: var(--theme-fusion-500); } +.yt-navbar-content ul li a:active, .yt-navbar-content ul li a.active { background-color: var(--theme-light); } .card-header.p-3.ui-draggable-handle:hover { cursor: move; } @@ -106,9 +106,9 @@ a[data-tabname="topFunBtn"]:hover { color: var(--theme-primary-50); } } .userblock:hover { color: var(--theme-primary-50); } .dropdown.show .userblock { color: var(--theme-primary-50) !important; }*/ -.page-header a { color: #fff !important; } -.page-header a:hover { color: var(--theme-primary-50) !important; } -.page-header a.active { color: var(--theme-primary-500) !important; } +.page-header a, #sysMonBtnList a { color: #fff !important; } +.page-header a:hover, #sysMonBtnList a:hover { color: var(--theme-primary-50) !important; } +.page-header a.active, #sysMonBtnList a.active { color: var(--theme-primary-500) !important; } .dropdown.show a { color: var(--theme-primary-50) !important; } @media screen and (max-width: 576px) { .yt-left-navbar { width: 100%; max-width: 100%; margin-top: 0; } } diff --git a/Frontend/css/yourteam/plugins/yt-notice/yt-notice.css b/Frontend/css/yourteam/plugins/yt-notice/yt-notice.css new file mode 100644 index 0000000..5266815 --- /dev/null +++ b/Frontend/css/yourteam/plugins/yt-notice/yt-notice.css @@ -0,0 +1,2 @@ + +.yt-notice-block-scrollbody::-webkit-scrollbar { display: none; } diff --git a/Frontend/index.html b/Frontend/index.html index a311627..de1d724 100644 --- a/Frontend/index.html +++ b/Frontend/index.html @@ -867,7 +867,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li if (isJSON(sessionStorage.getItem("pageAct"))) { lastPageAct = JSON.parse(sessionStorage.getItem("pageAct")); } - if (lastPageAct.sysSubTag && lastPage == "systemMonitor") { + if ((lastPageAct.sysSubTag && lastPage == "systemMonitor") || lastPage == "sysElevator") { $(`#subSysBtn${lastPageAct.sysSubTag}`).click(); $("#sysMonTopBtn").YTTab("set"); } else { @@ -944,7 +944,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li return; } if (page != "systemMonitor" && page != "sysElevator") { - $("#sysMonBtnList .dropdown-item").removeClass("active"); + $("#sysMonBtnList [name=topFunBtn]").removeClass("active"); pageAct.sysMainTag = null; pageAct.sysSubTag = null; } else { @@ -952,20 +952,24 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li $("#sysMonTopBtn").YTTab("set"); $(`#subSysBtn${pageAct.sysSubTag}`).YTTab("set"); } + // 取消當前所有 baja 訂閱 $.each(tolSubList, (idx, sub) => { sub.unsubscribeAll(); sub.detach(); }) + // 清空 baja 訂閱紀錄 tolSubList = []; + // 清空 loading 狀態 endPageLoading(); + + $(loadEle).Loading("close"); $(".yt-alert").YTAlert().hide(); - - - + // 取得使用者資訊 getUserInfo(); - + // 存取現在頁面 (重整讀取紀錄用) sessionStorage.setItem("lastPage", page); sessionStorage.setItem("pageAct", JSON.stringify(pageAct)); + // 讀取子頁面 $("#app").load(`_${page}.html`, loadCallback); }) diff --git a/Frontend/js/forge/forgemodel.js b/Frontend/js/forge/forgemodel.js index 6f33971..ff3e7fe 100644 --- a/Frontend/js/forge/forgemodel.js +++ b/Frontend/js/forge/forgemodel.js @@ -348,7 +348,7 @@ function onDocumentLoadSuccess(doc, eleOption) { // }); viewer.addEventListener(Autodesk.Viewing.GEOMETRY_LOADED_EVENT, function () { - let instanceTree = viewer.model.getData().instanceTree; + let instanceTree = viewer.model?.getData().instanceTree; console.log(instanceTree.nodeAccess) allDbIdsStr = Object.keys(instanceTree.nodeAccess.dbIdToIndex); /*getNodeIdByDbIds("【電梯】", (nodeIds) => {*/ @@ -448,7 +448,7 @@ function setElevatorSpeed(speed) { //0.01 ~ 1 function movElevator() { - let tree = viewer.model.getData().instanceTree; + let tree = viewer.model?.getData().instanceTree; let nodeId = 10952; let fragProxyZ = 0; var movStatus = 0; // 0=no 1=up 2=down @@ -504,7 +504,7 @@ function movElevator() { } function getAllDbIds(viewer) { - var instanceTree = viewer.model.getData().instanceTree; + var instanceTree = viewer.model?.getData().instanceTree; var allDbIdsStr = Object.keys(instanceTree.nodeAccess.dbIdToIndex); @@ -687,7 +687,7 @@ function setTransparency(nodeId, opacity) { function changeColor(nodeId, color = [0, 255, 0, 1]) {//電梯變綠色 let model = viewer.model; let fragList = viewer.model.getFragmentList(); - let instanceTree = viewer.model.getData().instanceTree; + let instanceTree = viewer.model?.getData().instanceTree; color = color.map((x, i) => i < 3 ? x / 255 : x); color = new THREE.Vector4().fromArray(color); model.getData().instanceTree.enumNodeFragments( @@ -715,7 +715,7 @@ function changeColor(nodeId, color = [0, 255, 0, 1]) {//電梯變綠色 } function hideColor(nodeId) {//顏色改成透明 - let instanceTree = viewer.model.getData().instanceTree; + let instanceTree = viewer.model?.getData().instanceTree; instanceTree.enumNodeChildren(nodeId, function (chiNodeId) { var color = new THREE.Vector4(0, 1, 0, 0); viewer.setThemingColor(chiNodeId, color); diff --git a/Frontend/js/site.js b/Frontend/js/site.js index 194259f..f243a71 100644 --- a/Frontend/js/site.js +++ b/Frontend/js/site.js @@ -27,15 +27,20 @@ $.fn.outerHtml = function () { $.fn.Loading = function (type = "close", text) { let ele = this; let aleObj = $(this)[0]._aleObj; + let showStatus = $(ele).data("loading-show-status"); function closeLoading() { + $(ele).data("loading-show-status", "close"); $("body").css("overflow", "auto"); $(aleObj.ele).YTAlert().hide(); $(ele).animate({ opacity: 0 }, 300, () => { - $(ele).hide(); + if ($(ele).data("loading-show-status") == "close") { + $(ele).hide(); + } }) } function showLoading() { + $(ele).data("loading-show-status", "show"); $("body").css("overflow", "hidden"); let aleObj = YT.Alert.Tip(text || "讀取中,請稍後", "show"); $(ele)[0]._aleObj = aleObj;