[Frontend][全域功能] 3D 物件初始化程序調整

This commit is contained in:
dev01 2022-12-08 18:12:40 +08:00
parent 2fe739f37f
commit 44df9c6e3c
4 changed files with 27 additions and 19 deletions

View File

@ -247,16 +247,18 @@
var elev3DBind = {}; var elev3DBind = {};
var elev3DOption = {}; var elev3DOption = {};
var elev3DObj = []; var elev3DObj = [];
var timeOutor = null; //刷新 baja 資料 定時器
var sysIconList = [ var sysIconList = [
{ mainSys: "EE", subSys: "E1", iconClass: "fal fa-grip-vertical"}, { mainSys: "EE", subSys: "E1", iconClass: "fal fa-grip-vertical" },
{ mainSys: "EE", subSys: "E2", iconClass: "fal fa-grip-horizontal"}, { mainSys: "EE", subSys: "E2", iconClass: "fal fa-grip-horizontal" },
{ mainSys: "EE", subSys: "E3", iconClass: "fal fa-bolt"}, { mainSys: "EE", subSys: "E3", iconClass: "fal fa-bolt" },
{ mainSys: "EE", subSys: "E4", iconClass: "fal fa-car-battery"}, { mainSys: "EE", subSys: "E4", iconClass: "fal fa-car-battery" },
{ mainSys: "LT", subSys: "L1", iconClass: "fal fa-lightbulb-on"}, { mainSys: "LT", subSys: "L1", iconClass: "fal fa-lightbulb-on" },
{ mainSys: "ME", subSys: "M10", iconClass: "fal fa-wind"}, { mainSys: "ME", subSys: "M10", iconClass: "fal fa-wind" },
{ mainSys: "ME", subSys: "M12", iconClass: "fal fa-snowflake"}, { mainSys: "ME", subSys: "M12", iconClass: "fal fa-snowflake" },
{ mainSys: "ELEV", subSys: "EL", iconClass: "fal fa-door-open"}, { mainSys: "ELEV", subSys: "EL", iconClass: "fal fa-door-open" },
] ];
$(document).ready(function () { $(document).ready(function () {
show3DModel(); show3DModel();
getSubList(); getSubList();
@ -692,7 +694,7 @@
/*$(`.dev-group i.fa-lightbulb-on`)*/ /*$(`.dev-group i.fa-lightbulb-on`)*/
getSystemAlarmByBaja((data) => { getSystemAlarmByBaja((data) => {
console.log(data)
$.each(data.data, (idx, alaObj) => { $.each(data.data, (idx, alaObj) => {
if (alaObj.alarmClass.indexOf("_") != -1) { if (alaObj.alarmClass.indexOf("_") != -1) {
let mainSubSys = alaObj.alarmClass.split("_").slice(0, 2).join("/"); let mainSubSys = alaObj.alarmClass.split("_").slice(0, 2).join("/");
@ -738,7 +740,7 @@
} }
function timeOutGetData() { function timeOutGetData() {
setInterval(() => { timeOutor = setInterval(() => {
getAlarmSub(); getAlarmSub();
},3000) },3000)
} }

View File

@ -989,7 +989,7 @@
$(`#${matchDevice.device_number}_card [name=downFloArrow]`).removeClass("light-flash-c"); $(`#${matchDevice.device_number}_card [name=downFloArrow]`).removeClass("light-flash-c");
} }
} }
console.log(data.device_number.split("_").slice(-1))
if (data.device_number.split("_").slice(-1) == "N1" && master == "BANK1") { if (data.device_number.split("_").slice(-1) == "N1" && master == "BANK1") {
//消防回歸 //消防回歸
actLightByPoi("FE", "#emerReturn"); actLightByPoi("FE", "#emerReturn");
@ -1069,7 +1069,7 @@
} }
} }
}) })
debugger
if (isFirstLoad3D == false && elev3DObj.length != 0) { if (isFirstLoad3D == false && elev3DObj.length != 0) {
let elevObj = elev3DObj.filter(x => x.nodeId == elev3DBind[devNum])[0]; let elevObj = elev3DObj.filter(x => x.nodeId == elev3DBind[devNum])[0];
if (!elevObj.id) { if (!elevObj.id) {
@ -1078,7 +1078,7 @@
elevObj.obj = Object.assign(elevObj.obj, elev3DOption); elevObj.obj = Object.assign(elevObj.obj, elev3DOption);
elevObj.obj.init(function () { elevObj.obj.init(function () {
let frags = elevObj.obj.fragProxys.filter(x => x.nodeId == elev3DBind[devNum]); let frags = elevObj.obj.fragProxys.filter(x => x.nodeId == elev3DBind[devNum]);
debugger
frags.forEach((fragProxy) => { frags.forEach((fragProxy) => {
fragProxy.frag.position.z = elev3DOption.floorHeight.filter(x => x.floor == subData["CP"])[0]?.height ?? 0; fragProxy.frag.position.z = elev3DOption.floorHeight.filter(x => x.floor == subData["CP"])[0]?.height ?? 0;
fragProxy.frag.updateAnimTransform(); fragProxy.frag.updateAnimTransform();
@ -1143,7 +1143,7 @@
// Card - 設置列表中訂閱內容 // Card - 設置列表中訂閱內容
function subDeviceSetTable(devNum) { function subDeviceSetTable(devNum) {
if (allDevList.filter(x => !x.device_number).length > 0) { if (allDevList.filter(x => !x.device_number).length > 0) {
debugger
} }
let subData = subSeviceData.filter(x => x.device_number == devNum)[0] let subData = subSeviceData.filter(x => x.device_number == devNum)[0]
let matchDevice = allDevList.filter(x => x.device_number == devNum)[0]; let matchDevice = allDevList.filter(x => x.device_number == devNum)[0];
@ -1180,13 +1180,13 @@
elevObj.obj.movElevator(); elevObj.obj.movElevator();
} }
} }
console.log("console:", subData, devNum, allDevList)
elevObj.setEleMovStatus(matchDevice.device_number, subData["RD"] == "UP" ? 1 : subData["RD"] == "DOWN" ? 2 : 0); elevObj.setEleMovStatus(matchDevice.device_number, subData["RD"] == "UP" ? 1 : subData["RD"] == "DOWN" ? 2 : 0);
//現在樓層 //現在樓層
if (subData["CP"]) { if (subData["CP"]) {
$(`#imdStaTable_${devNum} [name=curFloor]`).text(subData["CP"]); $(`#imdStaTable_${devNum} [name=curFloor]`).text(subData["CP"]);
} }
console.log("目標樓層:" + subData["CP"], "RD點位值:" + subData["RD"])
//往上或往下 //往上或往下
if (subData["RD"] == "UP") { if (subData["RD"] == "UP") {
$(`#imdStaTable_${devNum} [name=downFloArrow]`).removeClass("light-flash-c"); $(`#imdStaTable_${devNum} [name=downFloArrow]`).removeClass("light-flash-c");
@ -2489,7 +2489,7 @@
elevObj.obj = Object.assign(elevObj, elevator3DObj ?? {}) elevObj.obj = Object.assign(elevObj, elevator3DObj ?? {})
elevObj.obj.init(function () { elevObj.obj.init(function () {
let frags = elevObj.obj.fragProxys.filter(x => x.nodeId == node); let frags = elevObj.obj.fragProxys.filter(x => x.nodeId == node);
debugger
frags.forEach((fragProxy) => { frags.forEach((fragProxy) => {
fragProxy.frag.position.z = elev3DOption.floorHeight.filter(x => x.floor == subData["CP"])[0]?.height ?? 0; fragProxy.frag.position.z = elev3DOption.floorHeight.filter(x => x.floor == subData["CP"])[0]?.height ?? 0;
fragProxy.frag.updateAnimTransform() fragProxy.frag.updateAnimTransform()

View File

@ -2279,7 +2279,9 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
sub.unsubscribeAll(); sub.unsubscribeAll();
sub.detach(); sub.detach();
}) })
endPageLoading(); endPageLoading();
timeOutor ? clearInterval(timeOutor) : ""; // dashboard 定時更新 baja 資料定時器關閉
$("#app").load(`_${page}.html`, loadCallback); $("#app").load(`_${page}.html`, loadCallback);
}) })

View File

@ -138,7 +138,11 @@ class elevator3D {
} }
setTreeFrag = function (callback) { setTreeFrag = function (callback) {
let tree = this.viewer.model.getData().instanceTree; let tree = this.viewer?.model?.getData().instanceTree;
if (!tree) {
return;
}
let nodeId = this.nodeId; let nodeId = this.nodeId;
if (nodeId) { if (nodeId) {