[Frontend][儀錶板] 左下角即時告警 baja 程序建置 | 點擊左下角卡片導至各作業頁面程序建置 | [儀錶板] 電梯訂閱程序建置 | [系統監控] 電梯頁面緊急迴轉增加兩點位 | 緊急迴轉點位燈號特殊邏輯建置 | 左方 3D 圖高度延展 | 平面圖向右放置 | Tooltip 因高度關係自動向上而看不到問題解決 | 3D圖 電梯含車廂變色程序串接 | [系統監控] 電錶畫面 Loading 程序調整

This commit is contained in:
dev01 2022-12-08 17:27:32 +08:00
parent 3d7fd0690e
commit 2fe739f37f
12 changed files with 380 additions and 129 deletions

View File

@ -240,11 +240,30 @@
var tarElePath = ''; var tarElePath = '';
var sysSubList = []; var sysSubList = [];
var floList = []; //每個樓層
var subSeviceData = []; //每個設備訂閱點位值
var allEleDevList = [];
var viewer3DNodeIds = [];
var elev3DBind = {};
var elev3DOption = {};
var elev3DObj = [];
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 () { $(document).ready(function () {
show3DModel(); show3DModel();
getSubList(); getSubList();
getElevData();
getFirstEletric(); getFirstEletric();
subDeviceSetStatus();
timeOutGetData();
}); });
// 從數字週數轉為中文週數 // 從數字週數轉為中文週數
@ -298,9 +317,10 @@
if (contest.indexOf(subSysObj.sub_system_tag) != -1) { if (contest.indexOf(subSysObj.sub_system_tag) != -1) {
sysSubList.push({ sysMainTag: mainSysObj.main_system_tag, sysSubTag: subSysObj.sub_system_tag }); 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}"> 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 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 type="button" class="btn btn-secondary">${subSysObj.full_name}</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>`; </div>`;
}) })
}) })
@ -503,6 +523,7 @@
options: eveDayElecChartOptions options: eveDayElecChartOptions
}) })
} }
// 圖表 - 這週與上週用電量 (折線圖) // 圖表 - 這週與上週用電量 (折線圖)
function chartEveWeeksElec(curWeekData, prevWeekData) { function chartEveWeeksElec(curWeekData, prevWeekData) {
@ -581,6 +602,7 @@
options: eveWeekElecChartOptions options: eveWeekElecChartOptions
}) })
} }
// 圖表 - 異常與賦歸圖表 (圓餅圖) // 圖表 - 異常與賦歸圖表 (圓餅圖)
function chartErrRec(labels,datas) { function chartErrRec(labels,datas) {
@ -660,58 +682,216 @@
options: errChkChartOptions options: errChkChartOptions
}) })
} }
//從 baja 訂閱 左下角各系統小類異常狀態
// 從 baja 訂閱 左下角各系統小類異常狀態
function getAlarmSub() { function getAlarmSub() {
var tipEle = ''; var tipEle = '';
//if (sysSubList.length != 0) { //if (sysSubList.length != 0) {
// tipEle = YT.Alert.Tip("資料讀取中...","show"); // tipEle = YT.Alert.Tip("資料讀取中...","show");
//} //}
$(`.data-group i.fa-lightbulb-on`).removeClass("blink"); /*$(`.dev-group i.fa-lightbulb-on`)*/
//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[data-id*='${devNum}'] i.fa-lightbulb-on`).addClass("blink"); getSystemAlarmByBaja((data) => {
// } console.log(data)
//}) $.each(data.data, (idx, alaObj) => {
//myBaja.setSubscribeAlarmEndCallBack((data) => { if (alaObj.alarmClass.indexOf("_") != -1) {
// console.log(idx,sysSubList.length) let mainSubSys = alaObj.alarmClass.split("_").slice(0, 2).join("/");
// if (idx == sysSubList.length - 1) { $(`.btn-group.dev-group[data-id*='${mainSubSys}'] i`).addClass("blink");
// $(tipEle.ele).YTAlert().hide(); }
// } })
//}) $(`.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() {
setInterval(() => {
getAlarmSub();
},3000)
}
function show3DModel() { function show3DModel() {
launchViewer(pageAct.urn, (viewer, nodeIds) => { 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> </script>

View File

@ -53,21 +53,21 @@
<div id="elevatorBlock" class="elevator"> <div id="elevatorBlock" class="elevator">
<div class="elevator-header"> <div class="elevator-header">
<div class="row m-0 align-items-center p-2 gap-3 btn-group btn-group-toggle"> <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 2D
</button> </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 3D
</button> </button>
</div> </div>
</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"> <div id="2dDiv" class="p-2" data-tabname="floShowType" data-tabrole="child">
<table id="floorTable" class="elevator-build m-auto"> <table id="floorTable" class="elevator-build m-auto">
</table> </table>
</div> </div>
<div id="3dDiv" class="w-100" data-tabname="floShowType" data-tabrole="child"> <div id="3dDiv" class="w-100 h-100 position-relative" data-tabname="floShowType" data-tabrole="child">
<div id="forgeViewer"></div> <div id="forgeViewer" style=""></div>
</div> </div>
</div> </div>
</div> </div>
@ -78,20 +78,20 @@
<!-- <img src="img/elevator.jpg" class="img-fluid" style="min-height: 520px" /> --> <!-- <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> </div>
<!-- End-左圖區 --> <!-- End-左圖區 -->
<!-- 中間卡片區 --> <!-- 中間卡片區 -->
<div class="col-6 my-3"> <div class="col-6 my-3">
<div id="eleCards" class="row"> <div id="eleCards" class="row col-12 p-0">
</div> </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> </div>
<!-- End-中間卡片區 --> <!-- End-中間卡片區 -->
<!-- 右邊功能區 --> <!-- 右邊功能區 -->
@ -186,6 +186,36 @@
<span id="earQuaCon" class="circle-light bg-secondary"></span> <span id="earQuaCon" class="circle-light bg-secondary"></span>
</div> </div>
</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> </div>
<!-- End-右邊功能區 --> <!-- End-右邊功能區 -->
<!-- Modal-Card1 --> <!-- 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) { if (allDevList.length == 0) {
return false; return false;
} }
@ -944,18 +989,27 @@
$(`#${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") {
actLightByPoi("FE", "#emerReturn"); //消防回歸
//群控故障 actLightByPoi("FE", "#emerReturn");
actLightByPoi("GCM", "#groConFail"); //群控故障
//緊急電源 actLightByPoi("GCM", "#groConFail");
actLightByPoi("EPS", "#emerPower"); //緊急電源
//火災回歸 actLightByPoi("EPS", "#emerPower");
actLightByPoi("FER", "#fireReturn"); //火災回歸
//地震管制 actLightByPoi("FER", "#fireReturn");
actLightByPoi("EER", "#earQuaCon"); //地震管制
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 //將訂閱值塞入 subSeviceData
if (subSeviceData.findIndex(x => x.device_number == matchDevice.device_number) == -1) { if (subSeviceData.findIndex(x => x.device_number == matchDevice.device_number) == -1) {
@ -980,7 +1034,7 @@
// 電梯管理 不服務樓層 detail // 電梯管理 不服務樓層 detail
subDeviceSetEleManNotSerFloor(master); subDeviceSetEleManNotSerFloor(master);
} catch (e) { } catch (e) {
console.log("e",e) console.log("e", e)
} }
}); });
myBaja.setSubscribeDeviceEndCallBack(function (data) { myBaja.setSubscribeDeviceEndCallBack(function (data) {
@ -1119,7 +1173,7 @@
if (isFirstLoad3D == false && elev3DObj.length != 0) { if (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 && elevObj.id) { if (elevObj && elevObj.id) {
elevObj.obj.setElevatorFloor(subData["CP"]) elevObj.obj.setElevatorFloor(subData["CP"])
@ -1297,7 +1351,7 @@
{ id: "vip", text: "VIP" }, { id: "vip", text: "VIP" },
{ id: "onlyRun", text: "獨立運轉" }, { id: "onlyRun", text: "獨立運轉" },
{ id: "manual", text: "手動" }, { id: "manual", text: "手動" },
{ id: "runOpe", text: "運轉保養" }, { id: "runOpe", text: "保養運轉" },
{ id: "returnFin", text: "回歸完了" }, { id: "returnFin", text: "回歸完了" },
{ id: "notSerFloor", text: "不服務樓層" }, { id: "notSerFloor", text: "不服務樓層" },
]; ];
@ -1766,7 +1820,7 @@
min: 1 min: 1
}, },
layoutSize: '100%', layoutSize: '100%',
layoutCenter: [], layoutCenter: ['40%','50%'],
zoom: 1.2, zoom: 1.2,
silent: true silent: true
}, },

View File

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

View File

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

View File

@ -109,7 +109,15 @@ input.toggle:checked {
width: 100%; width: 100%;
height: 100vh; height: 100vh;
position: fixed; position: fixed;
z-index: 2000; z-index: 3000;
}
.dropdown-menu {
z-index:3000;
}
.adsk-viewing-viewer {
top:0px;
} }
.lds-ring { .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>系統監控 <i class="fal fa-tv fa-2x"></i><br>系統監控
</a> </a>
<div class="dropdown-menu dropdown-select-menu js-auto-close" id="sysMonBtnList"> <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> </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"> <div class="btn-group mx-4">
<a href="javascript:;" name="topFunBtn" class="dropdown-toggle no-arrow text-center" <a href="javascript:;" name="topFunBtn" class="dropdown-toggle no-arrow text-center"
data-page="historyData"> data-page="historyData">

View File

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

View File

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

View File

@ -155,7 +155,7 @@ function BajaSubscribeDevicesByBql() {
var target_device_number_split = this.getDisplay("slotPath").split('/'); 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); //console.log(target_device_number);
var point_name = this.getDisplay("name"); var point_name = this.getDisplay("name");
var facets = this.getDisplay("facets"); var facets = this.getDisplay("facets");

View File

@ -181,7 +181,7 @@ class ElevatorHandler {
this.eleWra = $("<div></div>"); this.eleWra = $("<div></div>");
this.speed = 0.3; this.speed = 0.3;
this.movStatus = {}; // {id:elevator01,value:0} 0=no 1=up 2=down 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.floorWidth = typeof option.fWidth == "undefined" ? 45 : option.fWidth;
this.floors = typeof option.floors == "undefined" ? [{}] : option.floors; this.floors = typeof option.floors == "undefined" ? [{}] : option.floors;
this.elevators = typeof option.elevators == "undefined" ? [{}] : option.elevators; // {id:elevator01} this.elevators = typeof option.elevators == "undefined" ? [{}] : option.elevators; // {id:elevator01}
@ -259,7 +259,7 @@ class ElevatorHandler {
} }
else { else {
let div = creDiv(["d-flex", "justify-content-center", "align-items-end", "h-100"]); 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) td.append(div)
} }
tr.append(td); tr.append(td);

View File

@ -43,7 +43,12 @@ class YourTeamTab {
} }
this.event(); this.event();
$(`[data-tabname=${this.tabName}][data-tabrole=child]`).css("display", "none"); $(`[data-tabname=${this.tabName}][data-tabrole=child]`).css("display", "none");
$(`[data-tabname=${this.tabName}][data-target]`).first().trigger("click"); 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); _ytTabInited.push(this.tabName);
} }

View File

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