This commit is contained in:
dev02 2022-12-08 18:26:28 +08:00
commit 98031df604
13 changed files with 398 additions and 139 deletions

View File

@ -240,11 +240,32 @@
var tarElePath = '';
var sysSubList = [];
var floList = []; //每個樓層
var subSeviceData = []; //每個設備訂閱點位值
var allEleDevList = [];
var viewer3DNodeIds = [];
var elev3DBind = {};
var elev3DOption = {};
var elev3DObj = [];
var timeOutor = null; //刷新 baja 資料 定時器
var sysIconList = [
{ mainSys: "EE", subSys: "E1", iconClass: "fal fa-grip-vertical" },
{ mainSys: "EE", subSys: "E2", iconClass: "fal fa-grip-horizontal" },
{ mainSys: "EE", subSys: "E3", iconClass: "fal fa-bolt" },
{ mainSys: "EE", subSys: "E4", iconClass: "fal fa-car-battery" },
{ mainSys: "LT", subSys: "L1", iconClass: "fal fa-lightbulb-on" },
{ mainSys: "ME", subSys: "M10", iconClass: "fal fa-wind" },
{ mainSys: "ME", subSys: "M12", iconClass: "fal fa-snowflake" },
{ mainSys: "ELEV", subSys: "EL", iconClass: "fal fa-door-open" },
];
$(document).ready(function () {
show3DModel();
getSubList();
getElevData();
getFirstEletric();
subDeviceSetStatus();
timeOutGetData();
});
// 從數字週數轉為中文週數
@ -298,9 +319,10 @@
if (contest.indexOf(subSysObj.sub_system_tag) != -1) {
sysSubList.push({ sysMainTag: mainSysObj.main_system_tag, sysSubTag: subSysObj.sub_system_tag });
}
let iconClass = sysIconList.filter(x => x.mainSys == mainSysObj.main_system_tag && x.subSys == subSysObj.sub_system_tag)[0]?.iconClass;
strHtml += `<div class="btn-group btn-group-lg col-lg-3 mb-4 dev-group" data-id="/${pageAct.AreaTag}/${pageAct.buiTag}/${mainSysObj.main_system_tag}/${subSysObj.sub_system_tag}">
<button type="button" class="btn btn-secondary col-4"><i class="fal fa-lightbulb-on fa-2x py-2"></i></button>
<button type="button" class="btn btn-secondary">${subSysObj.full_name}</button>
<button name="topFunBtn" data-page="alert" type="button" class="btn btn-secondary col-4"><i class="${iconClass || "fal fa-hdd"} fa-2x py-2"></i></button>
<button id="sysSubCardBtn${subSysObj.sub_system_tag}" type="button" class="btn btn-secondary" data-id="${subSysObj.sub_system_tag}">${subSysObj.full_name}</button>
</div>`;
})
})
@ -503,6 +525,7 @@
options: eveDayElecChartOptions
})
}
// 圖表 - 這週與上週用電量 (折線圖)
function chartEveWeeksElec(curWeekData, prevWeekData) {
@ -581,6 +604,7 @@
options: eveWeekElecChartOptions
})
}
// 圖表 - 異常與賦歸圖表 (圓餅圖)
function chartErrRec(labels,datas) {
@ -660,58 +684,216 @@
options: errChkChartOptions
})
}
// 從 baja 訂閱 左下角各系統小類異常狀態
function getAlarmSub() {
var tipEle = '';
//if (sysSubList.length != 0) {
// tipEle = YT.Alert.Tip("資料讀取中...","show");
//}
$(`.data-group i.fa-lightbulb-on`).removeClass("blink");
//debugger
$.each(sysSubList, (idx, sysSubObj) => {
//let myBaja = new subscriptionAlarms();
//let ordPath = {
// "building_tag": pageAct.buiTag,
// "system_tag": sysSubObj.sysMainTag,
// "name_tag": sysSubObj.sysSubTag,
//};
//console.log("ordPath",ordPath)
//myBaja.setSubscribeAlarmsByBql(ordPath);
//myBaja.setSubscribeAlarmsCallBack((data) => {
// if (data.sourceState == "Offnormal") {
// let devNum = data.system.replaceAll("_", "/");
/*$(`.dev-group i.fa-lightbulb-on`)*/
// $(`.dev-group[data-id*='${devNum}'] i.fa-lightbulb-on`).addClass("blink");
// }
//})
//myBaja.setSubscribeAlarmEndCallBack((data) => {
// console.log(idx,sysSubList.length)
// if (idx == sysSubList.length - 1) {
// $(tipEle.ele).YTAlert().hide();
// }
//})
getSystemAlarmByBaja((data) => {
$.each(data.data, (idx, alaObj) => {
if (alaObj.alarmClass.indexOf("_") != -1) {
let mainSubSys = alaObj.alarmClass.split("_").slice(0, 2).join("/");
$(`.btn-group.dev-group[data-id*='${mainSubSys}'] i`).addClass("blink");
}
})
$(`.dev-group i.fa-lightbulb-on.blink`).each((idx, ele) => {
let devPath = $(ele).parents(".dev-group").data("id");
let sysPath = devPath.split("/").slice(3, 5).join("/");
let alaDevPath = data.data.map(x => x.alarmClass?.split("_").slice(0, 2).join("/"));
if (alaDevPath.indexOf(sysPath) == -1) {
$(ele).removeClass("blink");
}
})
})
//$(".dev-group").each((idx, ele) => {
// let path = $(ele).data("id");
// let start = (new Date()).getTime();
// console.log("path enter baja:", path);
// getOneSystemStateByBaja(path, (data) => {
// let end = (new Date()).getTime();
// console.log("執行時間 :" + (end - start) / 1000 + " 秒","path : " + path, "輸出結果 :"+ data)
// })
//})
}
// 取得電梯資料
function getElevData() {
let url = baseApiUrl + "/api/Device/GetDeviceList";
let sendData = {
sub_system_tag: "EL",
building_tag: pageAct.buiTag,
};
objSendData.Data = sendData;
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
if (!res || res.code != "0000" || !res.data) {
} else {
$.each(res.data, (index, floObj) => {
let masters = floObj.device_list.map(x => x.device_number?.split("_")[5]).Distinct();
$.each(masters, (idx, master) => {
floObj.device_list.filter(x => x.device_number?.split("_")[5] == master).forEach((devObj) => {
allEleDevList.push(devObj);
allEleDevList = allEleDevList.oSort("priority");
})
})
})
}
}, null, "POST").send();
}
function timeOutGetData() {
timeOutor = setInterval(() => {
getAlarmSub();
},3000)
}
function show3DModel() {
launchViewer(pageAct.urn, (viewer, nodeIds) => {
console.log("nodeIds",nodeIds)
nodeIds = Array.from(nodeIds);
$.each(nodeIds, (idx, item) => {
elev3DBind[item[0]] = item[1];
})
nodeIds = nodeIds.map(x => x[1]);
$.each(nodeIds, function (idx, node) {
let options = {
element: $("#forgeViewer"),
viewer: viewer,
nodeId: node,
floorHeight: elev3DOption.floorHeight ?? [],
inited: function () {
}
}
let elevator3DObj = new elevator3D(options);
let devNum = Object.keys(elev3DBind).filter(x => elev3DBind[x] == node)[0];
let subData = subSeviceData.filter(x => x.device_number == devNum)[0];
if (elev3DObj.filter(x => x.nodeId == node).length == 0) {
elev3DObj.push({ id: devNum, nodeId: node, obj: elevator3DObj });
}
if (subData) {
let elevObj = elev3DObj.filter(x => x.nodeId == node)[0];
if (!elevObj.id) {
elevObj.id = devNum;
}
elevObj.obj = Object.assign(elevObj, elevator3DObj ?? {})
elevObj.obj.init(function () {
let frags = elevObj.obj.fragProxys.filter(x => x.nodeId == node);
frags.forEach((fragProxy) => {
fragProxy.frag.position.z = elev3DOption.floorHeight.filter(x => x.floor == subData["CP"])[0]?.height ?? 0;
fragProxy.frag.updateAnimTransform()
})
elevObj.obj.viewer.impl.sceneUpdated(true);
})
}
})
});
}
function subDeviceSetStatus() {
let subOrdPath = {
"building_tag": pageAct.buiTag,
"system_tag": "ELEV",
"name_tag": "EL",
};
myBaja = new subscriptionDevices();
myBaja.setSubscribeDevicesByBql(subOrdPath);
myBaja.setSubscribeDevicesCallBack(function (data) {
try {
if (allEleDevList.length == 0) {
return false;
}
data.device_number = data.device_number_full;
let matchDevice = allEleDevList.filter(x => x.device_number == data.device_number)[0];
let master = matchDevice.device_number.split("_")[5];
if (data.point_name == "CP") {
if (elev3DObj.length != 0) {
let elevObj = elev3DObj.filter(x => x.nodeId == elev3DBind[matchDevice.device_number])[0];
if (elevObj && elevObj.id) {
elevObj.obj.setElevatorFloor(data.value)
elevObj.obj.movElevator();
}
}
}
//將訂閱值塞入 subSeviceData
if (subSeviceData.findIndex(x => x.device_number == matchDevice.device_number) == -1) {
let obj = {};
obj.device_number = matchDevice.device_number;
subSeviceData.push(obj)
}
let subData = subSeviceData.filter(x => x.device_number == matchDevice.device_number)[0];
if (subData) {
subData[data.point_name] = data.value;
}
} catch (e) {
console.log("e", e)
}
});
myBaja.setSubscribeDeviceEndCallBack(function (data) {
let devNumArr = data.map(x => { return { devNum: x.device_number_full, priority: allEleDevList.filter(y => y.device_number == x.device_number_full)[0]?.priority } }).DistinctBy("devNum");
devNumArr = devNumArr.oSort("priority");
$.each(devNumArr, (idx, devObj) => {
devNum = devObj.devNum;
let subData = subSeviceData.filter(x => x.device_number == devNum)[0];
if (subData) {
//// 左側 3D 電梯 nodeID 與 device_number match
//if (Object.keys(elev3DBind).indexOf(devNum) == -1 && viewer3DNodeIds.length != 0) {
// elev3DBind[devNum] = viewer3DNodeIds[Object.keys(elev3DBind).length];
//}
// 左側 3D 電梯 Viewer Option 設置
/*elev3DOption.nodes = Object.keys(elev3DBind).map(x => elev3DBind[x]);*/
floList = Object.keys(subData).filter(x => x.startsWith("SP_FLS_")).map(x => x?.split("SP_FLS_")[1]);
elev3DOption.nodeId = elev3DBind[devNum];
elev3DOption.floorHeight = floList.map((x) => { return { floor: x } });
elev3DOption.floorHeight.forEach((floObj, idx) => {
if (floObj.floor.startsWith("B")) {
let floor = parseInt(floObj.floor.split("B")[1].split("F")[0]);
floObj.height = floor * -13;
} else {
let floor = parseInt(floObj.floor.split("F")[0]);
if (floor == 1) {
floObj.height = 0;
} else if (floor == 2) {
floObj.height = 14.75;
} else {
floObj.height = (14.75 + ((floor - 2) * 9.75));
}
}
})
if (elev3DObj.length != 0) {
let elevObj = elev3DObj.filter(x => x.nodeId == elev3DBind[devNum])[0];
if (!elevObj.id) {
elevObj.id = devNum;
}
elevObj.obj = Object.assign(elevObj.obj, elev3DOption);
elevObj.obj.init(function () {
let frags = elevObj.obj.fragProxys.filter(x => x.nodeId == elev3DBind[devNum]);
frags.forEach((fragProxy) => {
fragProxy.frag.position.z = elev3DOption.floorHeight.filter(x => x.floor == subData["CP"])[0]?.height ?? 0;
fragProxy.frag.updateAnimTransform();
})
elevObj.obj.viewer.impl.sceneUpdated(true);
});
}
}
})
})
}
onEvent("click", "button[id^=sysSubCardBtn]", function () {
let subSysTag = $(this).data("id");
$(`#subSysBtn${subSysTag}`).click();
})
</script>

