[Frontend][全域功能] Loading 程序調整 | [電梯管理] 3D 透明隱藏動態 | Loading 接口程序調整 | 部分程序修正

This commit is contained in:
dev01 2023-01-16 18:35:01 +08:00
parent d3df21b0b9
commit 17b3b6429a
8 changed files with 66 additions and 22 deletions

View File

@ -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();
}
@ -431,7 +432,7 @@
chartWorOrdErr();
chartWorOrdFin();
endPageLoading();
$(loadEle).Loading("close");
}
}

View File

@ -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();
}

View File

@ -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) {

View File

@ -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; }
}

View File

@ -0,0 +1,2 @@

.yt-notice-block-scrollbody::-webkit-scrollbar { display: none; }

View File

@ -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);
})

View File

@ -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);

View File

@ -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, () => {
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;