歷史資料
- +
@@ -33,7 +33,7 @@
-
+
@@ -52,7 +52,7 @@
@@ -72,7 +72,7 @@
var historyTable = null;
$(function () {
initList();
-
+
// default list filter
initApp.listFilter($('#js_default_list'), $('#js_default_list_filter'));
// custom response message
@@ -90,21 +90,21 @@
onEvent('change', '#his_startdate', function () {
let today = displayDate(new Date(Date.now()), 'date').replaceAll('/', '-');
- let ytd = displayDate(new Date(new Date().setDate(new Date(Date.now()).getDate() - 1)), 'date').replaceAll('/', '-');
+ let ytd = displayDate(new Date(new Date().setDate(new Date(Date.now()).getDate() - 1)), 'date').replaceAll('/', '-');
if (pageAct.dateType == 'range') {
if ($('#his_startdate').val() > $('#his_enddate input').val() && ($('#his_startdate').val() != "" && $('#his_enddate input').val() != "")) {
- $('#his_startdate').val($('#his_startdate').data('val'));
- toast_error('不可選擇大於結束時間');
- }
- else {
- $('#his_startdate').data('val', $('#his_startdate').val());
+ $('#his_startdate').val($('#his_startdate').data('val'));
+ toast_error('不可選擇大於結束時間');
+ }
+ else {
+ $('#his_startdate').data('val', $('#his_startdate').val());
$('#his_enddate input').data('val', $('#his_enddate input').val());
- $(`[onclick="setDateType('today', this)"]`).addClass('btn-secondary');
- $(`[onclick="setDateType('today', this)"]`).removeClass('btn-info');
- $(`[onclick="setDateType('ytd', this)"]`).addClass('btn-secondary');
- $(`[onclick="setDateType('ytd', this)"]`).removeClass('btn-info');
+ $(`[onclick="setDateType('today', this)"]`).addClass('btn-secondary');
+ $(`[onclick="setDateType('today', this)"]`).removeClass('btn-info');
+ $(`[onclick="setDateType('ytd', this)"]`).addClass('btn-secondary');
+ $(`[onclick="setDateType('ytd', this)"]`).removeClass('btn-info');
if ($('#his_startdate').val() == $('#his_enddate input').val()) {
if ($('#his_startdate').val() == today) {
@@ -112,55 +112,55 @@
$(`[onclick="setDateType('today', this)"]`).addClass('btn-info');
}
else if ($('#his_startdate').val() == ytd) {
- $(`[onclick="setDateType('ytd', this)"]`).removeClass('btn-secondary');
- $(`[onclick="setDateType('ytd', this)"]`).addClass('btn-info');
- }
- }
- }
- }
+ $(`[onclick="setDateType('ytd', this)"]`).removeClass('btn-secondary');
+ $(`[onclick="setDateType('ytd', this)"]`).addClass('btn-info');
+ }
+ }
+ }
+ }
else if ($(this).val() == today) {
$(`[onclick="setDateType('today', this)"]`).removeClass('btn-secondary');
$(`[onclick="setDateType('today', this)"]`).addClass('btn-info');
- $(`[onclick="setDateType('ytd', this)"]`).addClass('btn-secondary');
- $(`[onclick="setDateType('ytd', this)"]`).removeClass('btn-info');
+ $(`[onclick="setDateType('ytd', this)"]`).addClass('btn-secondary');
+ $(`[onclick="setDateType('ytd', this)"]`).removeClass('btn-info');
}
else if ($(this).val() == ytd) {
- $(`[onclick="setDateType('today', this)"]`).addClass('btn-secondary');
- $(`[onclick="setDateType('today', this)"]`).removeClass('btn-info');
+ $(`[onclick="setDateType('today', this)"]`).addClass('btn-secondary');
+ $(`[onclick="setDateType('today', this)"]`).removeClass('btn-info');
$(`[onclick="setDateType('ytd', this)"]`).removeClass('btn-secondary');
$(`[onclick="setDateType('ytd', this)"]`).addClass('btn-info');
}
});
- onEvent('change', '#his_enddate input', function () {
- let today = displayDate(new Date(Date.now()), 'date').replaceAll('/', '-');
- let ytd = displayDate(new Date(new Date().setDate(new Date(Date.now()).getDate() - 1)), 'date').replaceAll('/', '-');
-
+ onEvent('change', '#his_enddate input', function () {
+ let today = displayDate(new Date(Date.now()), 'date').replaceAll('/', '-');
+ let ytd = displayDate(new Date(new Date().setDate(new Date(Date.now()).getDate() - 1)), 'date').replaceAll('/', '-');
+
if ($('#his_startdate').val() > $('#his_enddate input').val() && ($('#his_startdate').val() != "" && $('#his_enddate input').val() != "")) {
- $('#his_enddate input').val($('#his_enddate input').data('val'));
- toast_error('不可選擇大於結束時間');
- }
- else {
- $('#his_startdate').data('val', $('#his_startdate').val());
- $('#his_enddate input').data('val', $('#his_enddate input').val());
+ $('#his_enddate input').val($('#his_enddate input').data('val'));
+ toast_error('不可選擇大於結束時間');
+ }
+ else {
+ $('#his_startdate').data('val', $('#his_startdate').val());
+ $('#his_enddate input').data('val', $('#his_enddate input').val());
- $(`[onclick="setDateType('today', this)"]`).addClass('btn-secondary');
- $(`[onclick="setDateType('today', this)"]`).removeClass('btn-info');
- $(`[onclick="setDateType('ytd', this)"]`).addClass('btn-secondary');
- $(`[onclick="setDateType('ytd', this)"]`).removeClass('btn-info');
+ $(`[onclick="setDateType('today', this)"]`).addClass('btn-secondary');
+ $(`[onclick="setDateType('today', this)"]`).removeClass('btn-info');
+ $(`[onclick="setDateType('ytd', this)"]`).addClass('btn-secondary');
+ $(`[onclick="setDateType('ytd', this)"]`).removeClass('btn-info');
- if ($('#his_startdate').val() == $('#his_enddate input').val()) {
- if ($('#his_startdate').val() == today) {
- $(`[onclick="setDateType('today', this)"]`).removeClass('btn-secondary');
- $(`[onclick="setDateType('today', this)"]`).addClass('btn-info');
- }
- else if ($('#his_startdate').val() == ytd) {
- $(`[onclick="setDateType('ytd', this)"]`).removeClass('btn-secondary');
- $(`[onclick="setDateType('ytd', this)"]`).addClass('btn-info');
- }
- }
- }
- });
+ if ($('#his_startdate').val() == $('#his_enddate input').val()) {
+ if ($('#his_startdate').val() == today) {
+ $(`[onclick="setDateType('today', this)"]`).removeClass('btn-secondary');
+ $(`[onclick="setDateType('today', this)"]`).addClass('btn-info');
+ }
+ else if ($('#his_startdate').val() == ytd) {
+ $(`[onclick="setDateType('ytd', this)"]`).removeClass('btn-secondary');
+ $(`[onclick="setDateType('ytd', this)"]`).addClass('btn-info');
+ }
+ }
+ }
+ });
});
function initList() {
@@ -176,19 +176,19 @@
$.each(res.data.history_Main_Systems, function (index, val) {
if (pageAct.mainStatus) {
strHtml += `
-
+
${val.full_name}
`;
});
if (pageAct.mainStatus) {
- strHtml += ` `;
- }
+ strHtml += ` `;
+ }
});
$('#js_nested_list').html(strHtml);
@@ -237,54 +237,54 @@
function devPointsList() {
let sendData = {
- device_number: pageAct.deviceNumber
- }
- objSendData.Data = sendData;
- let url = baseApiUrl + "/api/History/GetDevPoi";
+ device_number: pageAct.deviceNumber
+ }
+ objSendData.Data = sendData;
+ let url = baseApiUrl + "/api/History/GetDevPoi";
function success(res) {
let strHtml = ``;
-
+
$.each(res.data, function (index, val) {
if (index == 0) {
- strHtml += ``;
+ strHtml += ``;
pageAct.deviceItem = val.points;
pageAct.devicePoiName = val.full_name + ' ' + val.points;
pageAct.deviceComName = val.parent_path;
getData();
} else {
- strHtml += ``;
- }
+ strHtml += ``;
+ }
});
$('#devPointsList').html(strHtml);
- }
- ytAjax = new YourTeam.Ajax(url, objSendData, success, null, "POST").send();
- }
+ }
+ ytAjax = new YourTeam.Ajax(url, objSendData, success, null, "POST").send();
+ }
function getData(start = null, end = null) {
var sdt = new Date();
- var edt = new Date(new Date().setDate(sdt.getDate() + 1));
+ var edt = new Date(new Date().setDate(sdt.getDate() + 1));
start = start ?? sdt.toLocaleDateString();
end = end ?? edt.toLocaleDateString();
$(loadEle).Loading("start");
callBackFromHistory()
getHistoryDataByBaja(pageAct.deviceNumber + "_" + pageAct.deviceItem,
- new Date(start).getTime(),
- new Date(end).getTime(),
- pageAct.deviceName,
- pageAct.deviceComName,
- callBackFromHistory);
+ new Date(start).getTime(),
+ new Date(end).getTime(),
+ pageAct.deviceName,
+ pageAct.deviceComName,
+ callBackFromHistory);
}
- function callBackFromHistory(res='{"count":0,"data":[]}') {
+ function callBackFromHistory(res = '{"count":0,"data":[]}') {
// console.log("@H1",res)
res = JSON.parse(res);
// console.log("@history",res.data)
loadTable(res.data);
if (historyTable != null) {
let t = $('#historyTable').dataTable();
-
- t.fnClearTable();
+
+ t.fnClearTable();
if (res.data.length > 0)
t.fnAddData(res.data);
}
@@ -303,7 +303,7 @@
pageAct.devicePoiName = $(elem).text();
pageAct.deviceItem = deviceItem;
getData();
- }
+ }
}
function setDateType(type, elem) {
@@ -320,31 +320,31 @@
$('#his_enddate').css('display', 'none');
$('#getmonth').css('display', 'none');
$('#his_startdate').val(date);
-
+
if (type == "today")
getData(formatDate(now, "date", true), formatDate(tmr, "date", true));
else if (type == "ytd")
getData(formatDate(ytd, "date", true), formatDate(now, "date", true));
else {
- $(`[onclick="setDateType('today', this)"]`).removeClass('btn-secondary');
- $(`[onclick="setDateType('today', this)"]`).addClass('btn-info');
- }
+ $(`[onclick="setDateType('today', this)"]`).removeClass('btn-secondary');
+ $(`[onclick="setDateType('today', this)"]`).addClass('btn-info');
+ }
}
else if (type == "range") {
- $(`[onclick="setDateType('today', this)"], [onclick="setDateType('ytd', this)"]`).removeClass('btn-info');
- $(`[onclick="setDateType('today', this)"], [onclick="setDateType('ytd', this)"]`).addClass('btn-secondary');
+ $(`[onclick="setDateType('today', this)"], [onclick="setDateType('ytd', this)"]`).removeClass('btn-info');
+ $(`[onclick="setDateType('today', this)"], [onclick="setDateType('ytd', this)"]`).addClass('btn-secondary');
$('#his_startdate').css('display', 'block');
$('#his_enddate').css('display', 'block');
$('#getmonth').css('display', 'none');
$('#his_startdate').val(now);
- $('#his_startdate').data('val', now);
+ $('#his_startdate').data('val', now);
$('#his_enddate input').val(tmr);
$('#his_enddate input').data('val', tmr);
}
else if (type == "month") {
- $(`[onclick="setDateType('today', this)"], [onclick="setDateType('ytd', this)"]`).removeClass('btn-info');
- $(`[onclick="setDateType('today', this)"], [onclick="setDateType('ytd', this)"]`).addClass('btn-secondary');
+ $(`[onclick="setDateType('today', this)"], [onclick="setDateType('ytd', this)"]`).removeClass('btn-info');
+ $(`[onclick="setDateType('today', this)"], [onclick="setDateType('ytd', this)"]`).addClass('btn-secondary');
$('#his_startdate').css('display', 'none');
$('#his_enddate').css('display', 'none');
@@ -352,8 +352,8 @@
$('#getmonth').val(now.substr(0, 7));
}
else if (type == "ytd") {
- $('#his_startdate').css('display', 'block');
- $('#his_enddate').css('display', 'none');
+ $('#his_startdate').css('display', 'block');
+ $('#his_enddate').css('display', 'none');
$('#getmonth').css('display', 'none');
$('#his_startdate').val(ytd);
}
@@ -361,11 +361,11 @@
function searchDate() {
let start = new Date($('#his_startdate').val());
- let end = new Date(new Date().setDate(new Date($('#his_enddate input').val()).getDate() + 1));
-
+ let end = new Date(new Date().setDate(new Date($('#his_enddate input').val()).getDate() + 1));
+
if (pageAct.dateType == "day")
end = new Date(new Date().setDate(start.getDate() + 1));
- else if (pageAct.dateType == "month") {
+ else if (pageAct.dateType == "month") {
start = new Date($('#getmonth').val());
end = new Date(new Date().setDate(start.getDate() + 30));
}
@@ -382,72 +382,72 @@
date = displayDate(date, type);
let month = date.split('/')[1];
let year = date.split('/')[0];
- let day= date.split('/')[2];
+ let day = date.split('/')[2];
return month + "/" + day + "/" + year;
- }
+ }
}
function loadTable(data) {
if (data) {
$.each(data, function (i, v) {
// console.log("loadTable",pageAct.devicePoiName.split(" ")[0])
- v.type = pageAct.devicePoiName.split(" ")[0];
+ v.type = pageAct.devicePoiName.split(" ")[0];
});
}
- let tag = "#historyTable";
-
- let column_defs = [
- { "targets": [0], "width": "20%", "sortable": true },
- { "targets": [1], "width": "20%", "sortable": true },
+ let tag = "#historyTable";
+
+ let column_defs = [
+ { "targets": [0], "width": "20%", "sortable": true },
+ { "targets": [1], "width": "20%", "sortable": true },
{ "targets": [2], "width": "20%", "sortable": true }
- ];
+ ];
let columns = [
{
"title": "類別",
"data": "type"
},
- {
- "title": "設備名稱",
- "data": "deviceName",
- },
- {
- "title": "數值",
+ {
+ "title": "設備名稱",
+ "data": "deviceName",
+ },
+ {
+ "title": "數值",
"data": "value",
"render": function (data) {
- if(isNaN(data)){
+ if (isNaN(data.toString())) {
return data
}
return data.roundDecimal(2);
}
- },
- {
- "title": "紀錄時間",
+ },
+ {
+ "title": "紀錄時間",
"data": "timestamp",
"render": function (data) {
// console.log(data)
- return displayDate(data, "datetime");
- }
+ return displayDate(data, "datetime");
+ }
}
];
- historyTable = new YourTeam.JqDataTables.getTableByStatic(tag, data, columns, column_defs, null, null, null, null, "tpi");
+ historyTable = new YourTeam.JqDataTables.getTableByStatic(tag, data, columns, column_defs, null, null, null, null, "tpi");
}
function exportExcel() {
let url = baseApiUrl + "/History/OpeExportExcel";
objSendData.Data = $('#historyTable').dataTable().fnGetData();
-
+
$.each(objSendData.Data, function (i, v) {
- v.starttime = (pageAct.dateType == "month" ? new Date($('#getmonth').val()) : new Date($('#his_startdate').val()));
+ v.starttime = (pageAct.dateType == "month" ? new Date($('#getmonth').val()) : new Date($('#his_startdate').val()));
v.endtime = $('#his_enddate input').val() === "" ? null : new Date($('#his_enddate input').val());
v.dateType = pageAct.dateType;
});
ytAjax = new YourTeam.Ajax(url, objSendData, function (rel) {
if (rel.code == "0000")
- location.href = baseApiUrl + "/api/df?path=" + rel.data.split('/')[0] + "&fileName=" + rel.data.split('/')[1] + "&token=" + cookies.get("JWT-Authorization");
+ location.href = baseApiUrl + "/api/df?path=" + rel.data.split('/')[0] + "&fileName=" + rel.data.split('/')[1] + "&token=" + cookies.get("JWT-Authorization");
}, null, "POST").send();
}
\ No newline at end of file
diff --git a/Frontend/_sysElevator.html b/Frontend/_sysElevator.html
index fb6c8b4..946f971 100644
--- a/Frontend/_sysElevator.html
+++ b/Frontend/_sysElevator.html
@@ -1063,7 +1063,7 @@
// 電梯管理 detail
subDeviceSetEleManDet(matchDevice.device_number);
// 電梯管理 不服務樓層 detail
- subDeviceSetEleManNotSerFloor(master);
+ //subDeviceSetEleManNotSerFloor(master);
}
diff --git a/Frontend/_sysMonAll.html b/Frontend/_sysMonAll.html
index 82dac73..6c1e372 100644
--- a/Frontend/_sysMonAll.html
+++ b/Frontend/_sysMonAll.html
@@ -1,689 +1,871 @@
-
+
-
\ No newline at end of file
+
diff --git a/Frontend/index.html b/Frontend/index.html
index b92f6b1..5aec7d2 100644
--- a/Frontend/index.html
+++ b/Frontend/index.html
@@ -812,7 +812,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
/*"lib/jquery-validation/dist/additional-methods.min",*/ /* 會影響 messages_zh_TW 文字呈現 */
"lib/jquery-validation/dist/localization/messages_zh_TW",
"lib/jquery-ui/jquery-ui.min",
- "lib/chart.js/chart.min",
+ "lib/chart.js_4.1.2/chart.umd",
"lib/dropzone/dropzone-min",
"lib/jstree-master/jstree.min",
"lib/notifications/sweetalert2/sweetalert2.bundle",
@@ -1403,7 +1403,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
function controlFocusHotspot(dbId, open = true) {
// console.log("dbId", alarmDbIdList,dbId)
- changeColorForHotspot(dbId, open ? "focus" : null);
+ pageAct.sysSubTag !== "L1" && changeColorForHotspot(dbId, open ? "focus" : null);
changeScaleForHotspot(dbId, open);
}
diff --git a/Frontend/js/forge/forgemodel.js b/Frontend/js/forge/forgemodel.js
index 765f1ff..a0bdaf6 100644
--- a/Frontend/js/forge/forgemodel.js
+++ b/Frontend/js/forge/forgemodel.js
@@ -6,37 +6,41 @@ var elevatorSpeed;
var selector = "#forgeViewer";
var myDataList;
var lightDataList;
-var lightList = [];//燈光清單
-var levels;//剖面用
-var lowerIdx = 0;//剖面的下方樓層
-var upperIdx = 0;//剖面的上方樓層
+var lightList = []; //燈光清單
+var levels; //剖面用
+var lowerIdx = 0; //剖面的下方樓層
+var upperIdx = 0; //剖面的上方樓層
function launchViewer(urn, callback, failCallback, _selector = "#forgeViewer") {
selector = _selector;
var options = {
- env: 'AutodeskProduction',
+ env: "AutodeskProduction",
getAccessToken: getForgeToken,
settings: {
ambientShadows: false,
- groundShadows: false
- }
+ groundShadows: false,
+ },
};
Autodesk.Viewing.Initializer(options, () => {
viewer = new Autodesk.Viewing.GuiViewer3D($(selector)[0]);
//viewer = new Autodesk.Viewing.Viewer3D(document.getElementById('forgeViewer'));
viewer.start();
- var documentId = 'urn:' + urn;
+ var documentId = "urn:" + urn;
- Autodesk.Viewing.Document.load(documentId, onDocumentLoadSuccess, onDocumentLoadFailure);
+ Autodesk.Viewing.Document.load(
+ documentId,
+ onDocumentLoadSuccess,
+ onDocumentLoadFailure
+ );
setShadowShow();
$(selector).on("autodesk:loaded", function (e, nodeIds) {
callback ? callback(viewer, nodeIds) : "";
- })
+ });
$(selector).on("autodesk:loaded:fail", function (e) {
failCallback ? failCallback(viewer) : "";
- })
+ });
//test
// for (let i = 0; i < urn.length; i++) {
@@ -59,98 +63,116 @@ function launchViewer(urn, callback, failCallback, _selector = "#forgeViewer") {
// }
//loadHeatmaps(viewer.getAllModels()[0]); //!<<< equals to viewer.model
-
-
-
});
}
-function launchViewerForHotspot(urn, callback, failCallback, _selector = "#forgeViewer") {
+function launchViewerForHotspot(
+ urn,
+ callback,
+ failCallback,
+ _selector = "#forgeViewer"
+) {
selector = _selector;
var av = Autodesk.Viewing;
var options = {
- env: 'AutodeskProduction',
+ env: "AutodeskProduction",
getAccessToken: getForgeToken,
settings: {
ambientShadows: false,
- groundShadows: false
- }
+ groundShadows: false,
+ },
};
Autodesk.Viewing.Initializer(options, () => {
viewer = new Autodesk.Viewing.GuiViewer3D($(selector)[0]);
viewer.start();
- var documentId = 'urn:' + urn;
+ var documentId = "urn:" + urn;
viewer.addEventListener(av.GEOMETRY_LOADED_EVENT, addHotPoint, {
once: true,
});
- Autodesk.Viewing.Document.load(documentId, onDocumentLoadSuccess, onDocumentLoadFailure);
+ Autodesk.Viewing.Document.load(
+ documentId,
+ onDocumentLoadSuccess,
+ onDocumentLoadFailure
+ );
setShadowShow();
$(selector).on("autodesk:loaded", function (e, nodeIds) {
callback ? callback(viewer, nodeIds) : "";
- })
+ });
$(selector).on("autodesk:loaded:fail", function (e) {
failCallback ? failCallback(viewer) : "";
- })
+ });
});
}
-function launchViewerNoTools(urn, callback, failCallback, _selector = "#forgeViewer") {
+function launchViewerNoTools(
+ urn,
+ callback,
+ failCallback,
+ _selector = "#forgeViewer"
+) {
selector = _selector;
var options = {
- env: 'AutodeskProduction',
+ env: "AutodeskProduction",
getAccessToken: getForgeToken,
settings: {
ambientShadows: false,
- groundShadows: false
- }
+ groundShadows: false,
+ },
};
Autodesk.Viewing.Initializer(options, () => {
//viewer = new Autodesk.Viewing.GuiViewer3D(document.getElementById('forgeViewer'));
viewer = new Autodesk.Viewing.Viewer3D($(selector)[0]);
viewer.start();
- var documentId = 'urn:' + urn;
+ var documentId = "urn:" + urn;
- Autodesk.Viewing.Document.load(documentId, onDocumentLoadSuccess, onDocumentLoadFailure);
+ Autodesk.Viewing.Document.load(
+ documentId,
+ onDocumentLoadSuccess,
+ onDocumentLoadFailure
+ );
setShadowShow();
$(selector).on("autodesk:loaded", function (e, nodeIds) {
callback ? callback(viewer, nodeIds) : "";
- })
+ });
$(selector).on("autodesk:loaded:fail", function (e) {
failCallback ? failCallback(viewer) : "";
- })
+ });
});
}
function getAllLeafComponents(viewer, callback) {
var cbCount = 0;
var tree;
- var jsData = []
+ var jsData = [];
function getLeafComponentsRec(current, parent) {
cbCount++;
if (tree.getChildCount(current) != 0) {
- tree.enumNodeChildren(current, function (children) {
- getLeafComponentsRec(children, current);
- }, false);
+ tree.enumNodeChildren(
+ current,
+ function (children) {
+ getLeafComponentsRec(children, current);
+ },
+ false
+ );
}
- var nodeName = viewer.model.getInstanceTree().getNodeName(current)
- jsData.push({ id: current, parent: parent, text: nodeName })
+ var nodeName = viewer.model.getInstanceTree().getNodeName(current);
+ jsData.push({ id: current, parent: parent, text: nodeName });
if (--cbCount == 0) callback(jsData);
}
viewer.getObjectTree(function (objectTree) {
tree = objectTree;
- var rootId = tree.getRootId()
- var nodeName = viewer.model.getInstanceTree().getNodeName(rootId)
- jsData.push({ id: rootId, parent: '#', text: nodeName })
- var allLeafComponents = getLeafComponentsRec(rootId, '#');
-
+ var rootId = tree.getRootId();
+ var nodeName = viewer.model.getInstanceTree().getNodeName(rootId);
+ jsData.push({ id: rootId, parent: "#", text: nodeName });
+ var allLeafComponents = getLeafComponentsRec(rootId, "#");
});
}
@@ -177,17 +199,21 @@ class elevator3D {
// 定義結果陣列
let result = [];
// 使用 InstanceTree.enumNodeFragments 遍歷模型中的所有片段
- this.viewer?.model?.getData().instanceTree.enumNodeFragments(nodeId, (fragId) => {
- // 將遍歷到的片段 ID 添加到結果陣列中
- result.push(fragId);
- }, (nodeId) => {
- // 如果遍歷到的節點是葉節點,则返回 true,表示繼續遍歷該節點的片段
- return model.getData().instanceTree.isLeaf(nodeId);
- });
+ this.viewer?.model?.getData().instanceTree.enumNodeFragments(
+ nodeId,
+ (fragId) => {
+ // 將遍歷到的片段 ID 添加到結果陣列中
+ result.push(fragId);
+ },
+ (nodeId) => {
+ // 如果遍歷到的節點是葉節點,则返回 true,表示繼續遍歷該節點的片段
+ return model.getData().instanceTree.isLeaf(nodeId);
+ }
+ );
// 将结果陣列作為参数调用 resolve 函数
resolve(result);
});
- }
+ };
// 設置樹狀結構中片段
setTreeFrag = async function (callback) {
@@ -200,30 +226,34 @@ class elevator3D {
if (nodeId) {
// 刪除 fragmentProxys 中與當前 nodeId 相同的項目
- this.fragProxys.filter(x => x.nodeId == nodeId).forEach((x) => {
- let idx = this.fragProxys.indexOf(x);
- this.fragProxys.splice(idx, 1);
- })
+ this.fragProxys
+ .filter((x) => x.nodeId == nodeId)
+ .forEach((x) => {
+ let idx = this.fragProxys.indexOf(x);
+ this.fragProxys.splice(idx, 1);
+ });
// 遍歷當前 nodeId 中的所有片段
let fragments = await this.enumFragments(nodeId);
fragments.forEach((frag) => {
// 取得當前片段的 FragmentProxy 物件
- let fragProxy = this.viewer.impl.getFragmentProxy(this.viewer.model, frag);
+ let fragProxy = this.viewer.impl.getFragmentProxy(
+ this.viewer.model,
+ frag
+ );
// 將當前片段的信息添加到 fragProxys 陣列中
this.fragProxys.push({ nodeId: nodeId, fragId: frag, frag: fragProxy });
// 取得當前片段的動畫變換矩陣
fragProxy.getAnimTransform();
// 定義當前片段的位置向量
- let fragPosition = new THREE.Vector3(0, 0, 0);// 一樓0 二樓15 三樓 26
+ let fragPosition = new THREE.Vector3(0, 0, 0); // 一樓0 二樓15 三樓 26
// 設置當前片段的位置
fragProxy.position = fragPosition;
// 更新當前片段的動畫變換矩陣
fragProxy.updateAnimTransform();
- })
-
+ });
}
// 通知檢視器更新場景
this.viewer.impl.sceneUpdated(true);
@@ -241,43 +271,54 @@ class elevator3D {
this.initCallback ? this.initCallback() : "";
callback ? callback() : "";
- }
+ };
init = function (callback = null) {
this.setTreeFrag(callback);
- }
+ };
setElevatorFloor = function (floor) {
- this.targetFloorZ = this.floorHeight.filter(x => x.floor == floor)[0]?.height ?? 0;
- }
+ this.targetFloorZ =
+ this.floorHeight.filter((x) => x.floor == floor)[0]?.height ?? 0;
+ };
- setElevatorSpeed = function (speed) { //0.01 ~ 1
+ setElevatorSpeed = function (speed) {
+ //0.01 ~ 1
this.speed = speed;
- }
+ };
// 電梯移動
movElevator = async function () {
let nodeId = this.nodeId;
- let fragProxyZ = 0; // 定義 fragProxyZ 變量,用於存儲當前片段的 z 坐標
+ let fragProxyZ = 0; // 定義 fragProxyZ 變量,用於存儲當前片段的 z 坐標
// 取得當前 nodeId 的片段代理對象
- let fragProxy = this.fragProxys.filter(x => x.nodeId == nodeId)[0]?.frag;
+ let fragProxy = this.fragProxys.filter((x) => x.nodeId == nodeId)[0]?.frag;
if (!fragProxy) {
return;
}
changeColor(nodeId);
- 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)) {
+ 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 (fragProxy.position.z.roundDecimal(2) > this.targetFloorZ.roundDecimal(2)) {
+ if (
+ fragProxy.position.z.roundDecimal(2) > this.targetFloorZ.roundDecimal(2)
+ ) {
this.movStatus = 2;
- }
- else if (fragProxy.position.z.roundDecimal(2) < this.targetFloorZ.roundDecimal(2)) {
+ } else if (
+ fragProxy.position.z.roundDecimal(2) < this.targetFloorZ.roundDecimal(2)
+ ) {
this.movStatus = 1;
}
@@ -285,31 +326,37 @@ class elevator3D {
let fragments = await this.enumFragments(nodeId);
fragments.forEach((frag) => {
- let fragProxy = this.viewer.impl.getFragmentProxy(this.viewer.model, frag);
+ let fragProxy = this.viewer.impl.getFragmentProxy(
+ this.viewer.model,
+ frag
+ );
fragProxy.getAnimTransform();
if (this.movStatus == 2) {
fragProxy.position.z -= this.speed;
- }
- else if (this.movStatus == 1) {
+ } else if (this.movStatus == 1) {
fragProxy.position.z += this.speed;
}
- let tarFrag = this.fragProxys.filter(x => x.nodeId == nodeId && x.fragId == frag)[0];
+ let tarFrag = this.fragProxys.filter(
+ (x) => x.nodeId == nodeId && x.fragId == frag
+ )[0];
if (tarFrag) {
tarFrag.frag.position.z = fragProxy.position.z;
}
fragProxyZ = fragProxy.position.z;
// 改變感測器熱點位置
- this.sensorObjs && this.sensorObjs[0]?.changePos(nodeId + 2, fragProxyZ)
+ this.sensorObjs && this.sensorObjs[0]?.changePos(nodeId + 2, fragProxyZ);
// if(nodeId === 15200) {
// }
- fragProxy.updateAnimTransform()
- })
+ fragProxy.updateAnimTransform();
+ });
this.viewer.impl.sceneUpdated(true);
- 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);
if (this.movStatus == 2) {
if (fragProxyZ >= this.targetFloorZ) {
@@ -319,8 +366,7 @@ class elevator3D {
} else {
stoped(this);
}
- }
- else if (this.movStatus == 1) {
+ } else if (this.movStatus == 1) {
if (fragProxyZ <= this.targetFloorZ) {
requestAnimationFrame(() => {
movElevator();
@@ -337,14 +383,12 @@ class elevator3D {
hideColor(nodeId);
return;
}
- }
+ };
}
-
function onDocumentLoadSuccess(doc, eleOption) {
-
var viewables = doc.getRoot().getDefaultGeometry();
- viewer.loadDocumentNode(doc, viewables).then(i => {
+ viewer.loadDocumentNode(doc, viewables).then((i) => {
// documented loaded, any action?
});
// viewer.addEventListener(Autodesk.Viewing.AGGREGATE_SELECTION_CHANGED_EVENT, (args) => {
@@ -360,11 +404,7 @@ function onDocumentLoadSuccess(doc, eleOption) {
/*getNodeIdByDbIds("【電梯】", (nodeIds) => {*/
$(selector).trigger("autodesk:loaded");
/*});*/
-
-
});
-
-
}
// 輔助函數,使用 Promise 封裝 viewer.getProperties 函數
@@ -378,22 +418,30 @@ function viewerGetProperties(dbIds, attributeName = null) {
if (attributeName != null) {
option.propFilter = [attributeName]; // 限制只返回指定的屬性
}
- viewer.model.getBulkProperties2(dbIds, option, // 取得指定元素的屬性信息
+ viewer.model.getBulkProperties2(
+ dbIds,
+ option, // 取得指定元素的屬性信息
function (elements) {
- resolve(elements); // 成功時傳回 elements 物件
- })
+ resolve(elements); // 成功時傳回 elements 物件
+ }
+ );
});
}
// 輔助函數,使用 Promise 封裝 viewer.search 函數
async function getNodeIdBySearch(text) {
return new Promise((resolve, reject) => {
- viewer.search(text, (e) => { // 在 3D 模型中搜索具有指定文本的元素
- resolve(e); // 成功時傳回搜索結果
- }, (e) => {
- resolve(null); // 失敗時傳回 null
- })
- })
+ viewer.search(
+ text,
+ (e) => {
+ // 在 3D 模型中搜索具有指定文本的元素
+ resolve(e); // 成功時傳回搜索結果
+ },
+ (e) => {
+ resolve(null); // 失敗時傳回 null
+ }
+ );
+ });
}
// 主函數 - 透過 model 全部 node 取得特定 nodeId
@@ -404,23 +452,32 @@ async function getNodeIdByDbIds(checkValue = [], callback = null) {
let elements = await viewerGetProperties(targetNodeIds, "【tag_id】");
// 從 elements 中篩選出包含 【tag_id】 屬性的元素
- elements = elements.filter(x => x.properties.findIndex(y => y.displayName == "【tag_id】" && checkValue.indexOf(y.displayValue) != -1) != -1);
+ elements = elements.filter(
+ (x) =>
+ x.properties.findIndex(
+ (y) =>
+ y.displayName == "【tag_id】" &&
+ checkValue.indexOf(y.displayValue) != -1
+ ) != -1
+ );
if (elements) {
hasElement = true;
}
for (var e of elements) {
- let name = e.properties[0].displayValue; // 獲取元素的 【tag_id】 屬性
+ let name = e.properties[0].displayValue; // 獲取元素的 【tag_id】 屬性
let chiElements = null;
// 獲取 node 元素的子元素信息
targetNodeIds = await viewerGetProperties([e.dbId], "child");
// 二次篩選
- chiElements = targetNodeIds.filter(x => x.properties.findIndex(y => y.displayName == "child") != -1);
+ chiElements = targetNodeIds.filter(
+ (x) => x.properties.findIndex((y) => y.displayName == "child") != -1
+ );
// 獲取子元素的 nodeId
- targetNodeIds = chiElements.map(x => x.properties[0].displayValue);
+ targetNodeIds = chiElements.map((x) => x.properties[0].displayValue);
// 獲取子元素的屬性信息
chiElements = await viewerGetProperties(targetNodeIds);
@@ -437,34 +494,27 @@ async function getNodeIdByDbIds(checkValue = [], callback = null) {
return evelMap;
}
-
function setElevatorFloor(floor) {
- if (floor == 0)
- targetFloorZ = 0;
- else if (floor == 1)
- targetFloorZ = 15;
- else if (floor == 2)
- targetFloorZ = 26;
+ if (floor == 0) targetFloorZ = 0;
+ else if (floor == 1) targetFloorZ = 15;
+ else if (floor == 2) targetFloorZ = 26;
}
-function setElevatorSpeed(speed) { //0.01 ~ 1
+function setElevatorSpeed(speed) {
+ //0.01 ~ 1
elevatorSpeed = speed;
}
function movElevator() {
-
-
let tree = viewer.model?.getData().instanceTree;
let nodeId = 10952;
let fragProxyZ = 0;
var movStatus = 0; // 0=no 1=up 2=down
-
if (fragProxy.position.z > targetFloorZ) {
- movStatus = 2
- }
- else if (fragProxy.position.z < targetFloorZ) {
- movStatus = 1
+ movStatus = 2;
+ } else if (fragProxy.position.z < targetFloorZ) {
+ movStatus = 1;
}
if (movStatus == 0) {
@@ -477,14 +527,12 @@ function movElevator() {
//let fragPosition = new THREE.Vector3(0, 0, 15);// 一樓0 二樓15 三樓 26
if (movStatus == 2) {
fragProxy.position.z -= elevatorSpeed;
- }
- else if (movStatus == 1) {
+ } else if (movStatus == 1) {
fragProxy.position.z += elevatorSpeed;
}
fragProxyZ = fragProxy.position.z;
- fragProxy.updateAnimTransform()
-
+ fragProxy.updateAnimTransform();
});
viewer.impl.sceneUpdated(true);
@@ -492,14 +540,12 @@ function movElevator() {
if (fragProxyZ >= targetFloorZ) {
requestAnimationFrame(movElevator);
}
- }
- else if (movStatus == 1) {
+ } else if (movStatus == 1) {
if (fragProxyZ <= targetFloorZ) {
requestAnimationFrame(movElevator);
}
}
-
//let fragPosition = new THREE.Vector3(position);// 一樓0 二樓15 三樓 26
//fragProxy.position = fragPosition;
@@ -514,7 +560,9 @@ function getAllDbIds(viewer) {
var allDbIdsStr = Object.keys(instanceTree.nodeAccess.dbIdToIndex);
- return allDbIdsStr.map(function (id) { return parseInt(id) });
+ return allDbIdsStr.map(function (id) {
+ return parseInt(id);
+ });
}
/**
@@ -526,21 +574,24 @@ function onDocumentLoadFailure(viewerErrorCode) {
}
function getForgeToken(callback) {
- fetch(forgeTokenBase.url).then(res => {
- res.json().then(data => {
+ fetch(forgeTokenBase.url).then((res) => {
+ res.json().then((data) => {
let limitResType = ["object", "undefined"];
let access_token = data;
$.each(forgeTokenBase.res_access_token, (idx, dict) => {
access_token = access_token[dict];
- })
+ });
let expires_in = data;
$.each(forgeTokenBase.res_expires_in, (idx, dict) => {
expires_in = expires_in[dict];
- })
+ });
- if (limitResType.includes(typeof access_token) || limitResType.includes(typeof expires_in)) {
- access_token = "", expires_in = "";
+ if (
+ limitResType.includes(typeof access_token) ||
+ limitResType.includes(typeof expires_in)
+ ) {
+ (access_token = ""), (expires_in = "");
throw "access_token or expires_in on the ForgeTokenBase object for getting forge token by URL is not the correct path.";
}
@@ -556,7 +607,7 @@ class ADHeatMaps {
this.devices = option.devices ?? [];
this.checkNodeString = "【ROOM】";
this.tempVals = [];
- this.roomDbIds = []; //房間 dbId
+ this.roomDbIds = []; //房間 dbId
this.model = null;
this.dataVizExtn = null;
this.shadingData = null;
@@ -566,29 +617,32 @@ class ADHeatMaps {
init = async function () {
// 載入 Autodesk Viewer 的資料視覺化擴充功能
- const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization");
+ const dataVizExtn = await viewer.loadExtension(
+ "Autodesk.DataVisualization"
+ );
this.dataVizExtn = dataVizExtn;
// 儲存 Viewer 的模型
this.model = viewer.model;
- this.addHeatMaps()
- }
+ this.addHeatMaps();
+ };
async addHeatMaps() {
const {
SurfaceShadingData,
SurfaceShadingPoint,
SurfaceShadingNode,
- SurfaceShadingGroup
+ SurfaceShadingGroup,
} = Autodesk.DataVisualization.Core;
// test
- const shadingGroup = new SurfaceShadingGroup('iot-heatmap');
+ const shadingGroup = new SurfaceShadingGroup("iot-heatmap");
const rooms = new Map();
+ console.log(this.devices);
for (const { id, roomDbId, position, sensorTypes } of this.devices) {
- // console.log(id, roomDbId, position, sensorTypes)
if (!id || roomDbId == -1) {
continue;
}
+
if (!rooms.has(roomDbId)) {
const room = new SurfaceShadingNode(id, roomDbId);
shadingGroup.addChild(room);
@@ -598,10 +652,31 @@ class ADHeatMaps {
room.addPoint(new SurfaceShadingPoint(id, position, sensorTypes));
}
this.shadingData = new SurfaceShadingData();
- this.shadingData.addChild(shadingGroup)
+ this.shadingData.addChild(shadingGroup);
this.shadingData.initialize(this.model);
- await this.dataVizExtn.setupSurfaceShading(this.model, this.shadingData);
- this.dataVizExtn.renderSurfaceShading('iot-heatmap', "temperature", this.getSensorValue.bind(this));
+
+ if (pageAct.sysSubTag == "L1") {
+ await this.dataVizExtn.setupSurfaceShading(this.model, this.shadingData, {
+ type: "PlanarHeatmap",
+ placementPosition: 0.7,
+ confidence: 240.0,
+ });
+ this.dataVizExtn.registerSurfaceShadingColors(
+ "temperature",
+ [0x000000, 0xffd524]
+ );
+ } else {
+ await this.dataVizExtn.setupSurfaceShading(this.model, this.shadingData);
+ this.dataVizExtn.registerSurfaceShadingColors(
+ "temperature",
+ [0x0000ff, 0x00ff00, 0xffff00, 0xff0000]
+ );
+ }
+ this.dataVizExtn.renderSurfaceShading(
+ "iot-heatmap",
+ "temperature",
+ this.getSensorValue.bind(this)
+ );
//let nodeIds = await getNodeIdByDbIds(this.checkNodeString);
//nodeIds = Array.from(nodeIds);
@@ -648,26 +723,30 @@ class ADHeatMaps {
}
getSensorValue = function (device, sensorType) {
- let dev = this.devices.filter(x => x.id == device.id)[0];
+ let dev = this.devices.filter((x) => x.id == device.id)[0];
// shadingPoint.positionFromDBId(this.model, device.roomDbId)
return dev.temp / 40;
- }
+ };
// 改變溫度
changeTemp = async function (devId, temp) {
+ // console.log("changeTemp",devId, temp)
this.tempVal = temp;
// 透過 device id 取得 roomDbId
this.devices.forEach((dev) => {
if (devId == dev.id) {
dev.temp = temp;
}
- })
+ });
if (!this.shadingData) {
await this.addHeatMaps();
- this.dataVizExtn.renderSurfaceShading('iot-heatmap', "temperature", this.getSensorValue.bind(this));
- }
- else {
+ this.dataVizExtn.renderSurfaceShading(
+ "iot-heatmap",
+ "temperature",
+ this.getSensorValue.bind(this)
+ );
+ } else {
this.dataVizExtn.updateSurfaceShading(this.getSensorValue.bind(this));
}
// $.each(this.roomDbIds, async (idx, rDbid) => {
@@ -682,7 +761,7 @@ class ADHeatMaps {
// // 對 "Room Panel" 做表面顏色的渲染,並使用新的溫度值
// this.dataVizExtn.renderSurfaceShading("RoomPanel" + rDbid, "temperature", getSensorValue);
//}
- }
+ };
}
//全部物件 透明度: 輸入0:透明;輸入1:不透明
@@ -703,13 +782,16 @@ function setTransparency(nodeId, opacity) {
var fragIds = [];
model.getData().instanceTree.enumNodeFragments(
- nodeId, (fragId) => {
+ nodeId,
+ (fragId) => {
// 將遍歷到的片段 ID 添加到結果陣列中
- fragIds.push(fragId)
- }, (nodeId) => {
+ fragIds.push(fragId);
+ },
+ (nodeId) => {
// 如果遍歷到的節點是葉節點,则返回 true,表示繼續遍歷該節點的片段
return model.getData().instanceTree.isLeaf(nodeId);
- });
+ }
+ );
fragIds.forEach((fragId) => {
//获取材质
@@ -717,54 +799,66 @@ function setTransparency(nodeId, opacity) {
if (material) {
//设置透明度
- material.opacity = opacity;//0.5;
+ material.opacity = opacity; //0.5;
material.transparent = true;
//标记更新
material.needsUpdate = true;
}
- })
+ });
//更新viewer
viewer.impl.invalidate(true, true, true);
}
-function changeColor(nodeId, color = [0, 255, 0, 1]) {//電梯變綠色
+function changeColor(nodeId, color = [0, 255, 0, 1]) {
+ //電梯變綠色
let model = viewer.model;
let fragList = viewer.model.getFragmentList();
let instanceTree = viewer.model?.getData().instanceTree;
- color = color.map((x, i) => i < 3 ? x / 255 : x);
+ color = color.map((x, i) => (i < 3 ? x / 255 : x));
color = new THREE.Vector4().fromArray(color);
model.getData().instanceTree.enumNodeFragments(
- nodeId, (fragId) => {
+ nodeId,
+ (fragId) => {
// 將遍歷到的片段 ID 添加到結果陣列中
let material = fragList.getMaterial(fragId);
if (material) {
//设置透明度
- material.opacity = 1;//0.5;
+ material.opacity = 1; //0.5;
material.transparent = true;
//标记更新
material.needsUpdate = true;
}
- }, (nodeId) => {
+ },
+ (nodeId) => {
// 如果遍歷到的節點是葉節點,则返回 true,表示繼續遍歷該節點的片段
return model.getData().instanceTree.isLeaf(nodeId);
- });
- instanceTree.enumNodeChildren(nodeId, function (chiNodeId) {
- viewer.setThemingColor(chiNodeId, color);
- }, (chiNodeId) => {
- // 如果遍歷到的節點是葉節點,则返回 true,表示繼續遍歷該節點的片段
- return model.getData().instanceTree.isLeaf(chiNodeId);
- })
+ }
+ );
+ instanceTree.enumNodeChildren(
+ nodeId,
+ function (chiNodeId) {
+ viewer.setThemingColor(chiNodeId, color);
+ },
+ (chiNodeId) => {
+ // 如果遍歷到的節點是葉節點,则返回 true,表示繼續遍歷該節點的片段
+ return model.getData().instanceTree.isLeaf(chiNodeId);
+ }
+ );
}
-function hideColor(nodeId) {//顏色改成透明
+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(chiNodeId, color);
- }, true)
-
+ instanceTree.enumNodeChildren(
+ nodeId,
+ function (chiNodeId) {
+ var color = new THREE.Vector4(0, 1, 0, 0);
+ viewer.setThemingColor(chiNodeId, color);
+ },
+ true
+ );
}
//紀錄燈具座標
@@ -774,24 +868,42 @@ async function getLightData(data) {
}
async function testNewLight(dataList) {
- console.log("dataList", dataList)
dataList.forEach((myData, index) => {
- const position = JSON.parse(myData.device_coordinate_3d);
- if (lightList.findIndex(x => x.device_guid == myData.device_guid) == -1) {
- lightList.push({ dbid: myData.forge_dbid, device_guid: myData.device_guid, lightObject: new THREE.SpotLight(0xe1cf18, 10, 200, 1, 1, 2) });
+ const position = myData.position;
+ if (lightList.findIndex((x) => x.device_guid == myData.device_guid) == -1) {
+ lightList.push({
+ dbid: myData.forge_dbid,
+ device_guid: myData.device_guid,
+ lightObject: new THREE.SpotLight(0xe1cf18, 10, 200, 1, 1, 2),
+ });
+ } else if (
+ lightList.findIndex((x) => x.device_guid == myData.device_node_guid) == -1
+ ) {
+ lightList.push({
+ dbid: myData.forge_dbid,
+ device_guid: myData.device_node_guid,
+ lightObject: new THREE.SpotLight(0xe1cf18, 10, 200, 1, 1, 2),
+ });
+ }
+ if (position && position.x && position.y && position.z) {
+ lightList[index].lightObject.position.set(
+ position.x,
+ position.y,
+ position.z
+ );
+ lightList[index].lightObject.castShadow = true;
+ lightList[index].lightObject.visible = true;
+ lightList[index].lightObject.target.position.set(
+ position.x,
+ position.y,
+ position.z - 100
+ );
+ viewer.scene.add(lightList[index].lightObject.target);
+ viewer.scene.add(lightList[index].lightObject);
}
-
- lightList[index].lightObject.position.set(position.x, position.y, position.z);
- lightList[index].lightObject.castShadow = true;
- lightList[index].lightObject.visible = true;
- lightList[index].lightObject.target.position.set(position.x, position.y, position.z - 100);
- viewer.scene.add(lightList[index].lightObject.target);
- viewer.scene.add(lightList[index].lightObject);
//let spotLightHelper = new THREE.SpotLightHelper(lightList[index].lightObject);
//viewer.scene.add(spotLightHelper);
-
-
});
viewer.impl.sceneUpdated(true);
}
@@ -801,13 +913,13 @@ async function addHotPoint(data) {
var viewer = data.target ? data.target : data;
const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization");
const DataVizCore = Autodesk.DataVisualization.Core;
- const viewableType = Autodesk.DataVisualization.Core.ViewableType.SPRITE;//DataVizCore.ViewableType.SPRITE;
+ const viewableType = Autodesk.DataVisualization.Core.ViewableType.SPRITE; //DataVizCore.ViewableType.SPRITE;
let spriteColor = null;
let spriteIcon = "";
const dbIdStart = 10;
const dbIdEnd = 19;
- if (pageAct.sysSubTag === "M12" && !pageAct.floTag) {
- return
+ if (pageAct.sysSubTag === "M12") {
+ return;
} else {
spriteColor = new THREE.Color(0xffffff);
spriteIcon = "/file/img/forge/hotspot.svg";
@@ -816,15 +928,22 @@ async function addHotPoint(data) {
}
}
- const style = new DataVizCore.ViewableStyle(viewableType, spriteColor, spriteIcon);
+ const style = new DataVizCore.ViewableStyle(
+ viewableType,
+ spriteColor,
+ spriteIcon
+ );
- if (lightDataList != undefined && lightDataList != null && lightDataList.length > 0) {
+ if (
+ lightDataList != undefined &&
+ lightDataList != null &&
+ lightDataList.length > 0
+ ) {
testNewLight(lightDataList);
}
-
//熱點 點擊事件註冊
- viewer.addEventListener(DataVizCore.MOUSE_CLICK, onSpriteClicked);// SPRITE_SELECTED
+ viewer.addEventListener(DataVizCore.MOUSE_CLICK, onSpriteClicked); // SPRITE_SELECTED
// viewer.addEventListener(DataVizCore.MOUSE_CLICK, onSpriteClickedOut);
//viewer.addEventListener(
// Autodesk.Viewing.SELECTION_CHANGED_EVENT,
@@ -840,7 +959,6 @@ async function addHotPoint(data) {
myData._dbId = dbId;
viewableData.addViewable(viewable);
});
-
await viewableData.finish();
dataVizExtn.addViewables(viewableData);
// console.log(dataVizExtn)
@@ -850,22 +968,31 @@ async function addHotPoint(data) {
function onSpriteClicked(event) {
event.hasStopped = true;
if (event != undefined && event != null) {
- if (event.dbId >= dbIdStart) {//event.dbId > 0 && event.dbId < 19
+ if (event.dbId >= dbIdStart) {
+ //event.dbId > 0 && event.dbId < 19
// console.log(`Sprite clicked: ${event.dbId}`);
for (let i = dbIdStart; i <= myDataList.length + 10; i++) {
- !alarmDbIdList.some(dbId => dbId == i) && changeColorForHotspot(i);
+ !alarmDbIdList.some((dbId) => dbId == i) &&
+ pageAct.sysSubTag !== "L1" &&
+ changeColorForHotspot(i);
changeScaleForHotspot(i, true);
}
- let myData = myDataList.filter(x => x._dbId == event.dbId)[0];
- if (lightList != undefined && lightList != null && lightList.length > 0) {
+ let myData = myDataList.filter((x) => x._dbId == event.dbId)[0];
+ if (
+ lightList != undefined &&
+ lightList != null &&
+ lightList.length > 0
+ ) {
//setLightOpenOrClose(false, myData.device_guid);//關燈測試
//setLightValues(myData.device_guid, 20, 0x00ff00);//更改燈光顏色和強度的測試
- moveViewToDevice(myData.forge_dbid);//移動視角至該設備
+ moveViewToDevice(myData.forge_dbid); //移動視角至該設備
}
$(selector).trigger("autodesk:click:sprite", { event, myData });
} else {
- !alarmDbIdList.some(dbId => dbId == i) && changeColorForHotspot(event.dbId, null);
+ !alarmDbIdList.some((dbId) => dbId == i) &&
+ pageAct.sysSubTag !== "L1" &&
+ changeColorForHotspot(event.dbId, null);
changeScaleForHotspot(event.dbId, false);
$(selector).trigger("autodesk:clickOut:sprite", { event });
}
@@ -909,14 +1036,20 @@ async function addHotPoint(data) {
// }
// }
//}
-
}
// 熱點 更換顏色
-async function changeColorForHotspot(dbId, type = null) {
+async function changeColorForHotspot(dbId, type = null, lightOn = false) {
const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization");
let spriteColorFocus = new THREE.Color(0xffffff);
- if (type == "focus" && pageAct.sysSubTag !== "M12") {
+ if (pageAct.sysSubTag == "L1") {
+ spriteColorFocus = lightOn
+ ? new THREE.Color(0xffd524)
+ : new THREE.Color(0x40525e);
+ if (lightOn) {
+ console.log(dbId);
+ }
+ } else if (type == "focus" && pageAct.sysSubTag !== "M12") {
spriteColorFocus = new THREE.Color(0x00ffe1);
} else if (type == "error") {
spriteColorFocus = new THREE.Color(0xff0000);
@@ -929,7 +1062,6 @@ async function changeColorForHotspot(dbId, type = null) {
});
}
-
// 熱點 更換大小
async function changeScaleForHotspot(dbId, type = true) {
const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization");
@@ -948,8 +1080,6 @@ async function changeScaleForHotspot(dbId, type = true) {
//------------------- end --------------
-
-
//------------------ 熱圖 -------------------------------
async function loadHeatmaps(model) {
//console.log("熱圖 loadHeat")
@@ -960,21 +1090,21 @@ async function loadHeatmaps(model) {
{
id: "Oficina 5",
//name: "Oficina-",
- position: { x: 6.98, y: -19.00, z: 16.86 }, // x: 0, y: 25, z: -2.5 (-4.93, -20.61, 16.86)
- sensorTypes: ["temperature", "humidity"]
+ position: { x: 6.98, y: -19.0, z: 16.86 }, // x: 0, y: 25, z: -2.5 (-4.93, -20.61, 16.86)
+ sensorTypes: ["temperature", "humidity"],
},
{
id: "Oficina 4",
//name: "Oficina-",
position: { x: 35.85, y: -2.24, z: 16.86 }, // x: 0, y: 25.03, z: -2.52 (23.94, -3.85, 16.86)
- sensorTypes: ["temperature", "humidity"]
+ sensorTypes: ["temperature", "humidity"],
},
{
id: "Oficina 3",
//name: "Oficina-",
position: { x: 6.98, y: -2.24, z: 16.86 }, // x: 0, y: 25.03, z: -2.52 (-4.93, -3.85, 16.86)
- sensorTypes: ["temperature", "humidity"]
- }
+ sensorTypes: ["temperature", "humidity"],
+ },
];
//冷氣N5: (-4.93, -20.61, 16.86), N4: (23.94, -3.85, 16.86), N3: (-4.93, -3.85, 16.86)
@@ -987,11 +1117,8 @@ async function loadHeatmaps(model) {
const roomDbIds = [];
roomDbIds.push(7567);
- const {
- SurfaceShadingData,
- SurfaceShadingPoint,
- SurfaceShadingNode,
- } = Autodesk.DataVisualization.Core;
+ const { SurfaceShadingData, SurfaceShadingPoint, SurfaceShadingNode } =
+ Autodesk.DataVisualization.Core;
const shadingNode = new SurfaceShadingNode("Room Panel", roomDbIds);
@@ -1029,7 +1156,6 @@ async function loadHeatmaps(model) {
}
//------------------ end --------------------------------
async function loadHeatmapsForFloor(model) {
-
const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization");
//x: -17.33, y: 51.03, z: -2.52
@@ -1037,21 +1163,21 @@ async function loadHeatmapsForFloor(model) {
{
id: "Oficina 5",
//name: "Oficina-",
- position: { x: 6.98, y: -19.00, z: 16.86 }, // x: 0, y: 25, z: -2.5 (-4.93, -20.61, 16.86)
- sensorTypes: ["temperature", "humidity"]
+ position: { x: 6.98, y: -19.0, z: 16.86 }, // x: 0, y: 25, z: -2.5 (-4.93, -20.61, 16.86)
+ sensorTypes: ["temperature", "humidity"],
},
{
id: "Oficina 4",
//name: "Oficina-",
position: { x: 35.85, y: -2.24, z: 16.86 }, // x: 0, y: 25.03, z: -2.52 (23.94, -3.85, 16.86)
- sensorTypes: ["temperature", "humidity"]
+ sensorTypes: ["temperature", "humidity"],
},
{
id: "Oficina 3",
//name: "Oficina-",
position: { x: 6.98, y: -2.24, z: 16.86 }, // x: 0, y: 25.03, z: -2.52 (-4.93, -3.85, 16.86)
- sensorTypes: ["temperature", "humidity"]
- }
+ sensorTypes: ["temperature", "humidity"],
+ },
];
// Initialize sensor values
@@ -1064,11 +1190,8 @@ async function loadHeatmapsForFloor(model) {
roomDbIds.push(7567);
- const {
- SurfaceShadingData,
- SurfaceShadingPoint,
- SurfaceShadingNode,
- } = Autodesk.DataVisualization.Core;
+ const { SurfaceShadingData, SurfaceShadingPoint, SurfaceShadingNode } =
+ Autodesk.DataVisualization.Core;
const shadingNode = new SurfaceShadingNode("Room Panel", roomDbIds);
@@ -1121,41 +1244,47 @@ async function loadHeatmapForFloor() {
function findLevels(model) {
return new Promise((resolve, reject) => {
- model.search("layer", (nodeIds) => {
- let levels = []
- const tree = viewer.model.getInstanceTree();
- for (let i = 0; i < nodeIds.length; i++) {
- const dbId = nodeIds[i];
- const name = tree.getNodeName(dbId);
- if (!name || name.includes('<沒有層級>')) continue;
- levels.push({
- guid: dbId,
- name,
- dbId,
- extension: {
- buildingStory: true,
- structure: false,
- computationHeight: 0,
- groundPlane: false,
- hasAssociatedViewPlans: false,
- }
- });
+ model.search(
+ "layer",
+ (nodeIds) => {
+ let levels = [];
+ const tree = viewer.model.getInstanceTree();
+ for (let i = 0; i < nodeIds.length; i++) {
+ const dbId = nodeIds[i];
+ const name = tree.getNodeName(dbId);
+ if (!name || name.includes("<沒有層級>")) continue;
+ levels.push({
+ guid: dbId,
+ name,
+ dbId,
+ extension: {
+ buildingStory: true,
+ structure: false,
+ computationHeight: 0,
+ groundPlane: false,
+ hasAssociatedViewPlans: false,
+ },
+ });
+ }
+ resolve(levels);
+ },
+ (e) => {
+ reject(e);
}
- resolve(levels)
- }, (e) => { reject(e) })
+ );
});
}
-
async function getRemoteLevels() {
-
- let aecData = await Autodesk.Viewing.Document.getAecModelData(this.viewer.model.getDocumentNode());
+ let aecData = await Autodesk.Viewing.Document.getAecModelData(
+ this.viewer.model.getDocumentNode()
+ );
let levels;
if (!aecData || !aecData.levels) {
- const levelExt = await viewer.loadExtension('Autodesk.AEC.LevelsExtension');
+ const levelExt = await viewer.loadExtension("Autodesk.AEC.LevelsExtension");
levelExt.setAecModelData(undefined, viewer.model); //!<<< Clear before reset
- levels = await findLevels(viewer.model)
+ levels = await findLevels(viewer.model);
aecdata = Autodesk.AEC.AecModelData.computeLevels(levels, viewer.model); //!<<< Rebuild aec model data
} else {
levels = aecData.levels;
@@ -1165,20 +1294,24 @@ async function getRemoteLevels() {
}
async function getLevelsData(lowerFloor, upperFloor, callback = null) {
- console.log(lowerFloor, upperFloor)
// 樓層正規化 取得樓層
- const floorRegex = /[\d|\w]+F/gmi;
- const floorRegex2 = /^FL[\d|\w]+/gmi;
+ const floorRegex = /[\d|\w]+F/gim;
+ const floorRegex2 = /^FL[\d|\w]+/gim;
const data = await this.getRemoteLevels();
- console.log(data)
for (var i = 0; i < data.length; i++) {
- let name = data[i].name?.match(floorRegex) || data[i].name?.match(floorRegex2)[0].split("L")[1] + "F";
- if (name && name[0] == lowerFloor || name == lowerFloor) {
+ let name =
+ data[i].name?.match(floorRegex) || data[i].name?.match(floorRegex2);
+ if (
+ name &&
+ (name[0] == lowerFloor || name[0].split("L")[1] + "F" == lowerFloor)
+ ) {
lowerIdx = i;
}
- if (name && name[0] == upperFloor || name == upperFloor) {
+ if (
+ name &&
+ (name[0] == upperFloor || name[0].split("L")[1] + "F" == upperFloor)
+ ) {
if (i > upperIdx && lowerFloor == upperFloor) {
-
} else {
upperIdx = i;
}
@@ -1198,11 +1331,14 @@ function getCutPlaneParam(idx, n) {
const model = this.viewer.model;
const globalOffset = model.getData().globalOffset;
const units = model.getUnitString();
- const elevRaw = Autodesk.Viewing.Private.convertUnits('ft', units, 1, level.elevation);
- console.log(globalOffset, units, elevRaw)
+ const elevRaw = Autodesk.Viewing.Private.convertUnits(
+ "ft",
+ units,
+ 1,
+ level.elevation
+ );
let d = elevRaw - globalOffset.z - 0.5;
- if (n == 1)
- d = -1 * d;
+ if (n == 1) d = -1 * d;
return new THREE.Vector4(0, 0, n, d);
}
@@ -1224,7 +1360,11 @@ async function newLight(lightPosition) {
// console.log(lightPosition.x, lightPosition.y, lightPosition.z)
spotLight.castShadow = false;
spotLight.visible = true;
- spotLight.target.position.set(lightPosition.x, lightPosition.y, lightPosition.z - 20);
+ spotLight.target.position.set(
+ lightPosition.x,
+ lightPosition.y,
+ lightPosition.z - 20
+ );
viewer.scene.add(spotLight.target);
viewer.scene.add(spotLight);
viewer.impl.sceneUpdated(true);
@@ -1234,14 +1374,21 @@ async function newLight(lightPosition) {
//調整燈光 強度、顏色
async function setLightValues(deviceGuid, intensity, color) {
- for (var i = 0; i < lightList.length; i++) {
- if (lightList[i].device_guid == deviceGuid) {
- lightList[i].lightObject.intensity = intensity;
-
- var tempcolor = new THREE.Color().setHex(color);
- lightList[i].lightObject.color = tempcolor;
- }
+ const light = lightList.find(({ device_guid }) => device_guid === deviceGuid);
+ if (light) {
+ console.log(light, intensity, color);
+ light.lightObject.intensity = intensity;
+ var tempcolor = new THREE.Color().setHex(color);
+ light.lightObject.color = tempcolor;
}
+ // for (var i = 0; i < lightList.length; i++) {
+ // if (lightList[i].device_guid == deviceGuid) {
+ // lightList[i].lightObject.intensity = intensity;
+
+ // var tempcolor = new THREE.Color().setHex(color);
+ // lightList[i].lightObject.color = tempcolor;
+ // }
+ // }
viewer.impl.sceneUpdated(true);
}
@@ -1256,7 +1403,8 @@ async function setLightOpenOrClose(value, deviceGuid) {
}
//透過nodeId,更改物件顏色或顯示與否;color請填寫THREE.Vector4
-function changeColorTransparency(nodeId, color) {//變綠色
+function changeColorTransparency(nodeId, color) {
+ //變綠色
//var color = new THREE.Vector4(0, 1, 0, 1);//綠色;前三個代表r、g、b; 亦可填入255/255
//var color = new THREE.Vector4(0, 1, 0, 0);//不顯示顏色;最後的參數為透明度
viewer.setThemingColor(nodeId, color);
@@ -1285,9 +1433,9 @@ function showHeat(selector) {
const labels = [
`${(10).toFixed(2)}${"°C"}`,
`${(40 / 2).toFixed(2)}${"°C"}`,
- `${(30).toFixed(2)}${"°C"}`
+ `${(30).toFixed(2)}${"°C"}`,
];
- const colorStops = ['blue', 'green', 'yellow', 'red'];
+ const colorStops = ["blue", "green", "yellow", "red"];
createHeatmapRect(labels, colorStops, selector);
}
@@ -1295,16 +1443,15 @@ function createHeatmapRect(labels, colorStops, selector) {
if (!$(selector)[0]) {
return;
}
- const context = $(selector)[0].getContext('2d');
+ const context = $(selector)[0].getContext("2d");
let i, len;
context.clearRect(0, 0, 200, 50);
- context.fillStyle = 'back';//white
+ context.fillStyle = "back"; //white
for (i = 0, len = labels.length; i < len; i++) {
- let x = 10 + 180 * i / (len - 1);
+ let x = 10 + (180 * i) / (len - 1);
if (i === len - 1) {
x -= context.measureText(labels[i]).width;
- }
- else if (i > 0) {
+ } else if (i > 0) {
x -= 0.5 * context.measureText(labels[i]).width;
}
context.fillText(labels[i], x, 10);
@@ -1332,7 +1479,6 @@ async function toLoadHeatmap(roomArr) {
function setShadowShow(type = false) {
viewer.setGroundShadow(type);
viewer.impl.sceneUpdated(true);
-
}
//============================= end ===================================
@@ -1341,8 +1487,7 @@ function moveViewToDevice(letter) {
viewer.clearSelection();
viewer.select(letter);
viewer.fitToView([letter]);
- }
- else {
+ } else {
viewer.clearSelection();
}
-}
\ No newline at end of file
+}
diff --git a/Frontend/js/init.js b/Frontend/js/init.js
index c456b23..d80c521 100644
--- a/Frontend/js/init.js
+++ b/Frontend/js/init.js
@@ -1,14 +1,14 @@
var ytAjax = typeof YourTeam !== "undefined" ? new YourTeam.Ajax() : null; //公用AJAX初始化
-var baseApiUrl = "http://localhost:3604"; // 本地開發用
-var baseImgUrl = "https://localhost:44376"; // 本地開發用
+//var baseApiUrl = "http://localhost:3604"; // 本地開發用
+//var baseImgUrl = "https://localhost:44376"; // 本地開發用
// Mitsubishi
//var baseApiUrl = "http://220.132.206.5"; // production 用
//var baseImgUrl = "http://220.132.206.5:8848"; // production 用
// WSP
-// var baseApiUrl = "http://220.132.206.5:8001"; // production 用
-// var baseImgUrl = "http://220.132.206.5:8849"; // production 用
+var baseApiUrl = "http://220.132.206.5:8001"; // production 用
+var baseImgUrl = "http://220.132.206.5:8849"; // production 用
//var baseApiUrl = "http://localhost";
//var baseImgUrl = "http://localhost:8848";
@@ -37,10 +37,10 @@ var initAreaTag = "TPE";
var n4Sup = "Mitsubishi_JACE8000";
// WSP
-// var elevatorShow = false
-// var port = "4912";
-// var initAreaTag = "NTPC";
-// var n4Sup = "WSP_Supervisor";
+//var elevatorShow = false
+//var port = "4912";
+//var initAreaTag = "NTPC";
+//var n4Sup = "WSP_Supervisor";
var forgeTokenBase = {
url: baseApiUrl + '/api/forge/oauth/token',
diff --git a/Frontend/js/n4js/bajatest.js b/Frontend/js/n4js/bajatest.js
index d64f979..f7f3f18 100644
--- a/Frontend/js/n4js/bajatest.js
+++ b/Frontend/js/n4js/bajatest.js
@@ -56,8 +56,7 @@ class subscriptionDevices {
var sub = new baja.Subscriber();
sub.attach('changed', function (prop) {
- // console.log(prop)
- // console.log(prop.getName())
+ console.log("Light prop", prop.getName())
if (prop.getName() === 'out') {
var out_value = this.getOutDisplay();
var target_device_number = this.$parent.getDisplayName().split('_').slice(0, 5).join('_');
@@ -98,8 +97,8 @@ class subscriptionDevices {
// var building_tag = "H";
// var system_tag = "M10";
// baja.Ord.make(`ip:greencloud.fic.com.tw|foxs:|station:|slot:/Arena/${building_tag}/${system_tag}|bql:select name, displayname, slotPath, out.value, out from control:ControlPoint`)
- console.log(`local:|foxs:|station:|slot:/${_this.ordPath.area_tag}/${_this.ordPath.building_tag}/${_this.ordPath.system_tag}/${_this.ordPath.name_tag}|bql:select name, displayname, slotPath, out.value, out, facets from control:ControlPoint`);
- baja.Ord.make(`local:|foxs:|station:|slot:/${_this.ordPath.area_tag}/${_this.ordPath.building_tag}/${_this.ordPath.system_tag}/${_this.ordPath.name_tag}|bql:select name, displayname, slotPath, out.value, out, facets from control:ControlPoint`)
+ console.log(`local:|foxs:${port}|station:|slot:/${_this.ordPath.area_tag}/${_this.ordPath.building_tag}/${_this.ordPath.system_tag}/${_this.ordPath.name_tag}${_this.ordPath.flo_tag ? `/${_this.ordPath.flo_tag}` : ""}|bql:select name, displayname, slotPath, out.value, out, facets from control:ControlPoint`);
+ baja.Ord.make(`local:|foxs:${port}|station:|slot:/${_this.ordPath.area_tag}/${_this.ordPath.building_tag}/${_this.ordPath.system_tag}/${_this.ordPath.name_tag}${_this.ordPath.flo_tag ? `/${_this.ordPath.flo_tag}` : ""}|bql:select name, displayname, slotPath, out.value, out, facets from control:ControlPoint`)
.get(
function (table) {
var tableStart, tableFinish;
@@ -160,59 +159,224 @@ class subscriptionDevices {
}
totalTargetDevice.push(modify_target_device);
//取得component當下就更新設備點位
- if (_this.changeCallback != undefined && _this.changeCallback != null) {
- _this.changeCallback(modify_target_device);
+ // if (_this.changeCallback != undefined && _this.changeCallback != null) {
+ // _this.changeCallback(modify_target_device);
+ // }
+ if (pageAct.sysSubTag === "L1") {
+ if (point_name === "SSC" || point_name === "TRIP" || point_name === "ONOFF") {
+ if (_this.changeCallback != undefined && _this.changeCallback != null) {
+ _this.changeCallback(modify_target_device, true); //第2參數用在平面圖,刷新畫面
+ baja.Ord.make(`local:|foxs:${port}|station:|` + this.getDisplay("slotPath"))
+ .get()
+ .then(function (component) {
+ // console.log("component",component)
+ component_index++;
+ var target_device_number = component.$parent.getDisplayName().split('_').slice(0, 5).join('_');
+
+ var out_value = component.getOutDisplay();
+ var target_device_number = component.$parent.getDisplayName().split('_').slice(0, 5).join('_');
+ var point_name = component.getDisplayName();
+ //依據Facets判斷回傳的內容值為何
+ var facets_split = component.getFacets1().$cEncStr.split('|');
+ var facets_arr = [];
+ facets_split.forEach(function (item, index) {
+ facets_arr.push(item.split('=s:'));
+ });
+
+ var facets = facets_arr.reduce((obj, cur) => ({ ...obj, [cur[0]]: cur[1] }), {})
+
+ var point_out_split = component.getOutDisplay().split(' ');
+
+ let key = Object.keys(facets).find(k => facets[k] === point_out_split[0]);
+
+ if (key == undefined) {
+ key = point_out_split[0];
+ }
+
+ var modify_target_device = {
+ "device_number": target_device_number ? target_device_number : null,
+ "device_number_full": component.$parent.getSlotPath().$names.join("_"),
+ "point_name": point_name ? point_name : null,
+ "value": key
+ }
+
+ if (pageAct.sysSubTag === "L1") {
+ if (point_name === "SSC" || point_name === "TRIP" || point_name === "ONOFF") {
+ if (_this.changeCallback != undefined && _this.changeCallback != null) {
+ _this.changeCallback(modify_target_device, true); //第2參數用在平面圖,刷新畫面
+ }
+ }
+ } else {
+ if (_this.changeCallback != undefined && _this.changeCallback != null) {
+ _this.changeCallback(modify_target_device, true); //第2參數用在平面圖,刷新畫面
+ }
+ }
+
+
+ // //依據Facets判斷回傳的內容值為何
+ // var facets_split = component.getFacets1().$cEncStr.split('|');
+ // var facets_arr = [];
+ // facets_split.forEach(function (item, index) {
+ // facets_arr.push(item.split('=s:'));
+ // });
+
+ // var facets = facets_arr.reduce((obj, cur) => ({ ...obj, [cur[0]]: cur[1] }), {})
+
+ // var point_out_split = component.getOutDisplay().split(' ');
+
+ // let key = Object.keys(facets).find(k => facets[k] === point_out_split[0]);
+
+ // if (key == undefined) {
+ // key = point_out_split[0];
+ // }
+
+ // var modify_target_device = {
+ // "device_number": target_device_number ? target_device_number : null,
+ // "point_name": point_name ? point_name : null,
+ // "value": key
+ // }
+
+ // //取得component當下就更新設備點位
+ // if (baja_subscribe_device_callback_func != undefined && baja_subscribe_device_callback_func != null) {
+ // if (component_index == total_component_index) {
+ // baja_subscribe_device_callback_func(modify_target_device, true);
+ // }
+ // else {
+ // baja_subscribe_device_callback_func(modify_target_device);
+ // }
+ // }
+
+ if (pageAct.sysSubTag === "L1") {
+ if (point_name === "SSC" || point_name === "TRIP" || point_name === "ONOFF") {
+ sub.subscribe({
+ comps: component,
+ });
+ }
+ } else {
+ sub.subscribe({
+ comps: component,
+ });
+ }
+
+ // sub.subscribe({
+ // comps: component,
+ // });
+ tolSubList.push(sub);
+ subFinish = new Date(Date.now());
+ $("#sub-end").html(subFinish.toISOString());
+ $("#sub-time").html((subFinish.getTime() - subStart.getTime()) / 1000 + "sec");
+ // console.log("訂閱完成時間", (subFinish.getTime() - subStart.getTime()) / 1000 + "sec");
+ });
+ }
+ }
+ } else {
+ if (_this.changeCallback != undefined && _this.changeCallback != null) {
+ _this.changeCallback(modify_target_device, true); //第2參數用在平面圖,刷新畫面
+ baja.Ord.make(`local:|foxs:${port}|station:|` + this.getDisplay("slotPath"))
+ .get()
+ .then(function (component) {
+ component_index++;
+ var target_device_number = component.$parent.getDisplayName().split('_').slice(0, 5).join('_');
+
+ var out_value = component.getOutDisplay();
+ var target_device_number = component.$parent.getDisplayName().split('_').slice(0, 5).join('_');
+ var point_name = component.getDisplayName();
+ //依據Facets判斷回傳的內容值為何
+ var facets_split = component.getFacets1().$cEncStr.split('|');
+ var facets_arr = [];
+ facets_split.forEach(function (item, index) {
+ facets_arr.push(item.split('=s:'));
+ });
+
+ var facets = facets_arr.reduce((obj, cur) => ({ ...obj, [cur[0]]: cur[1] }), {})
+
+ var point_out_split = component.getOutDisplay().split(' ');
+
+ let key = Object.keys(facets).find(k => facets[k] === point_out_split[0]);
+
+ if (key == undefined) {
+ key = point_out_split[0];
+ }
+
+ var modify_target_device = {
+ "device_number": target_device_number ? target_device_number : null,
+ "device_number_full": component.$parent.getSlotPath().$names.join("_"),
+ "point_name": point_name ? point_name : null,
+ "value": key
+ }
+
+ if (pageAct.sysSubTag === "L1") {
+ if (point_name === "SSC" || point_name === "TRIP" || point_name === "ONOFF") {
+ if (_this.changeCallback != undefined && _this.changeCallback != null) {
+ _this.changeCallback(modify_target_device, true); //第2參數用在平面圖,刷新畫面
+ }
+ }
+ } else {
+ if (_this.changeCallback != undefined && _this.changeCallback != null) {
+ _this.changeCallback(modify_target_device, true); //第2參數用在平面圖,刷新畫面
+ }
+ }
+
+
+ // //依據Facets判斷回傳的內容值為何
+ // var facets_split = component.getFacets1().$cEncStr.split('|');
+ // var facets_arr = [];
+ // facets_split.forEach(function (item, index) {
+ // facets_arr.push(item.split('=s:'));
+ // });
+
+ // var facets = facets_arr.reduce((obj, cur) => ({ ...obj, [cur[0]]: cur[1] }), {})
+
+ // var point_out_split = component.getOutDisplay().split(' ');
+
+ // let key = Object.keys(facets).find(k => facets[k] === point_out_split[0]);
+
+ // if (key == undefined) {
+ // key = point_out_split[0];
+ // }
+
+ // var modify_target_device = {
+ // "device_number": target_device_number ? target_device_number : null,
+ // "point_name": point_name ? point_name : null,
+ // "value": key
+ // }
+
+ // //取得component當下就更新設備點位
+ // if (baja_subscribe_device_callback_func != undefined && baja_subscribe_device_callback_func != null) {
+ // if (component_index == total_component_index) {
+ // baja_subscribe_device_callback_func(modify_target_device, true);
+ // }
+ // else {
+ // baja_subscribe_device_callback_func(modify_target_device);
+ // }
+ // }
+
+ if (pageAct.sysSubTag === "L1") {
+ if (point_name === "SSC" || point_name === "TRIP" || point_name === "ONOFF") {
+ sub.subscribe({
+ comps: component,
+ });
+ }
+ } else {
+ sub.subscribe({
+ comps: component,
+ });
+ }
+
+ // sub.subscribe({
+ // comps: component,
+ // });
+ tolSubList.push(sub);
+ subFinish = new Date(Date.now());
+ $("#sub-end").html(subFinish.toISOString());
+ $("#sub-time").html((subFinish.getTime() - subStart.getTime()) / 1000 + "sec");
+ // console.log("訂閱完成時間", (subFinish.getTime() - subStart.getTime()) / 1000 + "sec");
+ });
+ }
}
- baja.Ord.make("local:|foxs:|station:|" + this.getDisplay("slotPath"))
- .get()
- .then(function (component) {
- component_index++;
- var target_device_number = component.$parent.getDisplayName().split('_').slice(0, 5).join('_');
- // console.log(component, component.getDisplayName())
- var point_name = component.getDisplayName();
- // //依據Facets判斷回傳的內容值為何
- // var facets_split = component.getFacets1().$cEncStr.split('|');
- // var facets_arr = [];
- // facets_split.forEach(function (item, index) {
- // facets_arr.push(item.split('=s:'));
- // });
- // var facets = facets_arr.reduce((obj, cur) => ({ ...obj, [cur[0]]: cur[1] }), {})
- // var point_out_split = component.getOutDisplay().split(' ');
-
- // let key = Object.keys(facets).find(k => facets[k] === point_out_split[0]);
-
- // if (key == undefined) {
- // key = point_out_split[0];
- // }
-
- // var modify_target_device = {
- // "device_number": target_device_number ? target_device_number : null,
- // "point_name": point_name ? point_name : null,
- // "value": key
- // }
-
- // //取得component當下就更新設備點位
- // if (baja_subscribe_device_callback_func != undefined && baja_subscribe_device_callback_func != null) {
- // if (component_index == total_component_index) {
- // baja_subscribe_device_callback_func(modify_target_device, true);
- // }
- // else {
- // baja_subscribe_device_callback_func(modify_target_device);
- // }
- // }
-
- sub.subscribe({
- comps: component,
- });
- tolSubList.push(sub);
- subFinish = new Date(Date.now());
- $("#sub-end").html(subFinish.toISOString());
- $("#sub-time").html((subFinish.getTime() - subStart.getTime()) / 1000 + "sec");
- // console.log("訂閱完成時間", (subFinish.getTime() - subStart.getTime()) / 1000 + "sec");
- });
},
after: function () {
tableFinish = new Date(Date.now());
@@ -358,8 +522,8 @@ function MyBaja() {
// // var building_tag = "H";
// // var system_tag = "M10";
// // baja.Ord.make(`ip:greencloud.fic.com.tw|foxs:|station:|slot:/Arena/${building_tag}/${system_tag}|bql:select name, displayname, slotPath, out.value, out from control:ControlPoint`)
-// console.log(`local:|foxs:|station:|slot:/${_this.ordPath.area_tag}/${ordPath.building_tag}/${ordPath.system_tag}/${ordPath.name_tag}|bql:select name, displayname, slotPath, out.value, out, facets from control:ControlPoint`);
-// baja.Ord.make(`local:|foxs:|station:|slot:/${_this.ordPath.area_tag}/${ordPath.building_tag}/${ordPath.system_tag}/${ordPath.name_tag}|bql:select name, displayname, slotPath, out.value, out, facets from control:ControlPoint`)
+// console.log(`local:|foxs:${port}|station:|slot:/${_this.ordPath.area_tag}/${ordPath.building_tag}/${ordPath.system_tag}/${ordPath.name_tag}|bql:select name, displayname, slotPath, out.value, out, facets from control:ControlPoint`);
+// baja.Ord.make(`local:|foxs:${port}|station:|slot:/${_this.ordPath.area_tag}/${ordPath.building_tag}/${ordPath.system_tag}/${ordPath.name_tag}|bql:select name, displayname, slotPath, out.value, out, facets from control:ControlPoint`)
// .get(
// function (table) {
// var tableStart, tableFinish;
@@ -425,7 +589,7 @@ function MyBaja() {
// }
-// baja.Ord.make("local:|foxs:|station:|" + this.getDisplay("slotPath"))
+// baja.Ord.make(`local:|foxs:${port}|station:|` + this.getDisplay("slotPath"))
// .get()
// .then(function (component) {
// component_index++;
@@ -518,8 +682,8 @@ function BajaSubscribeAlarmsByBql(ordPathForAlarm) {
});
//使用bql語法
- // console.log(`local:|foxs:|alarm:|bql:select top 1 timestamp, sourceState, normalTime where alarmData.sourceName like '%${ordPathForAlarm.area_tag}_${ordPathForAlarm.building_tag}_${ordPathForAlarm.system_tag}_${ordPathForAlarm.name_tag}_%' order by timestamp desc`);
- baja.Ord.make(`local:|foxs:|alarm:|bql:select top 1 timestamp, sourceState, alarmData, alarmData.sourceName, normalTime where alarmData.sourceName like '%${ordPathForAlarm.area_tag}_${ordPathForAlarm.building_tag}_${ordPathForAlarm.system_tag}_${ordPathForAlarm.name_tag}_%' order by timestamp desc`)
+ // console.log(`local:|foxs:${port}|alarm:|bql:select top 1 timestamp, sourceState, normalTime where alarmData.sourceName like '%${ordPathForAlarm.area_tag}_${ordPathForAlarm.building_tag}_${ordPathForAlarm.system_tag}_${ordPathForAlarm.name_tag}_%' order by timestamp desc`);
+ baja.Ord.make(`local:|foxs:${port}|alarm:|bql:select top 1 timestamp, sourceState, alarmData, alarmData.sourceName, normalTime where alarmData.sourceName like '%${ordPathForAlarm.area_tag}_${ordPathForAlarm.building_tag}_${ordPathForAlarm.system_tag}_${ordPathForAlarm.name_tag}_%' order by timestamp desc`)
.get(
function (table) {
var tableStart, tableFinish;
@@ -637,8 +801,8 @@ function BajaSubscribeElectricmeterByBql(ordPathForElectricmeter) {
});
//使用bql語法
- // console.log(`local:|foxs:|station:|slot:/${ordPathForElectricmeter.devicePath}|bql:select name, out, out.value, slotPath, facets from control:ControlPoint`);
- baja.Ord.make(`local:|foxs:|station:|slot:/${ordPathForElectricmeter.devicePath}|bql:select name, out, out.value, slotPath, facets from control:ControlPoint`)
+ // console.log(`local:|foxs:${port}|station:|slot:/${ordPathForElectricmeter.devicePath}|bql:select name, out, out.value, slotPath, facets from control:ControlPoint`);
+ baja.Ord.make(`local:|foxs:${port}|station:|slot:/${ordPathForElectricmeter.devicePath}|bql:select name, out, out.value, slotPath, facets from control:ControlPoint`)
.get(
function (table) {
var tableStart, tableFinish;
@@ -702,7 +866,7 @@ function BajaSubscribeElectricmeterByBql(ordPathForElectricmeter) {
}
- baja.Ord.make("local:|foxs:|station:|" + this.getDisplay("slotPath"))
+ baja.Ord.make(`local:|foxs:${port}|station:|` + this.getDisplay("slotPath"))
.get()
.then(function (component) {
component_index++;
diff --git a/Frontend/js/site.js b/Frontend/js/site.js
index 7ee8352..185ade0 100644
--- a/Frontend/js/site.js
+++ b/Frontend/js/site.js
@@ -1,29 +1,28 @@
$(function () {
$(".dropdown-menu.dropdown-select-menu").each((index, value) => {
- setDropdownItem(value)
- })
-
-})
+ setDropdownItem(value);
+ });
+});
/**
-* fn 定義 | 手動初始化 Bootstrap dropdown select
-*/
+ * fn 定義 | 手動初始化 Bootstrap dropdown select
+ */
$.fn.droSetItem = function () {
setDropdownItem(this);
return this;
-}
+};
/**
-* fn 定義 | 輸出含原元素 html
-*/
+ * fn 定義 | 輸出含原元素 html
+ */
$.fn.outerHtml = function () {
return $(this).prop("outerHTML");
-}
+};
/**
-* fn 定義 | Loading 操作
-* @param {any} type - close / start / exceed , exceed => 繼續執行並可切換文字
-* @param {any} text - 右下角 Alert 文字
-*/
+ * fn 定義 | Loading 操作
+ * @param {any} type - close / start / exceed , exceed => 繼續執行並可切換文字
+ * @param {any} text - 右下角 Alert 文字
+ */
$.fn.Loading = function (type = "close", text) {
let ele = this;
let aleObj = $(this)[0]._aleObj;
@@ -37,7 +36,7 @@ $.fn.Loading = function (type = "close", text) {
if ($(ele).data("loading-show-status") == "close") {
$(ele).hide();
}
- })
+ });
}
function showLoading() {
$(ele).data("loading-show-status", "show");
@@ -58,7 +57,7 @@ $.fn.Loading = function (type = "close", text) {
}
return $(this);
-}
+};
$.fn.YTAlert = function () {
let th = { element: this };
@@ -66,25 +65,28 @@ $.fn.YTAlert = function () {
let obj = this;
setTimeout(function () {
$(obj.element).fadeOut(300);
- alertIdArray.splice($.inArray($(obj.element).prop("id"), alertIdArray), 1);
+ alertIdArray.splice(
+ $.inArray($(obj.element).prop("id"), alertIdArray),
+ 1
+ );
setTimeout(function () {
$(obj.element).remove();
}, 1000);
}, delay);
- }
+ };
th.text = function (text) {
let obj = this;
let id = $(obj.element).prop("id").split("tip-alert-")[1];
$(`#alert-text-${id}`).text(text);
- }
+ };
return th;
-}
+};
/**
-* 設置 bootstrap dropdown 為下拉選單
-* @param {any} menuEle - .dropdown-menu element
-*/
+ * 設置 bootstrap dropdown 為下拉選單
+ * @param {any} menuEle - .dropdown-menu element
+ */
function setDropdownItem(menuEle) {
if ($(menuEle).find(".dropdown-item.active").length == 0) {
$(menuEle).find(".dropdown-item").first().addClass("active");
@@ -98,115 +100,214 @@ function setDropdownItem(menuEle) {
$(menuEle).trigger("active:change", $(menuEle).find(".dropdown-item.active"));
//點選選項 add active class
- onEvent("click", ".dropdown-menu.dropdown-select-menu .dropdown-item", function () {
- $(this).parent(".dropdown-menu.dropdown-select-menu").find(".dropdown-item").removeClass("active");
- $(this).addClass("active");
- setDropdownItem($(this).parent(".dropdown-menu.dropdown-select-menu"));
- })
+ onEvent(
+ "click",
+ ".dropdown-menu.dropdown-select-menu .dropdown-item",
+ function () {
+ $(this)
+ .parent(".dropdown-menu.dropdown-select-menu")
+ .find(".dropdown-item")
+ .removeClass("active");
+ $(this).addClass("active");
+ setDropdownItem($(this).parent(".dropdown-menu.dropdown-select-menu"));
+ }
+ );
}
/**
-* 預設設備圖像
-* @param {any} obj
-*/
+ * 預設設備圖像
+ * @param {any} obj
+ */
function defDev(obj) {
- let defSrc = 'img/defdev.png';
+ let defSrc = "img/defdev.png";
obj.src = defSrc;
}
/**
-* jquery datatable - ajax send data reset
-* @param {any} table
-* @param {any} sendData
-*/
+ * jquery datatable - ajax send data reset
+ * @param {any} table
+ * @param {any} sendData
+ */
function dtAjaxResetSendData(table, sendData) {
table.context[0].ajax.data = function (d) {
d = sendData;
- return JSON.stringify(d)
- }
+ return JSON.stringify(d);
+ };
}
-
/**
-* element 建造
-* @param {any} text
-* @param {any} id
-* @param {any} name
-* @param {any} cls
-* @param {any} data
-* @param {any} attr
-*/
-function eleBuild(text = null, id = null, name = null, cls = [], data = {}, attr = {}) {
- cls = cls ?? [], data = data ?? {}, attr = attr ?? {};
+ * element 建造
+ * @param {any} text
+ * @param {any} id
+ * @param {any} name
+ * @param {any} cls
+ * @param {any} data
+ * @param {any} attr
+ */
+function eleBuild(
+ text = null,
+ id = null,
+ name = null,
+ cls = [],
+ data = {},
+ attr = {}
+) {
+ (cls = cls ?? []), (data = data ?? {}), (attr = attr ?? {});
id = id ? `id="${id}"` : "";
name = name ? `name="${name}"` : "";
- cls = cls.length != 0 ? `class="${cls.join(' ')}"` : "";
- data = data.length != 0 ? `${Object.keys(data).map(x => `data-${x}="${data[x]}"`).join(" ")}` : "";
- attr = attr ? `${Object.keys(attr).map(x => `${x}="${attr[x]}"`).join(" ")}` : "";
- let attrArr = [], attrText = "";
+ cls = cls.length != 0 ? `class="${cls.join(" ")}"` : "";
+ data =
+ data.length != 0
+ ? `${Object.keys(data)
+ .map((x) => `data-${x}="${data[x]}"`)
+ .join(" ")}`
+ : "";
+ attr = attr
+ ? `${Object.keys(attr)
+ .map((x) => `${x}="${attr[x]}"`)
+ .join(" ")}`
+ : "";
+ let attrArr = [],
+ attrText = "";
attrArr = [id, name, cls, data, attr];
- attrText = attrArr.filter(x => x != "").join(" ");
+ attrText = attrArr.filter((x) => x != "").join(" ");
text = text === null ? "" : text;
return { attrText: attrText, text: text };
}
-function creEle(ele, text = null, id = null, name = null, cls = [], data = {}, attr = {}) {
+function creEle(
+ ele,
+ text = null,
+ id = null,
+ name = null,
+ cls = [],
+ data = {},
+ attr = {}
+) {
let comp = eleBuild(text, id, name, cls, data, attr);
return $(`<${ele} ${comp.attrText}>${comp.text}${ele}>`);
}
-function creDiv(cls = [], attr = {}, id = null, name = null, data = {}, text = null) {
+function creDiv(
+ cls = [],
+ attr = {},
+ id = null,
+ name = null,
+ data = {},
+ text = null
+) {
return creEle("div", text, id, name, cls, data, attr);
}
-function creBtn(text = null, id = null, name = null, cls = [], data = {}, attr = {}) {
+function creBtn(
+ text = null,
+ id = null,
+ name = null,
+ cls = [],
+ data = {},
+ attr = {}
+) {
return creEle("button", text, id, name, cls, data, attr);
}
-function creBtnHtml(text = null, id = null, name = null, cls = [], data = {}, attr = {}) {
+function creBtnHtml(
+ text = null,
+ id = null,
+ name = null,
+ cls = [],
+ data = {},
+ attr = {}
+) {
return creEle("button", text, id, name, cls, data, attr).prop("outerHTML");
}
-function creSelect(id = null, cls = [], name = null, data = {}, attr = {}, text = null) {
+function creSelect(
+ id = null,
+ cls = [],
+ name = null,
+ data = {},
+ attr = {},
+ text = null
+) {
return creEle("select", text, id, name, cls, data, attr);
}
-function creOption(text = null, value = null, data = {}, attr = {}, cls = [], name = null, id = null) {
- value != null ? attr.value = value : attr;
+function creOption(
+ text = null,
+ value = null,
+ data = {},
+ attr = {},
+ cls = [],
+ name = null,
+ id = null
+) {
+ value != null ? (attr.value = value) : attr;
return creEle("option", text, id, name, cls, data, attr);
}
-function creImg(ele, text = null, id = null, name = null, cls = [], data = {}, attr = {}) {
+function creImg(
+ ele,
+ text = null,
+ id = null,
+ name = null,
+ cls = [],
+ data = {},
+ attr = {}
+) {
let comp = eleBuild(text, id, name, cls, data, attr);
return $(`<${ele} ${comp.attrText}>${comp.text}`);
}
-function creI(cls = [], data = {}, attr = {}, id = null, name = null, text = null) {
+function creI(
+ cls = [],
+ data = {},
+ attr = {},
+ id = null,
+ name = null,
+ text = null
+) {
return creEle("i", text, id, name, cls, data, attr);
}
-function creA(text = null, attr = {}, cls = [], id = null, data = {}, name = null) {
+function creA(
+ text = null,
+ attr = {},
+ cls = [],
+ id = null,
+ data = {},
+ name = null
+) {
return creEle("a", text, id, name, cls, data, attr);
}
-function creSpan(text = null, cls = [], id = null, attr = {}, data = {}, name = null) {
+function creSpan(
+ text = null,
+ cls = [],
+ id = null,
+ attr = {},
+ data = {},
+ name = null
+) {
return creEle("span", text, id, name, cls, data, attr);
}
/**
-* 根據該棟建築底下的'所有'電梯執行緒物件
-* */
+ * 根據該棟建築底下的'所有'電梯執行緒物件
+ * */
class ElevatorHandler {
constructor(ele, option = {}) {
this.ele = ele;
this.eleId = "";
this.eleWra = $("");
this.speed = 0.3;
- this.movStatus = {}; // {id:elevator01,value:0} 0=no 1=up 2=down
- this.floorHeight = typeof option.fHeight == "undefined" ? 60 : option.fHeight;
+ this.movStatus = {}; // {id:elevator01,value:0} 0=no 1=up 2=down
+ 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}
- this.curElevFloor = typeof option.curElevFloor == "undefined" ? {} : option.curElevFloor;
+ this.elevators =
+ typeof option.elevators == "undefined" ? [{}] : option.elevators; // {id:elevator01}
+ this.curElevFloor =
+ typeof option.curElevFloor == "undefined" ? {} : option.curElevFloor;
this.setTimeout = null;
this.init();
}
@@ -219,9 +320,9 @@ class ElevatorHandler {
if (Object.keys(this.curElevFloor).length != 0) {
$.each(Object.keys(this.curElevFloor), (idx, elevKey) => {
this.setElevFloor(elevKey, this.curElevFloor[elevKey]);
- })
+ });
}
- }
+ };
// 設置 wrapper
setTabWra = function () {
@@ -233,30 +334,63 @@ class ElevatorHandler {
let wrapper = creDiv(["elevator-table-wrapper"], null, `${id}_wrapper`);
$(this.ele).wrap(wrapper);
this.eleWra = wrapper;
- }
+ };
// 設置 table 樓層
setTabFloor = function () {
- let _w = this.floorWidth, _h = this.floorHeight;
- let thead = creEle("thead"), tbody = creEle("tbody");
- let _floors = this.floors, _ele = this.ele, _elevators = this.elevators;
+ let _w = this.floorWidth,
+ _h = this.floorHeight;
+ let thead = creEle("thead"),
+ tbody = creEle("tbody");
+ let _floors = this.floors,
+ _ele = this.ele,
+ _elevators = this.elevators;
//樓層從小到大
- _floors = _floors.oSort("sort").reverse().map(x => x.name);
+ _floors = _floors
+ .oSort("sort")
+ .reverse()
+ .map((x) => x.name);
let theadTr = creEle("tr");
for (let e = 1; e <= _elevators.length + 2; e++) {
let th = creEle("th");
- th.css({ "width": `${_w}px`, "height": `${_h}px`, "position": "relative" });
+ th.css({ width: `${_w}px`, height: `${_h}px`, position: "relative" });
if (e != 1 && e != _elevators.length + 2) {
let elevId = _elevators[e - 2]?.id;
// 電梯方框
- let span = creEle("span", null, "elevator-item-" + (elevId), null, ["elevator-item"]);
+ let span = creEle("span", null, "elevator-item-" + elevId, null, [
+ "elevator-item",
+ ]);
let spanUp = creEle("span", null, null, null, ["elevator-item-toup"]);
- let spanDown = creEle("span", null, null, null, ["elevator-item-todown"]);
- span.css({ "width": `${_w - 3}px`, "height": `${_h - 3}px`, "top": `1.5px`, "left": "1.5px", "transition": `transform ${1 / this.speed}s cubic-bezier(0.43, 0.05, 0.62, 1) 0s` })
- spanUp.css({ "width": `${_w - 3}px`, "height": `${(_h - 3) / 2}px`, "top": `1.5px`, "left": "1.5px", "transition": `transform ${1 / this.speed}s cubic-bezier(0.43, 0.05, 0.62, 1) 0s` })
- spanDown.css({ "width": `${_w - 3}px`, "height": `${(_h - 3) / 2}px`, "top": `1.5px`, "left": "1.5px", "transition": `transform ${1 / this.speed}s cubic-bezier(0.43, 0.05, 0.62, 1) 0s`, "top": `${1.5 + (_h - 3) / 2}px` })
+ let spanDown = creEle("span", null, null, null, [
+ "elevator-item-todown",
+ ]);
+ span.css({
+ width: `${_w - 3}px`,
+ height: `${_h - 3}px`,
+ top: `1.5px`,
+ left: "1.5px",
+ transition: `transform ${1 / this.speed
+ }s cubic-bezier(0.43, 0.05, 0.62, 1) 0s`,
+ });
+ spanUp.css({
+ width: `${_w - 3}px`,
+ height: `${(_h - 3) / 2}px`,
+ top: `1.5px`,
+ left: "1.5px",
+ transition: `transform ${1 / this.speed
+ }s cubic-bezier(0.43, 0.05, 0.62, 1) 0s`,
+ });
+ spanDown.css({
+ width: `${_w - 3}px`,
+ height: `${(_h - 3) / 2}px`,
+ top: `1.5px`,
+ left: "1.5px",
+ transition: `transform ${1 / this.speed
+ }s cubic-bezier(0.43, 0.05, 0.62, 1) 0s`,
+ top: `${1.5 + (_h - 3) / 2}px`,
+ });
th.append(spanUp);
th.append(span);
th.append(spanDown);
@@ -272,16 +406,20 @@ class ElevatorHandler {
for (let e = 1; e <= _elevators.length + 2; e++) {
let td = creEle("td");
- td.css({ "width": `${_w}px`, "height": `${_h}px` });
+ td.css({ width: `${_w}px`, height: `${_h}px` });
if (e == 1) {
- td.addClass("t-black")
+ td.addClass("t-black");
td.text(_floors[f - 1]);
} else if (e == _elevators.length + 2) {
- }
- else {
- let div = creDiv(["d-flex", "justify-content-center", "align-items-end", "h-100"]);
- div.append(``)
- td.append(div)
+ } else {
+ let div = creDiv([
+ "d-flex",
+ "justify-content-center",
+ "align-items-end",
+ "h-100",
+ ]);
+ div.append(``);
+ td.append(div);
}
tr.append(td);
}
@@ -292,70 +430,111 @@ class ElevatorHandler {
$(_ele).append(tbody);
//表格外圍無框線
- $(_ele).find("tbody tr").each((index, tr) => {
+ $(_ele)
+ .find("tbody tr")
+ .each((index, tr) => {
+ $(tr).find("td:eq(0)").css("border-left", "0");
+ $(tr).find("td:eq(-1)").css("border-right", "0");
- $(tr).find("td:eq(0)").css("border-left", "0");
- $(tr).find("td:eq(-1)").css("border-right", "0");
-
- if (index == 0) {
- $(tr).find("td").each((index, td) => {
- $(td).css("border-top", "0");
- })
- } else if (index == $("#floorTable tbody tr").length - 1) {
- $(tr).find("td").each((index, td) => {
- $(td).css("border-bottom", "0");
- })
- }
- })
-
- }
+ if (index == 0) {
+ $(tr)
+ .find("td")
+ .each((index, td) => {
+ $(td).css("border-top", "0");
+ });
+ } else if (index == $("#floorTable tbody tr").length - 1) {
+ $(tr)
+ .find("td")
+ .each((index, td) => {
+ $(td).css("border-bottom", "0");
+ });
+ }
+ });
+ };
// 設置某個電梯到某個樓層
setElevFloor = function (elevId, floId) {
let curFloId = this.curElevFloor[elevId];
- let curSort = this.floors.filter(x => x.id == curFloId).map(x => x.sort)[0];
- let tarSort = this.floors.filter(x => x.id == floId).map(x => x.sort)[0];
+ let curSort = this.floors
+ .filter((x) => x.id == curFloId)
+ .map((x) => x.sort)[0];
+ let tarSort = this.floors
+ .filter((x) => x.id == floId)
+ .map((x) => x.sort)[0];
let gapFloor = tarSort - curSort;
- let cssEle = [$(`#elevator-item-${elevId}`)[0], $(`#elevator-item-${elevId}`).prev("span.elevator-item-toup")[0], $(`#elevator-item-${elevId}`).next("span.elevator-item-todown")[0]]
+ let cssEle = [
+ $(`#elevator-item-${elevId}`)[0],
+ $(`#elevator-item-${elevId}`).prev("span.elevator-item-toup")[0],
+ $(`#elevator-item-${elevId}`).next("span.elevator-item-todown")[0],
+ ];
if (this.movStatus[elevId] != 0) {
- $(cssEle).css("transition", `transform ${1 / this.speed * Math.abs(gapFloor)}s cubic-bezier(0, 0, 0.62, 1) 0s`);
+ $(cssEle).css(
+ "transition",
+ `transform ${(1 / this.speed) * Math.abs(gapFloor)
+ }s cubic-bezier(0, 0, 0.62, 1) 0s`
+ );
}
clearTimeout(this.setTimeout);
this.setTimeout = setTimeout(() => {
- $(cssEle).css("transition", `transform ${1 / this.speed * Math.abs(gapFloor)}s cubic-bezier(0.43, 0.05, 0.62, 1) 0s`);
+ $(cssEle).css(
+ "transition",
+ `transform ${(1 / this.speed) * Math.abs(gapFloor)
+ }s cubic-bezier(0.43, 0.05, 0.62, 1) 0s`
+ );
this.setEleUpDownStyle(elevId);
- }, (1 / this.speed * Math.abs(gapFloor)) * 1000)
+ }, (1 / this.speed) * Math.abs(gapFloor) * 1000);
this.setEleUpDownStyle(elevId);
this.curElevFloor[elevId] = floId;
- $(cssEle).css("transition", `transform ${1 / this.speed * Math.abs(gapFloor)}s cubic-bezier(0.43, 0.05, 0.62, 1) 0s`)
- $(cssEle).css("transform", `translateY(${this.floorHeight * (this.floors.length - tarSort)}px)`);
- }
+ $(cssEle).css(
+ "transition",
+ `transform ${(1 / this.speed) * Math.abs(gapFloor)
+ }s cubic-bezier(0.43, 0.05, 0.62, 1) 0s`
+ );
+ $(cssEle).css(
+ "transform",
+ `translateY(${this.floorHeight * (this.floors.length - tarSort)}px)`
+ );
+ };
// 設定現在電梯狀態 (往上/往下/停止)
setEleMovStatus = function (elevId, status) {
this.movStatus[elevId] = status;
- }
+ };
// 電梯方框 往上或往下閃爍
setEleUpDownStyle = function (elevId) {
if (this.movStatus[elevId] == 1) {
- $(`#elevator-item-${elevId}`).next("span.elevator-item-todown").removeClass("light-flash-c-bd")
- $(`#elevator-item-${elevId}`).prev("span.elevator-item-toup").addClass("light-flash-c-bd")
- .css("--flash-color-1", "#44ea8e").css("--flash-color-2", "rgba(255,255,255,0)");
+ $(`#elevator-item-${elevId}`)
+ .next("span.elevator-item-todown")
+ .removeClass("light-flash-c-bd");
+ $(`#elevator-item-${elevId}`)
+ .prev("span.elevator-item-toup")
+ .addClass("light-flash-c-bd")
+ .css("--flash-color-1", "#44ea8e")
+ .css("--flash-color-2", "rgba(255,255,255,0)");
} else if (this.movStatus[elevId] == 2) {
- $(`#elevator-item-${elevId}`).prev("span.elevator-item-toup").removeClass("light-flash-c-bd")
- $(`#elevator-item-${elevId}`).next("span.elevator-item-todown").addClass("light-flash-c-bd")
- .css("--flash-color-1", "#44ea8e").css("--flash-color-2", "rgba(255,255,255,0)");
+ $(`#elevator-item-${elevId}`)
+ .prev("span.elevator-item-toup")
+ .removeClass("light-flash-c-bd");
+ $(`#elevator-item-${elevId}`)
+ .next("span.elevator-item-todown")
+ .addClass("light-flash-c-bd")
+ .css("--flash-color-1", "#44ea8e")
+ .css("--flash-color-2", "rgba(255,255,255,0)");
} else {
- $(`#elevator-item-${elevId}`).prev("span.elevator-item-toup").removeClass("light-flash-c-bd");
- $(`#elevator-item-${elevId}`).next("span.elevator-item-todown").removeClass("light-flash-c-bd");
+ $(`#elevator-item-${elevId}`)
+ .prev("span.elevator-item-toup")
+ .removeClass("light-flash-c-bd");
+ $(`#elevator-item-${elevId}`)
+ .next("span.elevator-item-todown")
+ .removeClass("light-flash-c-bd");
}
- }
+ };
// 設定現在某個電梯所在樓層
setCurElevFloor = function (elevId, floId) {
this.curElevFloor[elevId] = floId;
- }
+ };
// 重新繪製
redraw = function () {
@@ -364,10 +543,9 @@ class ElevatorHandler {
if (Object.keys(this.curElevFloor).length != 0) {
$.each(Object.keys(this.curElevFloor), (idx, elevKey) => {
this.setElevFloor(elevKey, this.curElevFloor[elevKey]);
- })
+ });
}
- }
-
+ };
}
// 從數字週數轉為中文週數
@@ -397,8 +575,8 @@ function strToDate(text, type = null, cal = 0, unit = "d") {
}
let calDay = function (_d, _cal) {
- return new Date(_d.getTime() + (cal * dec));
- }
+ return new Date(_d.getTime() + cal * dec);
+ };
let tarDate = new Date(text);
let result = 0;
@@ -423,18 +601,17 @@ function fullTime(time) {
}
function dateRanCutPart(start, end, cutNum) {
- let sTime = (new Date(start)).getTime();
- let eTime = (new Date(end)).getTime();
+ let sTime = new Date(start).getTime();
+ let eTime = new Date(end).getTime();
let cutTimeArr = [];
if (sTime < eTime) return [];
-
let partNum = (sTime - eTime) / cutNum;
for (let i = eTime; i <= sTime; i = i + partNum) {
- cutTimeArr.push(i)
+ cutTimeArr.push(i);
}
- cutTimeArr.forEach(x => new Date(x));
+ cutTimeArr.forEach((x) => new Date(x));
return cutTimeArr;
}
@@ -448,11 +625,25 @@ function isJSON(str) {
}
}
-function addBsToast(container, type = "warning", title = "", content = "", id, datas = {}, option = {}) {
- datas = Object.keys(datas).length != 0 ? `${Object.keys(datas).map(x => `data-${x}="${datas[x]}"`).join(" ")}` : "";
+function addBsToast(
+ container,
+ type = "warning",
+ title = "",
+ content = "",
+ id,
+ datas = {},
+ option = {}
+) {
+ datas =
+ Object.keys(datas).length != 0
+ ? `${Object.keys(datas)
+ .map((x) => `data-${x}="${datas[x]}"`)
+ .join(" ")}`
+ : "";
let iconClass = option.iconHtml ?? `fas fa-exclamation-triangle`;
let strHtml = `
-
+
- `;
i1 = (val.history_Sub_systems != null && i1 == null) ? index : null;
- }
+ }
$.each(val.history_Sub_systems, function (index2, val2) {
i2 = (val2.device != null && i2 == null) ? index2 : null;
-
+
strHtml += `
-
-
+
${val2.full_name}
@@ -197,7 +197,7 @@
$.each(val2.device, function (index3, val3) {
strHtml += `
- - + ${val3.full_name} @@ -213,20 +213,20 @@ } } else { - if (index2 == i2 && first) { - first = false; - pageAct.deviceNumber = val3.device_number; - pageAct.deviceName = val3.full_name; - devPointsList(); - } - } + if (index2 == i2 && first) { + first = false; + pageAct.deviceNumber = val3.device_number; + pageAct.deviceName = val3.full_name; + devPointsList(); + } + } }); strHtml += `
-
-
-
-
-
-
-
+
+
-
-->
+
\ No newline at end of file
+ function show3DModel(urn) {
+ $(loadEle).Loading("start");
+ launchViewerForHotspot(
+ urn,
+ (viewer, nodeIds) => {
+ // 隱藏 toolbar
+ // document.querySelector("#guiviewer3d-toolbar").style.display = "none";
+ let devDbIds = allDevList.map((x) => x.forge_dbid);
+ // 大類
+ let subDevDbId = [];
+ allDevList.forEach(({ device_nodes }) => {
+ subDevDbId = [
+ ...subDevDbId,
+ ...device_nodes.map((n) => n.forge_dbid),
+ ];
+ });
+ // console.log(devDbIds, subDevDbId)
+ // 從資料庫設定不可視模型的類型,若沒有取道該小類不可視類型,則套用資料庫設定預設類型
+ if (forgeInvType) {
+ setInviForge(forgeInvType, [...devDbIds, ...subDevDbId]);
+ } else {
+ setInviForge(forgeInvTypeDef, [...devDbIds, ...subDevDbId]);
+ }
+
+ $(loadEle).Loading("close");
+ let sensorObjs = [];
+ let devices = [];
+ if (pageAct.sysSubTag === "M12") {
+ addHotPoint(viewer);
+ allDevList.forEach((device) => {
+ Forge3DSensor.sensorTimes++;
+ const sensorObj = new Forge3DSensor({
+ viewer: viewer,
+ ordPath: {
+ area_tag: pageAct.AreaTag,
+ building_tag: pageAct.buiTag,
+ },
+ selector: "[name=forgeViewer]",
+ elevCb: elevatorShow
+ ? () => {
+ let elevOption = {
+ selector: "[name=forgeViewer]",
+ viewer: viewer,
+ ordPath: {
+ area_tag: pageAct.AreaTag,
+ building_tag: pageAct.buiTag,
+ },
+ sensorObjs,
+ };
+
+ // 電梯移動訂閱程序載入
+ let forge3DElev = new Forge3DElevFull(elevOption);
+ forge3DElev.bajaEndCallback = function () {
+ endPageLoading();
+ };
+ forge3DElev.init();
+ }
+ : null,
+ curDevice: {
+ ...device,
+ roomDbId: !isNaN(parseInt(device.room_dbid))
+ ? parseInt(device.room_dbid)
+ : -1,
+ id: device.device_number,
+ position: isJSON(device.device_coordinate_3d)
+ ? JSON.parse(device.device_coordinate_3d)
+ : {}, // x: 0, y: 25, z: -2.5 (3.35, -4.81, 12.88
+ temp: 25,
+ forge_dbid: parseInt(device.forge_dbid),
+ },
+ deviceList: allDevList.map((d) => ({
+ ...d,
+ roomDbId: !isNaN(parseInt(d.room_dbid))
+ ? parseInt(d.room_dbid)
+ : -1,
+ id: d.device_number,
+ position: isJSON(d.device_coordinate_3d)
+ ? JSON.parse(d.device_coordinate_3d)
+ : {}, // x: 0, y: 25, z: -2.5 (3.35, -4.81, 12.88
+ temp: 25,
+ forge_dbid: parseInt(d.forge_dbid),
+ })),
+ });
+ sensorObjs.push(sensorObj);
+ });
+ } else {
+ devices = allDevList.map((x) => {
+ return {
+ roomDbId: !isNaN(parseInt(x.room_dbid))
+ ? parseInt(x.room_dbid)
+ : -1,
+ id: x.device_number,
+ position: isJSON(x.device_coordinate_3d)
+ ? JSON.parse(x.device_coordinate_3d)
+ : {}, // x: 0, y: 25, z: -2.5 (3.35, -4.81, 12.88
+ sensorTypes: ["temperature", "humidity"],
+ temp: 30,
+ forgeDbId: parseInt(x.forge_dbid),
+ };
+ });
+
+ if (
+ (pageAct.sysSubTag == "M12" || pageAct.sysSubTag == "ELEV") &&
+ elevatorShow
+ ) {
+ let elevOption = {
+ selector: "[name=forgeViewer]",
+ viewer: viewer,
+ ordPath: {
+ area_tag: pageAct.AreaTag,
+ building_tag: pageAct.buiTag,
+ },
+ };
+
+ // 電梯移動訂閱程序載入
+ let forge3DElev = new Forge3DElevFull(elevOption);
+ forge3DElev.bajaEndCallback = function () {
+ endPageLoading();
+ };
+ forge3DElev.init();
+ }
+ }
+
+ let option = {
+ devices: devices,
+ };
+
+ if (pageAct.sysSubTag !== "M12") {
+ // console.log(pageAct.sysSubTag, option)
+ heatMap = new ADHeatMaps(option);
+ heatMap.onComplete = () => {
+ $.each(allDevList, (idx, dev) => {
+ heatMap.changeTemp(dev.device_number, dev._temp || 0);
+ });
+ subDevice();
+ };
+ }
+ if (subDeviceData.length != 0) {
+ let stSubArr = subDeviceData.map((x) =>
+ Object.keys(x)
+ .filter((y) => y == "ST")
+ .map((y) => x)
+ );
+
+ for (let sub of stSubArr) {
+ let matchDevice = allDevList.filter(
+ (x) => x.device_number == sub[0]?.device_number
+ )[0];
+ if (matchDevice) {
+ setForgeHotSpotColor(matchDevice);
+ }
+ }
+ }
+ if (pageAct.sysSubTag == "W2") {
+ // console.log("@@",pageAct, pageAct.sub_system_tag)
+ getWaterNodeId(viewer);
+ } else if (pageAct.sysSubTag == "E1") {
+ getE1NodeId(viewer);
+ }
+ },
+ () => {
+ $(loadEle).Loading("close");
+ },
+ "[name=forgeViewer]"
+ );
+ }
+
+ // 供水系統 - 取得欲染色 dbid
+ function getWaterNodeId() {
+ // let url = baseApiUrl + "/api/Device/GetForgeNodeIdFromVar";
+ // let sendData = { forgeNodeKey: "water_wupply" };
+ // objSendData.Data = sendData;
+ // ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
+ // if (!res || res.code != "0000" || !res.data) {
+
+ // } else {
+ // if (!isNaN(parseInt(res.data[0]?.system_value))) {
+ // changeColor(parseInt(res.data[0]?.system_value))
+ // }
+ // console.log(res.data)
+ // }
+ // }, null, "POST").send();
+ // console.log("1",viewer.model)
+ viewer.model.search(
+ "給水",
+ (nodeIds) => {
+ // console.log("2",nodeIds)
+ viewer.show(nodeIds);
+ },
+ (e) => {
+ console.log(e);
+ }
+ );
+ }
+
+ // 高壓配電盤染色
+ function getE1NodeId() {
+ viewer.model.search(
+ "高壓電力",
+ (nodeIds) => {
+ viewer.show(nodeIds);
+ },
+ (e) => {
+ console.log(e);
+ }
+ );
+ }
+
+ function getHotspotPoint(callback = null) {
+ let url = baseApiUrl + "/api/GetDevForCor";
+ let sendData = {
+ device_area_tag: pageAct.AreaTag,
+ device_building_tag: pageAct.buiTag,
+ device_system_tag: pageAct.sysMainTag,
+ device_name_tag: pageAct.sysSubTag,
+ };
+ objSendData.Data = sendData;
+ ytAjax = new YourTeam.Ajax(
+ url,
+ objSendData,
+ function (res) {
+ if (!res || res.code != "0000" || !res.data) {
+ } else {
+ let myDataList = [];
+ $.each(res.data, (idx, data) => {
+ let item = {};
+ item.position = {};
+ if (
+ data.device_coordinate_3d != null &&
+ isJSON(data.device_coordinate_3d)
+ ) {
+ item.position = JSON.parse(data.device_coordinate_3d);
+ }
+ $.extend(item, data);
+ myDataList.push(item);
+ });
+ setHotspotPoint(myDataList);
+ if (pageAct.sysMainTag == "LT") {
+ setLightPoint(myDataList);
+ }
+ callback ? callback() : "";
+ }
+ },
+ null,
+ "POST"
+ ).send();
+ }
+
+ function setHotspotPoint(myDataList = []) {
+ getHopspotPoint(myDataList);
+ }
+
+ function setLightPoint(myDataList = []) {
+ getLightData(myDataList);
+ }
+
+ // 取得 不可視 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();
+ }
+
+ // 設置 模型隱藏或透明
+ function setInviForge(type, devDbIds) {
+ if (type == "Hide") {
+ hideAllObjects(devDbIds);
+ } else if (type == "Opacity") {
+ setTransparentBuilding(0, devDbIds);
+ }
+ }
+
+ var parentEle = "";
+ onEvent("autodesk:click:sprite", "[name=forgeViewer]", function (e, obj) {
+ forgeUnFocusAll();
+ let rect = $("[name=forgeViewer]")[0].getBoundingClientRect();
+ let position = [rect.left + rect.width / 2, rect.top + rect.height / 3];
+ // let position = [obj.event.target.toolController.lastClickX - 300, obj.event.target.toolController.lastClickY - 300];
+ let devObj = obj.myData;
+ let name =
+ allDevList.filter((x) => x.device_guid == devObj.device_guid)[0]
+ ?.full_name || devObj.full_name;
+ devObj.full_name = name;
+ parentEle = crePosPopover(position, devObj);
+ $(parentEle).click();
+ });
+
+ onEvent("autodesk:clickOut:sprite", "[name=forgeViewer]", function (e) {
+ $(parentEle).YTTooltip("hide");
+ });
+
+ onEvent("autodesk:complete:sprite", "[name=forgeViewer]", function (e, obj) {
+ $("#floDevList a[name=devItem]").each((idx, ele) => {
+ let devNum = $(ele).data("number");
+ let dbid = obj.myDataList.filter((x) => x.device_number == devNum)[0]
+ ?._dbId;
+ allDevList.forEach((dev, idx) => {
+ if (dev.device_number == devNum) {
+ dev.spriteDbid = dbid;
+ setForgeHotSpotColor(dev);
+ }
+ });
+ $(ele).data("dbId", dbid);
+ });
+ });
+
+ onEvent("yt:tooltip:show", "[name=devItem]", function (e, obj) {
+ forgeUnFocusAll();
+ });
+
+ function forgeUnFocusAll() {
+ $("#floDevList a[name=devItem]").each((idx, ele) => {
+ const eleDbId = $(ele).data("dbId");
+ if (alarmDbIdList.some((dbId) => dbId == eleDbId)) {
+ changeScaleForHotspot(eleDbId, false);
+ return;
+ } else {
+ // 3D 熱點解除
+ controlFocusHotspot(eleDbId, false);
+ }
+ });
+ }
+
diff --git a/Frontend/_sysMonFloor.html b/Frontend/_sysMonFloor.html
index f8d7481..7dc787e 100644
--- a/Frontend/_sysMonFloor.html
+++ b/Frontend/_sysMonFloor.html
@@ -1,5 +1,5 @@
@@ -15,21 +15,22 @@
-
- 燈控排程 -
-
-
-
+
- 關閉
- 儲存
+
+ 關閉
+
+
+ 儲存
+
-
+
-
-
-->
+
-
+
+
+
+
-
+
`;
}
/**
-* 取得資料庫電梯設備,根據 baja 訂閱移動 3D 電梯
-* */
+ * 取得資料庫電梯設備,根據 baja 訂閱移動 3D 電梯
+ * */
class Forge3DElevFull {
constructor(option = {}) {
- this.allElevDevList = []; //全電梯設備清單
- this.subSeviceData = []; //每個設備訂閱點位值
+ this.allElevDevList = []; //全電梯設備清單
+ this.subSeviceData = []; //每個設備訂閱點位值
this.floList = [];
this.elev3DBind = {};
this.elev3DOption = {};
@@ -497,7 +688,7 @@ class Forge3DElevFull {
// this.getSensorDevList();
// }
this.getElevDevList();
- }
+ };
// 訂閱電梯設備
subElevDevice = function () {
@@ -512,20 +703,28 @@ class Forge3DElevFull {
}
data.device_number = data.device_number_full;
- let matchDevice = this.allElevDevList.filter(x => x.device_number == data.device_number)[0];
+ let matchDevice = this.allElevDevList.filter(
+ (x) => x.device_number == data.device_number
+ )[0];
if (!matchDevice) {
return;
}
//將訂閱值塞入 subSeviceData
- if (this.subSeviceData.findIndex(x => x.device_number == matchDevice.device_number) == -1) {
+ if (
+ this.subSeviceData.findIndex(
+ (x) => x.device_number == matchDevice.device_number
+ ) == -1
+ ) {
let obj = {};
obj.device_number = matchDevice.device_number;
- this.subSeviceData.push(obj)
+ this.subSeviceData.push(obj);
}
- let subData = this.subSeviceData.filter(x => x.device_number == matchDevice.device_number)[0];
+ let subData = this.subSeviceData.filter(
+ (x) => x.device_number == matchDevice.device_number
+ )[0];
if (subData) {
subData[data.point_name] = data.value;
@@ -533,31 +732,45 @@ class Forge3DElevFull {
if (data.point_name == "CP") {
if (this.elev3DObj.length != 0) {
- let elevObj = this.elev3DObj.filter(x => x.nodeId == this.elev3DBind[matchDevice.device_number])[0];
+ let elevObj = this.elev3DObj.filter(
+ (x) => x.nodeId == this.elev3DBind[matchDevice.device_number]
+ )[0];
if (elevObj && elevObj.id) {
-
- elevObj.obj.setElevatorFloor(data.value)
+ elevObj.obj.setElevatorFloor(data.value);
elevObj.obj.movElevator();
}
}
}
-
});
myBaja.setSubscribeDeviceEndCallBack((data) => {
- this.floList = data.filter(x => x.point_name.startsWith("SP_FLS_")).map(x => x?.point_name?.split("SP_FLS_")[1]).Distinct();
+ this.floList = data
+ .filter((x) => x.point_name.startsWith("SP_FLS_"))
+ .map((x) => x?.point_name?.split("SP_FLS_")[1])
+ .Distinct();
this.set3DElevOpt(data);
this.bajaEndCallback != null ? this.bajaEndCallback() : "";
});
- }
+ };
// 電梯 3D Option 設置
set3DElevOpt = function (data) {
- let devNumArr = data.map(x => { return { devNum: x.device_number_full, priority: this.allElevDevList.filter(y => y.device_number == x.device_number_full)[0]?.priority } }).DistinctBy("devNum");
+ let devNumArr = data
+ .map((x) => {
+ return {
+ devNum: x.device_number_full,
+ priority: this.allElevDevList.filter(
+ (y) => y.device_number == x.device_number_full
+ )[0]?.priority,
+ };
+ })
+ .DistinctBy("devNum");
devNumArr = devNumArr.oSort("priority");
$.each(devNumArr, (idx, devObj) => {
let devNum = devObj.devNum;
- let subData = this.subSeviceData.filter(x => x.device_number == devNum)[0];
+ let subData = this.subSeviceData.filter(
+ (x) => x.device_number == devNum
+ )[0];
if (subData) {
//// 左側 3D 電梯 nodeID 與 device_number match
@@ -567,7 +780,9 @@ class Forge3DElevFull {
// 左側 3D 電梯 Viewer Option 設置
/*elev3DOption.nodes = Object.keys(elev3DBind).map(x => elev3DBind[x]);*/
this.elev3DOption.nodeId = this.elev3DBind[devNum];
- this.elev3DOption.floorHeight = this.floList.map((x) => { return { floor: x } });
+ this.elev3DOption.floorHeight = this.floList.map((x) => {
+ return { floor: x };
+ });
this.elev3DOption.floorHeight.forEach((floObj, idx) => {
if (floObj.floor.startsWith("B")) {
let floor = parseInt(floObj.floor.split("B")[1].split("F")[0]);
@@ -579,46 +794,61 @@ class Forge3DElevFull {
} else if (floor == 2) {
floObj.height = 14.75;
} else {
- floObj.height = (14.75 + ((floor - 2) * 9.75));
+ floObj.height = 14.75 + (floor - 2) * 9.75;
}
}
- })
+ });
if (this.elev3DObj.length != 0) {
- let elevObj = this.elev3DObj.filter(x => x.nodeId == this.elev3DBind[devNum])[0];
+ let elevObj = this.elev3DObj.filter(
+ (x) => x.nodeId == this.elev3DBind[devNum]
+ )[0];
if (!elevObj.id) {
elevObj.id = devNum;
}
elevObj.obj = Object.assign(elevObj.obj, this.elev3DOption);
elevObj.obj.init(() => {
- let frags = elevObj.obj.fragProxys.filter(x => x.nodeId == this.elev3DBind[devNum]);
+ let frags = elevObj.obj.fragProxys.filter(
+ (x) => x.nodeId == this.elev3DBind[devNum]
+ );
frags.forEach((fragProxy) => {
- fragProxy.frag.position.z = this.elev3DOption.floorHeight.filter(x => x.floor == subData["CP"])[0]?.height ?? 0;
+ fragProxy.frag.position.z =
+ this.elev3DOption.floorHeight.filter(
+ (x) => x.floor == subData["CP"]
+ )[0]?.height ?? 0;
let start = 0;
// 改變感測器熱點位置
- this.sensorObjs && this.sensorObjs[0]?.changePos(node+2, fragProxy.frag.position.z);
+ this.sensorObjs &&
+ this.sensorObjs[0]?.changePos(
+ node + 2,
+ fragProxy.frag.position.z
+ );
// if (node === 15200 && start == 0) {
// start = 1;
// }
fragProxy.frag.updateAnimTransform();
- })
+ });
elevObj.obj.viewer.impl.sceneUpdated(true);
});
}
}
- })
+ });
this.set3DElevPos();
- }
+ };
// 電梯 3D 位置呈現
set3DElevPos = function () {
- let nodeIds = this.allElevDevList.filter(x => !isNaN(parseInt(x.forge_dbid))).map(x => { return { devNum: x.device_number, nodeId: parseInt(x.forge_dbid) } });
+ let nodeIds = this.allElevDevList
+ .filter((x) => !isNaN(parseInt(x.forge_dbid)))
+ .map((x) => {
+ return { devNum: x.device_number, nodeId: parseInt(x.forge_dbid) };
+ });
$.each(nodeIds, (idx, item) => {
this.elev3DBind[item.devNum] = item.nodeId;
- })
- nodeIds = nodeIds.map(x => x.nodeId);
+ });
+ nodeIds = nodeIds.map((x) => x.nodeId);
$.each(nodeIds, (idx, node) => {
let options = {
element: $(this.selector),
@@ -626,43 +856,50 @@ class Forge3DElevFull {
nodeId: node,
floorHeight: this.elev3DOption.floorHeight ?? [],
sensorObjs: this.sensorObjs,
- inited: function () {
-
- }
- }
+ inited: function () { },
+ };
let elevator3DObj = new elevator3D(options);
- let devNum = Object.keys(this.elev3DBind).filter(x => this.elev3DBind[x] == node)[0];
- let subData = this.subSeviceData.filter(x => x.device_number == devNum)[0];
+ let devNum = Object.keys(this.elev3DBind).filter(
+ (x) => this.elev3DBind[x] == node
+ )[0];
+ let subData = this.subSeviceData.filter(
+ (x) => x.device_number == devNum
+ )[0];
- if (this.elev3DObj.filter(x => x.nodeId == node).length == 0) {
+ if (this.elev3DObj.filter((x) => x.nodeId == node).length == 0) {
this.elev3DObj.push({ id: devNum, nodeId: node, obj: elevator3DObj });
}
if (subData) {
- let elevObj = this.elev3DObj.filter(x => x.nodeId == node)[0];
+ let elevObj = this.elev3DObj.filter((x) => x.nodeId == node)[0];
if (!elevObj.id) {
elevObj.id = devNum;
}
- elevObj.obj = Object.assign(elevObj, elevator3DObj ?? {})
+ elevObj.obj = Object.assign(elevObj, elevator3DObj ?? {});
elevObj.obj.init(() => {
- let frags = elevObj.obj.fragProxys.filter(x => x.nodeId == node);
+ let frags = elevObj.obj.fragProxys.filter((x) => x.nodeId == node);
frags.forEach((fragProxy) => {
- fragProxy.frag.position.z = this.elev3DOption.floorHeight.filter(x => x.floor == subData["CP"])[0]?.height ?? 0;
+ fragProxy.frag.position.z =
+ this.elev3DOption.floorHeight.filter(
+ (x) => x.floor == subData["CP"]
+ )[0]?.height ?? 0;
let start = 0;
- this.sensorObjs && this.sensorObjs[0]?.changePos(node+2, fragProxy.frag.position.z);
+ this.sensorObjs &&
+ this.sensorObjs[0]?.changePos(
+ node + 2,
+ fragProxy.frag.position.z
+ );
// if (node === 15200 && start == 0) {
// // 改變感測器熱點位置
// start = 1;
// }
- fragProxy.frag.updateAnimTransform()
- })
+ fragProxy.frag.updateAnimTransform();
+ });
elevObj.obj.viewer.impl.sceneUpdated(true);
- })
-
-
+ });
}
- })
- }
+ });
+ };
// 取得設備列表
getElevDevList = function () {
@@ -672,35 +909,38 @@ class Forge3DElevFull {
building_tag: this.ordPath.building_tag,
};
objSendData.Data = sendData;
- ytAjax = new YourTeam.Ajax(url, objSendData, (res) => {
- if (!res || res.code != "0000" || !res.data) {
-
- } else {
- $.each(res.data, (index, floObj) => {
- $.each(floObj.device_list, (index2, devObj) => {
- this.allElevDevList.push(devObj);
- })
- })
- this.subElevDevice();
- }
- }, null, "POST").send();
- }
+ ytAjax = new YourTeam.Ajax(
+ url,
+ objSendData,
+ (res) => {
+ if (!res || res.code != "0000" || !res.data) {
+ } else {
+ $.each(res.data, (index, floObj) => {
+ $.each(floObj.device_list, (index2, devObj) => {
+ this.allElevDevList.push(devObj);
+ });
+ });
+ this.subElevDevice();
+ }
+ },
+ null,
+ "POST"
+ ).send();
+ };
getNodeIds = function () {
- return this.elev3DObj.map(x => x.nodeId);
- }
+ return this.elev3DObj.map((x) => x.nodeId);
+ };
}
-
-
/**
-* 取得資料庫溫度感測器
-* 1. baja 取得溫度感測器改變顏色
-* 2. 參數取得要移動到的電梯位置
-* */
+ * 取得資料庫溫度感測器
+ * 1. baja 取得溫度感測器改變顏色
+ * 2. 參數取得要移動到的電梯位置
+ * */
class Forge3DSensor {
constructor(option = {}) {
- this.subDeviceData = []; //每個設備訂閱點位值
+ this.subDeviceData = []; //每個設備訂閱點位值
this.viewer = option.viewer ?? null;
this.ordPath = option.ordPath; // TPE_B1
this.sysMainTag = "ME";
@@ -714,24 +954,27 @@ class Forge3DSensor {
this.DataVizCore = null;
this.tempVal = 20;
this.curDevice = option.curDevice ?? null;
- this.selector=option.selector?? "#forgeViewer"
- this.elevCb = option.elevCb?? null
+ this.deviceList = option.deviceList ?? null;
+ this.selector = option.selector ?? "#forgeViewer";
+ this.elevCb = option.elevCb ?? null;
this.#init();
}
+ static sensorTimes = 0;
+
#init = async function () {
// 系統大類、小類固定
this.ordPath.system_tag = this.sysMainTag;
this.ordPath.name_tag = this.sysSubTag;
- this.dataVizExtn = await this.viewer.loadExtension("Autodesk.DataVisualization");
- this.DataVizCore = Autodesk.DataVisualization.Core;
- await this.registerHotPoint()
- this.changeColorForSensorHotspot(this.curDevice.forge_dbid, 35)
+ // this.dataVizExtn = await this.viewer.loadExtension(
+ // "Autodesk.DataVisualization"
+ // );
+ // this.DataVizCore = Autodesk.DataVisualization.Core;
+ await this.registerHotPoint();
+ this.addSensorHotspotList(this.curDevice.forge_dbid, 35);
this.subSensorDevice();
- this.elevCb()
-
-
- }
+ this.elevCb && this.elevCb();
+ };
// // 建立熱點
// async addHotPoint() {
@@ -743,113 +986,165 @@ class Forge3DSensor {
// }
async registerHotPoint(color = "") {
- var viewer = this.viewer;
- const viewableType = this.DataVizCore.ViewableType.SPRITE;//DataVizCore.ViewableType.SPRITE;
- const spriteColor = new THREE.Color(0xff8c00);
- // const highlightedColor = new THREE.Color(0xe0e0ff);
- let spriteIcon = "/file/img/forge/sensor_circle.svg";
- if (location.href.indexOf("localhost:5966") != -1) {
- spriteIcon = "/img/forge/sensor_circle.svg";
+ if (Forge3DSensor.sensorTimes === 1) {
+ var viewer = this.viewer;
+ const dataVizExtn = await viewer.loadExtension(
+ "Autodesk.DataVisualization"
+ );
+ const DataVizCore = Autodesk.DataVisualization.Core;
+ const viewableType = DataVizCore.ViewableType.SPRITE; //DataVizCore.ViewableType.SPRITE;
+ const spriteColor = new THREE.Color(0xff8c00);
+ // const highlightedColor = new THREE.Color(0xe0e0ff);
+ let spriteIcon = "/file/img/forge/sensor_circle.svg";
+ if (location.href.indexOf("localhost:5966") != -1) {
+ spriteIcon = "/img/forge/sensor_circle.svg";
+ }
+ const style = new DataVizCore.ViewableStyle(
+ viewableType,
+ spriteColor,
+ spriteIcon
+ );
+ const viewableData = new DataVizCore.ViewableData();
+ viewableData.spriteSize = 30; // Sprites as points of size 24 x 24 pixels
+ this.deviceList.forEach((myData, index) => {
+ // console.log(myData)
+ const dbId = myData.forge_dbid;
+ const myPosition = myData.position;
+ const viewable = new DataVizCore.SpriteViewable(
+ myPosition,
+ style,
+ dbId
+ );
+ myData._dbId = dbId;
+ viewableData.addViewable(viewable);
+ });
+ await viewableData.finish();
+ dataVizExtn.addViewables(viewableData);
+ viewer.addEventListener(
+ DataVizCore.MOUSE_CLICK,
+ this.onSpriteClicked.bind(this)
+ ); // SPRITE_SELECTED
+ // viewer.addEventListener(this.DataVizCore.MOUSE_CLICK_OUT, onSpriteClickedOut.bind(this));
}
- const style = new this.DataVizCore.ViewableStyle(viewableType, spriteColor, spriteIcon);
-
- const viewableData = new this.DataVizCore.ViewableData();
- viewableData.spriteSize = 30; // Sprites as points of size 24 x 24 pixels
- // console.log(this.curDevice, [this.curDevice])
-
- [this.curDevice].forEach((myData, index) => {
- // console.log(myData)
- const dbId = myData.forge_dbid;
- const myPosition = myData.position;
- const viewable = new this.DataVizCore.SpriteViewable(myPosition, style, dbId);
- myData._dbId = dbId;
- viewableData.addViewable(viewable);
- });
- // console.log(viewableData)
- await viewableData.finish();
- this.dataVizExtn.addViewables(viewableData);
- // console.log("1",this.dataVizExtn)
- viewer.addEventListener(this.DataVizCore.MOUSE_CLICK, this.onSpriteClicked.bind(this));// SPRITE_SELECTED
- // viewer.addEventListener(this.DataVizCore.MOUSE_CLICK_OUT, onSpriteClickedOut.bind(this));
-
}
// ---------------- 熱點點擊事件 --------------------
onSpriteClicked(event) {
- console.log(event)
event.hasStopped = true;
const dbIdStart = 10;
if (event != undefined && event != null) {
if (event.dbId >= dbIdStart) {
- let myData = [this.curDevice].filter(x => x.forge_dbid == event.dbId)[0];
- this.changeColorForSensorHotspot(event.dbId, this.tempVal)
- moveViewToDevice(myData.forge_dbid);//移動視角至該設備
- $(this.selector).trigger("autodesk:click:sprite", { event, myData });
+ let myData = this.deviceList.find((x) => x.forge_dbid == event.dbId);
+ console.log("site", myData);
+ // this.changeColorForSensorHotspot(event.dbId, this.tempVal);
+ myData && moveViewToDevice(myData.forge_dbid); //移動視角至該設備
+ myData &&
+ $(this.selector).trigger("autodesk:click:sprite", { event, myData });
} else {
$(this.selector).trigger("autodesk:clickOut:sprite", { event });
}
}
}
-
// 改變熱點位置
async changePos(dbId, positionZ) {
- // const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization") || this.dataVizExtn;
- this.dataVizExtn?.invalidateViewables(dbId, (viewable) => {
+ const dataVizExtn = await viewer.loadExtension(
+ "Autodesk.DataVisualization"
+ );
+ dataVizExtn?.invalidateViewables(dbId, (viewable) => {
// console.log(viewable._position)
- const z = viewable._position.z + positionZ
- const newPos = { ...viewable._position, z }
+ const z = viewable._position.z + positionZ;
+ const newPos = { ...viewable._position, z };
return {
// Move the viewable to a new location.
- position: newPos
+ position: newPos,
};
});
}
- // 熱點 更換顏色---環境感知器
- async changeColorForSensorHotspot(dbId, temp) {
- // const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization");
- const temps = [new THREE.Color(0x00009c), new THREE.Color(0xffff31), new THREE.Color(0xff8c00), new THREE.Color(0xff0000)]
- let index = Math.floor(temp / 10) - 1 || 0;
- if (index > 3) {
- index = 3
- }
- const viewablesToUpdate = dbId;
- const color = temps[index]
- // debugger
- // this.registerHotPoint(color)
- // const _this=this
- // setInterval(() => {
- // _this.dataVizExtn.invalidateViewables(viewablesToUpdate, (viewable) => {
- // return { color: color };
- // });
- // // sceneUpdated(true)
- // }, 1000);
- this.dataVizExtn.invalidateViewables(viewablesToUpdate, (viewable) => {
+ // 溫度感測器 sprite 隨溫度變化
+ static lowerTempForSensor = [];
+ static normalTempForSensor = [];
+ static highTempForSensor = [];
+ static highestTempForSensor = [];
+ async addSensorHotspotList(dbid, temp) {
+ let index = Math.floor(temp / 10) - 1 || 0;
+
+ // 清空資料
+ Forge3DSensor.lowerTempForSensor = Forge3DSensor.lowerTempForSensor.filter(
+ (point) => point !== dbid
+ );
+ Forge3DSensor.normalTempForSensor =
+ Forge3DSensor.normalTempForSensor.filter((point) => point !== dbid);
+ Forge3DSensor.highTempForSensor = Forge3DSensor.highTempForSensor.filter(
+ (point) => point !== dbid
+ );
+ Forge3DSensor.highestTempForSensor =
+ Forge3DSensor.highestTempForSensor.filter((point) => point !== dbid);
+
+ const temps = [
+ new THREE.Color(0x00009c),
+ new THREE.Color(0xffff31),
+ new THREE.Color(0xff8c00),
+ new THREE.Color(0xff0000),
+ ];
+
+ switch (index) {
+ case -1:
+ Forge3DSensor.lowerTempForSensor.push(dbid);
+ break;
+ case 0:
+ Forge3DSensor.lowerTempForSensor.push(dbid);
+ break;
+ case 1:
+ Forge3DSensor.normalTempForSensor.push(dbid);
+ break;
+ case 2:
+ Forge3DSensor.highTempForSensor.push(dbid);
+ break;
+ case 3:
+ Forge3DSensor.highestTempForSensor.push(dbid);
+ break;
+ default:
+ Forge3DSensor.highTempForSensor.push(dbid);
+ break;
+ }
+
+ await this.changeColorForSensorHotspot(
+ Forge3DSensor.lowerTempForSensor,
+ temps[0]
+ );
+ await this.changeColorForSensorHotspot(
+ Forge3DSensor.normalTempForSensor,
+ temps[1]
+ );
+ await this.changeColorForSensorHotspot(
+ Forge3DSensor.highTempForSensor,
+ temps[2]
+ );
+ await this.changeColorForSensorHotspot(
+ Forge3DSensor.highestTempForSensor,
+ temps[3]
+ );
+ }
+
+ async changeColorForSensorHotspot(viewablesToUpdate, color) {
+ const dataVizExtn = await viewer.loadExtension(
+ "Autodesk.DataVisualization"
+ );
+ dataVizExtn.invalidateViewables(viewablesToUpdate, (viewable) => {
return {
color: color,
};
});
- // debugger
- // console.log("3", this.dataVizExtn)
}
// 訂閱sensor設備
subSensorDevice() {
- // console.log("sensor 訂閱")
- // require(["baja!"], (baja)=>{
- // const sub = new baja.subscriber();
- // sub.attach("changed",function(){
- // console.log(this)
- // })
- // baja.Ord.make("local:|foxs:|station:|slot:/TPE/B1/ME/M12/U1F/NA/TH/N1/TEMP").get({subscribe: sub})
- // })
-
let myBaja = new subscriptionDevices();
myBaja.setSubscribeDevicesByBql(this.ordPath);
myBaja.setSubscribeDevicesCallBack((data) => {
- // console.log(data)
this.bajaChaCallback ? this.bajaChaCallback(data) : "";
if (this.curDevice == null) {
return false;
@@ -859,7 +1154,9 @@ class Forge3DSensor {
//將訂閱值塞入 subDeviceData
if (
- this.subDeviceData.findIndex(d => d.device_number == this.curDevice.id) == -1
+ this.subDeviceData.findIndex(
+ (d) => d.device_number == this.curDevice.id
+ ) == -1
) {
let obj = {};
obj.device_number = this.curDevice.id;
@@ -867,31 +1164,39 @@ class Forge3DSensor {
this.subDeviceData.push(obj);
}
let subData = this.subDeviceData.find(
- (x) => x.device_number == this.curDevice.id || x.device_number == "TPE_B1_ME_M12_R2F_NA_TH_N1"
+ (x) => x.device_number == this.curDevice.id
);
if (subData) {
- subData[data.point_name] = data.value;
+ subData = { ...subData, [data.point_name]: data.value };
}
+
//let norDevPoiName = matchDevice.device_normal_point_name;
//let cloDevPoiName = matchDevice.device_close_point_name || "";
//let errDevPoiName = matchDevice.device_error_point_name;
if (data.point_name == "Temp" || data.point_name == "TEMP") {
this.tempVal = !isNaN(parseInt(data.value)) ? parseInt(data.value) : 0;
- // this.heatMap?.changeTemp(
- // this.curDevice.id,
- // !isNaN(parseInt(data.value)) ? parseInt(data.value) : 0,
- // );
- this.curDevice.temp = this.tempVal;
- // console.log(data.value, parseInt(data.value))
- this.changeColorForSensorHotspot(this.curDevice.forge_dbid, parseInt(data.value))
- // changeColorForSensorHotspot(this.curDevice.forge_dbid, parseInt(data.value))
+ this.curDevice = {
+ ...this.curDevice,
+ temp: !isNaN(parseInt(data.value)) ? parseInt(data.value) : 0,
+ };
+
+ if (data.device_number_full === this.curDevice.id) {
+ this.addSensorHotspotList(
+ this.curDevice.forge_dbid,
+ this.curDevice.temp
+ );
+ }
}
});
myBaja.setSubscribeDeviceEndCallBack((data) => {
- if (data.findIndex((x) => x.point_name == "Temp" || x.point_name == "TEMP") != -1) {
+ if (
+ data.findIndex(
+ (x) => x.point_name == "Temp" || x.point_name == "TEMP"
+ ) != -1
+ ) {
// 顯示溫度條
showHeat("[name=forgeHeatBar]");
}
@@ -901,5 +1206,4 @@ class Forge3DSensor {
// this.changeColorForSensorHotspot(this.curDevice.forge_dbid, x++)
// }, 2000)
}
-
-}
\ No newline at end of file
+}
${title}
just now
@@ -463,16 +654,16 @@ function addBsToast(container, type = "warning", title = "", content = "", id, d
`
+
${content}
-