View File

@ -53,21 +53,21 @@
<div id="elevatorBlock" class="elevator">
<div class="elevator-header">
<div class="row m-0 align-items-center p-2 gap-3 btn-group btn-group-toggle">
<button class="btn btn-secondary btn-sm active" data-tabname="floShowType" data-target="#2dDiv">
<button class="btn btn-secondary btn-sm " data-tabname="floShowType" data-target="#2dDiv">
2D
</button>
<button class="btn btn-secondary btn-sm" data-tabname="floShowType" data-target="#3dDiv" onclick="show3D()">
<button class="btn btn-secondary btn-sm active" data-tabname="floShowType" data-target="#3dDiv" onclick="show3D()">
3D
</button>
</div>
</div>
<div class="elevator-body d-flex align-items-center justify-content-center">
<div class="elevator-body d-flex align-items-center justify-content-center" style="height:85vh;">
<div id="2dDiv" class="p-2" data-tabname="floShowType" data-tabrole="child">
<table id="floorTable" class="elevator-build m-auto">
</table>
</div>
<div id="3dDiv" class="w-100" data-tabname="floShowType" data-tabrole="child">
<div id="forgeViewer"></div>
<div id="3dDiv" class="w-100 h-100 position-relative" data-tabname="floShowType" data-tabrole="child">
<div id="forgeViewer" style=""></div>
</div>
</div>
</div>
@ -78,20 +78,20 @@
<!-- <img src="img/elevator.jpg" class="img-fluid" style="min-height: 520px" /> -->
<div class="mt-2">
<div class="pl-3 row">
<button id="resChartZoom" class="btn btn-info">圖檔重置</button>
</div>
<div id="floChart" style="height : 45vh!important;width:100%"></div>
<!--<img src="img/總公司1F平面.jpg" class="img-fluid" style="min-height: 330px" />-->
</div>
</div>
<!-- End-左圖區 -->
<!-- 中間卡片區 -->
<div class="col-6 my-3">
<div id="eleCards" class="row">
<div id="eleCards" class="row col-12 p-0">
</div>
<div class="mt-2 col-8 p-0">
<!--<div class="pl-3 row">
<button id="resChartZoom" class="btn btn-info mb-2">圖檔重置</button>
</div>-->
<div id="floChart" style="height : 45vh!important;width:auto;"></div>
</div>
</div>
<!-- End-中間卡片區 -->
<!-- 右邊功能區 -->
@ -186,6 +186,36 @@
<span id="earQuaCon" class="circle-light bg-secondary"></span>
</div>
</div>
<div class="d-flex justify-content-around mt-2">
<div>
<label class="form-check-label h4" for="flexRadioDefault1">
遠端休止
</label>
</div>
<div>
<label id="disResText" class="form-check-label h4" for="flexRadioDefault1">
未動作
</label>
</div>
<div>
<span id="disRes" class="circle-light bg-secondary"></span>
</div>
</div>
<div class="d-flex justify-content-around mt-2">
<div>
<label class="form-check-label h4" for="flexRadioDefault1">
RET運轉
</label>
</div>
<div>
<label id="retOpeText" class="form-check-label h4" for="flexRadioDefault1">
未動作
</label>
</div>
<div>
<span id="retOpe" class="circle-light bg-secondary"></span>
</div>
</div>
</div>
<!-- End-右邊功能區 -->
<!-- Modal-Card1 -->
@ -912,6 +942,21 @@
}
}
function actLightByPoiEx(pointName1, selector, pointName2, exCond) {
$(selector).removeClass("bg-orange").removeClass("bg-red");
if (getValueByName(pointName2) == exCond) {
if (pointName1 == "falseText") {
$(selector).addClass("bg-secondary");
$(selector).parent("div").prev().find("label").text("取消控制");
} else {
$(selector).addClass("bg-red");
$(selector).parent("div").prev().find("label").text("控制");
}
} else {
$(selector).addClass("bg-success");
}
}
if (allDevList.length == 0) {
return false;
}
@ -945,6 +990,7 @@
}
}
if (data.device_number.split("_").slice(-1) == "N1" && master == "BANK1") {
//消防回歸
actLightByPoi("FE", "#emerReturn");
//群控故障
@ -955,7 +1001,15 @@
actLightByPoi("FER", "#fireReturn");
//地震管制
actLightByPoi("EER", "#earQuaCon");
if (data.point_name == "DNO" || data.point_name == "SP_RCS") {
//遠端休止
actLightByPoiEx("SP_RCS", "#disRes", "DNO", "trueText");
}
if (data.point_name == "COR" || data.point_name == "SP_RET") {
//RET運轉
actLightByPoiEx("SP_RET", "#retOpe", "COR", "falseText");
}
}
//將訂閱值塞入 subSeviceData
if (subSeviceData.findIndex(x => x.device_number == matchDevice.device_number) == -1) {
@ -1015,7 +1069,7 @@
}
}
})
debugger
if (isFirstLoad3D == false && elev3DObj.length != 0) {
let elevObj = elev3DObj.filter(x => x.nodeId == elev3DBind[devNum])[0];
if (!elevObj.id) {
@ -1024,7 +1078,7 @@
elevObj.obj = Object.assign(elevObj.obj, elev3DOption);
elevObj.obj.init(function () {
let frags = elevObj.obj.fragProxys.filter(x => x.nodeId == elev3DBind[devNum]);
debugger
frags.forEach((fragProxy) => {
fragProxy.frag.position.z = elev3DOption.floorHeight.filter(x => x.floor == subData["CP"])[0]?.height ?? 0;
fragProxy.frag.updateAnimTransform();
@ -1089,7 +1143,7 @@
// Card - 設置列表中訂閱內容
function subDeviceSetTable(devNum) {
if (allDevList.filter(x => !x.device_number).length > 0) {
debugger
}
let subData = subSeviceData.filter(x => x.device_number == devNum)[0]
let matchDevice = allDevList.filter(x => x.device_number == devNum)[0];
@ -1119,20 +1173,20 @@
if (isFirstLoad3D == false && elev3DObj.length != 0) {
if (elev3DObj.length != 0) {
let elevObj = elev3DObj.filter(x => x.nodeId == elev3DBind[devNum])[0];
if (elevObj && elevObj.id) {
elevObj.obj.setElevatorFloor(subData["CP"])
elevObj.obj.movElevator();
}
}
console.log("console:", subData, devNum, allDevList)
elevObj.setEleMovStatus(matchDevice.device_number, subData["RD"] == "UP" ? 1 : subData["RD"] == "DOWN" ? 2 : 0);
//現在樓層
if (subData["CP"]) {
$(`#imdStaTable_${devNum} [name=curFloor]`).text(subData["CP"]);
}
console.log("目標樓層:" + subData["CP"], "RD點位值:" + subData["RD"])
//往上或往下
if (subData["RD"] == "UP") {
$(`#imdStaTable_${devNum} [name=downFloArrow]`).removeClass("light-flash-c");
@ -1297,7 +1351,7 @@
{ id: "vip", text: "VIP" },
{ id: "onlyRun", text: "獨立運轉" },
{ id: "manual", text: "手動" },
{ id: "runOpe", text: "運轉保養" },
{ id: "runOpe", text: "保養運轉" },
{ id: "returnFin", text: "回歸完了" },
{ id: "notSerFloor", text: "不服務樓層" },
];
@ -1766,7 +1820,7 @@
min: 1
},
layoutSize: '100%',
layoutCenter: [],
layoutCenter: ['40%','50%'],
zoom: 1.2,
silent: true
},
@ -2435,7 +2489,7 @@
elevObj.obj = Object.assign(elevObj, elevator3DObj ?? {})
elevObj.obj.init(function () {
let frags = elevObj.obj.fragProxys.filter(x => x.nodeId == node);
debugger
frags.forEach((fragProxy) => {
fragProxy.frag.position.z = elev3DOption.floorHeight.filter(x => x.floor == subData["CP"])[0]?.height ?? 0;
fragProxy.frag.updateAnimTransform()

View File

@ -54,8 +54,10 @@
}
myBaja.setSubscribeDevicesByBql(ordPath);
myBaja.setSubscribeDevicesCallBack(function (data) {
let matchDevice = allDevList.filter(x => x.device_number.split("_")[x.device_number.split("_").length - 1] == data.device_number)[0];
let matchDevice = allDevList.filter(x => x.device_number == data.device_number_full)[0];
if (!matchDevice) {
return false;
}
let norDevPoiName = matchDevice.device_normal_point_name;
let cloDevPoiName = matchDevice.device_close_point_name;
let errDevPoiName = matchDevice.device_error_point_name;
@ -71,6 +73,10 @@
setLightColor();
});
myBaja.setSubscribeDeviceEndCallBack(function (data) {
endPageLoading();
});
}
//根據 data-type 設置顏色 (判斷後台是否有設定,若無則帶預設)
function setLightColor() {

View File

@ -47,7 +47,6 @@
} else {
chartHandler(`${baseImgUrl}/upload/floor_map/${res.data[0].floor_map_name}`);
/*allDeviceRowData = res.data[0].device_list;*/
getDevice(res.data[0].device_list);
}
}, null, "POST").send();

View File

@ -109,7 +109,15 @@ input.toggle:checked {
width: 100%;
height: 100vh;
position: fixed;
z-index: 2000;
z-index: 3000;
}
.dropdown-menu {
z-index:3000;
}
.adsk-viewing-viewer {
top:0px;
}
.lds-ring {

View File

@ -1478,13 +1478,15 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
<i class="fal fa-tv fa-2x"></i><br>系統監控
</a>
<div class="dropdown-menu dropdown-select-menu js-auto-close" id="sysMonBtnList">
<!--<button class="dropdown-item" type="button" name="sysMonBtn">電錶</button>
<button class="dropdown-item" type="button" name="sysMonBtn">照明系統</button>
<button class="dropdown-item" type="button" name="sysMonBtn">電梯系統</button>
<button class="dropdown-item" type="button" name="sysMonBtn">環境感測</button>
<button class="dropdown-item" type="button" name="sysMonBtn">空調系統</button>-->
</div>
</div>
<div class="btn-group mx-4">
<a href="javascript:;" name="topFunBtn" class="dropdown-toggle no-arrow text-center"
data-page="dashboard">
<i class="fal fa-chart-pie fa-2x"></i><br>能源管理
</a>
</div>
<div class="btn-group mx-4">
<a href="javascript:;" name="topFunBtn" class="dropdown-toggle no-arrow text-center"
data-page="historyData">
@ -2277,7 +2279,9 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
sub.unsubscribeAll();
sub.detach();
})
endPageLoading();
timeOutor ? clearInterval(timeOutor) : ""; // dashboard 定時更新 baja 資料定時器關閉
$("#app").load(`_${page}.html`, loadCallback);
})

View File

@ -127,7 +127,7 @@ class elevator3D {
this.ele = option.element;
this.viewer = option.viewer;
this.nodeId = option.nodeId;
this.speed = option.speed ?? 0.3;
this.speed = option.speed ?? 0.03;
this.fragProxys = [];
this.fragProxy = null;
this.initCallback = option.inited ?? null;
@ -138,7 +138,11 @@ class elevator3D {
}
setTreeFrag = function (callback) {
let tree = this.viewer.model.getData().instanceTree;
let tree = this.viewer?.model?.getData().instanceTree;
if (!tree) {
return;
}
let nodeId = this.nodeId;
if (nodeId) {
@ -191,22 +195,17 @@ class elevator3D {
let tree = this.viewer.model.getData().instanceTree;
let nodeId = this.nodeId;
let fragProxyZ = 0;
let movStatus = this.movStatus; // 0=no 1=up 2=down
let fragProxy = this.fragProxys.filter(x => x.nodeId == nodeId)[0]?.frag;
if (!fragProxy) {
return;
}
changeColor(nodeId);
console.log("movStatus:" + movStatus, "fragProxy.position.z:" + fragProxy.position.z.roundDecimal(2), "targetFloorZ:" + this.targetFloorZ.roundDecimal(2))
//if ((movStatus == 2 && fragProxy.position.z.roundDecimal(2) < this.targetFloorZ.roundDecimal(2)) ||
// (movStatus == 1 && fragProxy.position.z.roundDecimal(2) > this.targetFloorZ.roundDecimal(2)) ||
// fragProxy.position.z.roundDecimal(2) == this.targetFloorZ.roundDecimal(2)) {
// this.movStatus = 0;
// recoverTransparentBuilding();
// hideColor(nodeId);
// return;
//}
if ((this.movStatus == 2 && fragProxy.position.z.roundDecimal(2) < this.targetFloorZ.roundDecimal(2)) ||
(this.movStatus == 1 && fragProxy.position.z.roundDecimal(2) > this.targetFloorZ.roundDecimal(2)) ||
fragProxy.position.z.roundDecimal(2) == this.targetFloorZ.roundDecimal(2)) {
stoped(this);
}
//if (movStatus == 0) {
// recoverTransparentBuilding();
@ -224,10 +223,10 @@ class elevator3D {
let fragProxy = this.viewer.impl.getFragmentProxy(this.viewer.model, frag);
fragProxy.getAnimTransform();
//let fragPosition = new THREE.Vector3(0, 0, 15);// 一樓0 二樓15 三樓 26
if (movStatus == 2) {
if (this.movStatus == 2) {
fragProxy.position.z -= this.speed;
}
else if (movStatus == 1) {
else if (this.movStatus == 1) {
fragProxy.position.z += this.speed;
}
this.fragProxys.filter(x => x.nodeId == nodeId && x.fragId == frag)[0].frag.position.z = fragProxy.position.z;
@ -237,39 +236,37 @@ class elevator3D {
}, true);
this.viewer.impl.sceneUpdated(true);
setTransparentBuilding();
/*setTransparentBuilding();*/
let movElevator = $(this.ele)[0]._elevator3D.filter(x => x.nodeId == this.nodeId)[0]?.obj.movElevator.bind(this);
console.log("fragProxyZ:" + fragProxyZ, "targetFloorZ:" + this.targetFloorZ)
if (movStatus == 2) {
if (this.movStatus == 2) {
if (fragProxyZ >= this.targetFloorZ) {
requestAnimationFrame(() => {
movElevator();
});
} else {
this.movStatus = 0;
recoverTransparentBuilding();
hideColor(nodeId);
return;
stoped(this);
}
}
else if (movStatus == 1) {
else if (this.movStatus == 1) {
if (fragProxyZ <= this.targetFloorZ) {
requestAnimationFrame(() => {
movElevator();
});
} else {
this.movStatus = 0;
recoverTransparentBuilding();
stoped(this);
}
} else {
stoped(this);
}
function stoped(obj) {
obj.movStatus = 0;
/*recoverTransparentBuilding();*/
hideColor(nodeId);
return;
}
}
//let fragPosition = new THREE.Vector3(position);// 一樓0 二樓15 三樓 26
//fragProxy.position = fragPosition;
@ -561,11 +558,18 @@ function setTransparency(nodeId, opacity) {
}
function changeColor(nodeId) {//電梯變綠色
let instanceTree = viewer.model.getData().instanceTree;
instanceTree.enumNodeChildren(nodeId, function (chiNodeId) {
var color = new THREE.Vector4(0, 1, 0, 1);
viewer.setThemingColor(nodeId, color);
viewer.setThemingColor(chiNodeId, color);
},true)
}
function hideColor(nodeId) {//顏色改成透明
let instanceTree = viewer.model.getData().instanceTree;
instanceTree.enumNodeChildren(nodeId, function (chiNodeId) {
var color = new THREE.Vector4(0, 1, 0, 0);
viewer.setThemingColor(nodeId, color);
viewer.setThemingColor(chiNodeId, color);
},true)
}

View File

@ -430,8 +430,7 @@ function getUnCheckedAckedCountByBaja(callback) {
* @param {any} callback
*/
function getSystemAlarmByBaja(callback) {
var _result = "";
var _ss = "";
var _result = { count: 0, data: [] };
var _index = 0;
require(['baja!'], function (baja) {
@ -440,16 +439,14 @@ function getSystemAlarmByBaja(callback) {
.then(function (table) {
return table.cursor({
each: function (record) {
if (_index == 0)
_ss += '{"alarmClass":"' + record.get('alarmClass') + '"}';
else
_ss += ',{"alarmClass":"' + record.get('alarmClass') + '"}';
let main = {};
main.alarmClass = record.get('alarmClass');
_result.data.push(main);
_index++;
},
after: function () {
_result += '{' + '"count": ' + _index + ', "data":[';
_result += _ss;
_result += ']}';
_result.count = _index;
if (typeof callback === 'function') {
callback(_result);
}

View File

@ -155,7 +155,7 @@ function BajaSubscribeDevicesByBql() {
var target_device_number_split = this.getDisplay("slotPath").split('/');
var target_device_number = target_device_number_split[7];
var target_device_number = target_device_number_split[8];
//console.log(target_device_number);
var point_name = this.getDisplay("name");
var facets = this.getDisplay("facets");

View File

@ -237,8 +237,8 @@ function getElectricMeterHourDataByBaja(devicePath, company, startDateTime, endD
var _index = 0;
require(['baja!'], function (baja) {//TPE_B1_EE_E4_R2F_NA_WHT_N1_KWH
console.log("local:|foxs:|history:/" + company + "/" + devicePath + "?peroid=timerange;start=" + startDateTime + ".000+08:00;end=" + endDateTime + ".000+08:00;|bql:history:HistoryRollup.rollup(baja:RelTime '3600000')");
baja.Ord.make("local:|foxs:|history:/" + company + "/" + devicePath + "?peroid=timerange;start=" + startDateTime + ".000+08:00;end=" + endDateTime + ".000+08:00;|bql:history:HistoryRollup.rollup(baja:RelTime '3600000')").get()
console.log("local:|foxs:|history:/" + company + "/" + devicePath + "?peroid=timerange;start=" + startDateTime + ".000+08:00;end=" + endDateTime + ".000+08:00;delta=true|bql:history:HistoryRollup.rollup(baja:RelTime '3600000')");
baja.Ord.make("local:|foxs:|history:/" + company + "/" + devicePath + "?peroid=timerange;start=" + startDateTime + ".000+08:00;end=" + endDateTime + ".000+08:00;delta=true|bql:history:HistoryRollup.rollup(baja:RelTime '3600000')").get()
.then(function (table) {
return table.cursor({
each: function (record) {
@ -278,8 +278,8 @@ function getElectricMeterDayDataByBaja(devicePath, company, startDateTime, endDa
var _index = 0;
require(['baja!'], function (baja) {//TPE_B1_EE_E4_R2F_NA_WHT_N1_KWH
console.log("local:|foxs:|history:/" + company + "/" + devicePath + "?peroid=timerange;start=" + startDateTime + ".000+08:00;end=" + endDateTime + ".000+08:00;|bql:history:HistoryRollup.rollup(baja:RelTime '86400000')");
baja.Ord.make("local:|foxs:|history:/" + company + "/" + devicePath + "?peroid=timerange;start=" + startDateTime + ".000+08:00;end=" + endDateTime + ".000+08:00;|bql:history:HistoryRollup.rollup(baja:RelTime '86400000')").get()
console.log("local:|foxs:|history:/" + company + "/" + devicePath + "?peroid=timerange;start=" + startDateTime + ".000+08:00;end=" + endDateTime + ".000+08:00;delta=true|bql:history:HistoryRollup.rollup(baja:RelTime '86400000')");
baja.Ord.make("local:|foxs:|history:/" + company + "/" + devicePath + "?peroid=timerange;start=" + startDateTime + ".000+08:00;end=" + endDateTime + ".000+08:00;delta=true|bql:history:HistoryRollup.rollup(baja:RelTime '86400000')").get()
.then(function (table) {
table.cursor({
each: function (record) {

View File

@ -181,7 +181,7 @@ class ElevatorHandler {
this.eleWra = $("<div></div>");
this.speed = 0.3;
this.movStatus = {}; // {id:elevator01,value:0} 0=no 1=up 2=down
this.floorHeight = typeof option.fHeight == "undefined" ? 50 : option.fHeight;
this.floorHeight = typeof option.fHeight == "undefined" ? 60 : option.fHeight;
this.floorWidth = typeof option.fWidth == "undefined" ? 45 : option.fWidth;
this.floors = typeof option.floors == "undefined" ? [{}] : option.floors;
this.elevators = typeof option.elevators == "undefined" ? [{}] : option.elevators; // {id:elevator01}
@ -259,7 +259,7 @@ class ElevatorHandler {
}
else {
let div = creDiv(["d-flex", "justify-content-center", "align-items-end", "h-100"]);
div.append(`<i class="fas fa-door-open fs-1-05"></i>`)
div.append(`<i class="fal fa-door-open fs-1-2"></i>`)
td.append(div)
}
tr.append(td);

View File

@ -43,7 +43,12 @@ class YourTeamTab {
}
this.event();
$(`[data-tabname=${this.tabName}][data-tabrole=child]`).css("display", "none");
if ($(`[data-tabname=${this.tabName}][data-target].active`).length == 0) {
$(`[data-tabname=${this.tabName}][data-target]`).first().trigger("click");
} else {
$(`[data-tabname=${this.tabName}][data-target].active`).first().trigger("click");
}
_ytTabInited.push(this.tabName);
}

View File

@ -85,7 +85,7 @@ $.fn.YTTooltip = function (option) {
} else if (obj.direction == "right") {
left = offset.left + toolWidth + width > bodyWidth ? offset.left - toolWidth - 10 : offset.left + width + 10;
} else if (obj.direction == "bottom") {
top = offset.top + toolHeight + height > bodyHeight ? offset.top - toolHeight - 10 : offset.top + height + 10;
top = offset.top + toolHeight + height > bodyHeight ? offset.top + height + 10 : offset.top + height + 10;
} else if (obj.direction == "top") {
top = offset.top < toolHeight ? offset.top + height + 5 : offset.top - toolHeight - 10;
}