diff --git a/Frontend/_alert.html b/Frontend/_alert.html index ac70a77..98cc5b4 100644 --- a/Frontend/_alert.html +++ b/Frontend/_alert.html @@ -1,867 +1,866 @@ - - - 即時告警 - - - - 未復歸 - 已復歸 - - - - - 未確認 - 已確認 - - - - 近30天 - - - - - - - - - - - - - - - - - - 全選類別 - - - - - - - - - - - - - - - - - - - - + + + 即時告警 + + + + 未復歸 + 已復歸 + + + + 未確認 + 已確認 + + + + 近30天 + + + + + + + + + + + + + + + + + + 全選類別 + + + + + + + + + + + + + + + + + + + + + - - - - - 新增維修單 - - - - + + + + + 新增維修單 + + + + + + + + + + + 異常編號 + + 未選擇 + + - - - - - - 異常編號 - - 未選擇 - - - - - - 預計開始時間 - - - - - - 項目 - - 維修 - - - - - - 維修項目 - - - - - - 維修項目代碼(設備編號) - - 未選擇 - - - - - - 負責廠商 - - 未選擇 - - - - - - 狀態 - - - - - 未完成 - - - - - 完成 - - - - - - - - 工作人員編號 - - 未選擇 - - - - - - 注意事項 - - - - - - 結果描述 - - - - - 上傳檔案 - - - - - - - - - backup - - 選擇一個文件或拖放到這裡 - - PDF檔案不超過 3MB - - - - - - - + + + 預計開始時間 + + + + + + 項目 + + 維修 + + + + + + 維修項目 + + + + + + 維修項目代碼(設備編號) + + 未選擇 + + + + + + 負責廠商 + + 未選擇 + + + + + + 狀態 + + + + + 未完成 + + + + 完成 + + - + + + + 工作人員編號 + + 未選擇 + + + + + + 注意事項 + + + + + + 結果描述 + + + + + 上傳檔案 + + + + + + + + + backup + + 選擇一個文件或拖放到這裡 + + PDF檔案不超過 3MB + - + + + + + + + + + \ No newline at end of file diff --git a/Frontend/_sysElevator.html b/Frontend/_sysElevator.html index 1f6330f..18f02c4 100644 --- a/Frontend/_sysElevator.html +++ b/Frontend/_sysElevator.html @@ -1,25 +1,61 @@ @@ -215,7 +251,7 @@ + title="即時狀態"> @@ -899,7 +935,7 @@ setBuildFloor(); setCards(); - + setEleManTable(); show3D(); }) @@ -2374,7 +2410,7 @@ // ↑ 樓層平面圖 ↑ //===================================================================== - // 設置 模型隱藏或透明 + // 設置 模型隱藏或透明 function setInviForge(type, devDbIds) { console.log("devDbIds", devDbIds) if (type == "Hide") { @@ -2402,8 +2438,8 @@ //載入3D模型 function load3DModel() { launchViewer(pageAct.urn, (viewer) => { - - + + let elevOption = { selector: "#forgeViewer", viewer: viewer, @@ -2427,8 +2463,8 @@ subDeviceSetStatus(data); } forge3DElev.init(); - - + + }); } diff --git a/Frontend/_sysMonAll.html b/Frontend/_sysMonAll.html index e30f7d3..4c12cd9 100644 --- a/Frontend/_sysMonAll.html +++ b/Frontend/_sysMonAll.html @@ -11,7 +11,8 @@ - + @@ -24,9 +25,9 @@ + --> - + `; @@ -376,42 +378,67 @@ function show3DModel(urn) { $(loadEle).Loading("start"); launchViewerForHotspot(urn, (viewer, nodeIds) => { - let devDbIds = allDevList.map(x => x.forge_dbid); // 大類 - console.log(allDevList); - let subDevDbId = []; - allDevList.forEach(({ device_nodes }) => { - subDevDbId = [...subDevDbId, ...device_nodes.map(n => n.forge_dbid)] - }) + + addHotPoint(viewer) + let devDbIds = allDevList.map(x => x.forge_dbid); + // 大類 + let subDevDbId = []; + allDevList.forEach(({ device_nodes }) => { + subDevDbId = [...subDevDbId, ...device_nodes.map(n => n.forge_dbid)] + }) + // 從資料庫設定不可視模型的類型,若沒有取道該小類不可視類型,則套用資料庫設定預設類型 if (forgeInvType) { - setInviForge(forgeInvType, [...devDbIds, ...subDevDbId]); + setInviForge(forgeInvType, [...devDbIds, ...subDevDbId]); } else { - setInviForge(forgeInvTypeDef, [...devDbIds, ...subDevDbId]); + setInviForge(forgeInvTypeDef, [...devDbIds, ...subDevDbId]); } $(loadEle).Loading("close"); - - let 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"] - } - }) + let sensorObjs = [] + let devices = [] + if (pageAct.sysSubTag === "M12") { + allDevList.forEach((device) => { + const sensorObj = new Forge3DSensor({ + viewer: viewer, + ordPath: { + "area_tag": pageAct.AreaTag, + "building_tag": pageAct.buiTag, + }, + curDevice: { + 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) + } + }); + sensorObjs.push(sensorObj) + }) + } else { + 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: 0, + } + }) + } let option = { devices: devices, } - if (pageAct.sysMainTag !== "LT") { - heatMap = new ADHeatMaps(option); - heatMap.onComplete = () => { - $.each(allDevList, (idx, dev) => { - heatMap.changeTemp(dev.device_number, dev._temp || 0); - }) + if (pageAct.sysMainTag !== "LT" && pageAct.sysSubTag !== "M12") { + heatMap = new ADHeatMaps(option); + heatMap.onComplete = () => { + $.each(allDevList, (idx, dev) => { + heatMap.changeTemp(dev.device_number, dev._temp || 0); + }) + } } - } let elevOption = { selector: "[name=forgeViewer]", @@ -420,6 +447,7 @@ "area_tag": pageAct.AreaTag, "building_tag": pageAct.buiTag, }, + sensorObjs } // 電梯移動訂閱程序載入 @@ -438,36 +466,40 @@ setForgeHotSpotColor(matchDevice); } } - } - if (pageAct.sub_system_tag == "W2") { - getWaterNodeId(); - } + } + if (pageAct.sysSubTag == "W2") { + // console.log("@@",pageAct, pageAct.sub_system_tag) + getWaterNodeId(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) { + // 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(); + // } 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) }) - viewer.model.search("給水", (nodeIds) => { - console.log(nodeIds) - viewer.show(nodeIds) - }, (e) => { console.log(e) }) } function getHotspotPoint(callback = null) { @@ -494,7 +526,7 @@ $.extend(item, data); myDataList.push(item); }) - + setHotspotPoint(myDataList); if (pageAct.sysMainTag == "LT") { setLightPoint(myDataList); @@ -518,22 +550,21 @@ // 取得 不可視 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) { - console.log("devDbIds",devDbIds) if (type == "Hide") { hideAllObjects(devDbIds); } else if (type == "Opacity") { @@ -558,7 +589,7 @@ }) 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; diff --git a/Frontend/_sysSensor.html b/Frontend/_sysSensor.html new file mode 100644 index 0000000..4954ac4 --- /dev/null +++ b/Frontend/_sysSensor.html @@ -0,0 +1,555 @@ + + + + + + + + + + + + + + + + + + 燈控排程 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Frontend/img/forge/sensor_circle.svg b/Frontend/img/forge/sensor_circle.svg new file mode 100644 index 0000000..e7b0325 --- /dev/null +++ b/Frontend/img/forge/sensor_circle.svg @@ -0,0 +1,7 @@ + + + + Layer 1 + + + \ No newline at end of file diff --git a/Frontend/index.html b/Frontend/index.html index cbc1cfe..ed3b2d2 100644 --- a/Frontend/index.html +++ b/Frontend/index.html @@ -198,7 +198,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li + alt="Dr. Codex Lantern">--> @@ -206,13 +206,13 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li - + + alt="Dr. Codex Lantern">--> @@ -733,7 +733,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li - + @@ -801,7 +801,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", @@ -870,7 +870,9 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li if (isJSON(sessionStorage.getItem("pageAct"))) { lastPageAct = JSON.parse(sessionStorage.getItem("pageAct")); } - if ((lastPageAct.sysSubTag && lastPage == "systemMonitor") || lastPage == "sysElevator") { + if ((lastPageAct.sysSubTag && lastPage == "systemMonitor") || lastPage == "sysElevator" + // || lastPage == "sysSensor" + ) { $(`#subSysBtn${lastPageAct.sysSubTag}`).click(); $("#sysMonTopBtn").YTTab("set"); } else { @@ -927,7 +929,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li // } // }) - console.log(result); + // console.log(result); } } @@ -946,7 +948,9 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li if (!page) { return; } - if (page != "systemMonitor" && page != "sysElevator") { + if (page != "systemMonitor" && page != "sysElevator" + // && page != "sysSensor" + ) { $("#sysMonBtnList [name=topFunBtn]").removeClass("active"); pageAct.sysMainTag = null; pageAct.sysSubTag = null; @@ -960,11 +964,11 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li sub.unsubscribeAll(); sub.detach(); }) - // 清空 baja 訂閱紀錄 + // 清空 baja 訂閱紀錄 tolSubList = []; // 清空 loading 狀態 endPageLoading(); - + $(loadEle).Loading("close"); $(".yt-alert").YTAlert().hide(); // 取得使用者資訊 @@ -1019,10 +1023,10 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li //onEvent("click", "button[id^=noticeChkBtn]", function () { // $(this).parents(".toast").YTNotice("hide"); //}) - + onEvent("click", "button[id^=noticeChkBtn]", function () { /**button[id^=bajaAckBtn] */ let uuid = $(this).data("uuid"); - let url = window.location.origin + "/obix/alarm/"+uuid+"/ack"; + let url = window.location.origin + "/obix/alarm/" + uuid + "/ack"; let myBaja = new MyBaja(); myBaja.setMyUserAccount((data) => { let sendData = ''; @@ -1043,7 +1047,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li if (typeof getAlarmSub != "undefined" && getAlarmSub) { getAlarmSub(data); } - + alarmIconBlink(); }) @@ -1130,7 +1134,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li function drawErrRecTabBlo() { let strHtml = ` - ` + ` return strHtml; } @@ -1138,7 +1142,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li function drawOpeRecTabBlo() { let strHtml = ` - ` + ` return strHtml; } @@ -1155,35 +1159,45 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li let lightHtml = type == "light" ? `` : ""; let option = { html: ` - + - - ${devName} - - - - ${lightHtml} - - - - - - - - - ${drawStateTabBlo(devNum)} - - + + ${devName} + + + + ${lightHtml} + + + + + + - - ${drawErrRecTabBlo()} + + + ${drawStateTabBlo(devNum)} + + + + + + ${drawErrRecTabBlo()} + + + ${drawOpeRecTabBlo()} + - - ${drawOpeRecTabBlo()} - - - `, + `, group: "device", // 在 _sysElevator.html 及 _sysMonAll.html 會用到 onShow: function (tooltipEle, oriEle) { @@ -1202,11 +1216,11 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li controlFocusHotspot($(oriEle).data("dbId")); } // 3D 視角 ZOOM IN 聚焦 - /* - if (devObj) { + + if (devObj) { moveViewToDevice(devObj?.forge_dbid); } - */ + // pop 視窗卡片可拖移功能初始化 $(tooltipEle).draggable({ cursor: "move", @@ -1379,6 +1393,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li // Card - 異常紀錄 Table function callbackForErr(result) { + console.log("@@@", result) if (errRecTable) { errRecTable.destroy(); } @@ -1410,9 +1425,9 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li { "title": "發生/完成時間", "data": "normalTime", - //"render": function (data, type, row) { - // return row.timestamp + "" + data; - //}, + // "render": function (data, type, row) { + // return row.timestamp + "" + data; + // }, }, ]; @@ -1567,35 +1582,35 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li } else { let strHtml = ` - - 首頁 - - - `; + + 首頁 + + + `; $.each(res.data, function (i, v) { if (v.authCode == 'PF1') { strHtml += ` - - ${v.subName} - + + ${v.subName} + - `; + `; hasMonitor = true; } else { let icon = v.authCode == 'PF2' ? 'fa-chart-pie' : v.authCode == 'PF3' ? 'fa-chart-area' : v.authCode == 'PF4' ? 'fa-chart-line' : v.authCode == 'PF5' ? 'fa-bell' : v.authCode == 'PF6' ? 'fa-server' : v.authCode == 'PF7' ? 'fa-image' : v.authCode == 'PF8' ? 'fa-user' : ''; strHtml += ` - - ${v.subName} - - `; + + ${v.subName} + + `; } }); @@ -1626,6 +1641,10 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li if (subSysObj.sub_system_tag == "EL") { page = "sysElevator"; } + // console.log(subSysObj.sub_system_tag) + // if (subSysObj.sub_system_tag == "M12") { + // page = "sysSensor"; + // } let li = creEle("li"); let a = creA(subSysObj.full_name, { "href": "javascript:;" }, [], `subSysBtn${subSysObj.sub_system_tag}`, { page: page, tabname: "systemMonitor" }, "topFunBtn"); @@ -1668,10 +1687,10 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li } else { let datas = res.data; - + } - }, null, "POST",true).send(); + }, null, "POST", true).send(); } function getAlarm() { @@ -1696,7 +1715,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li datas[idx].full_name = allDevices.filter(x => x.device_number == data.devicePath)[0]?.full_name; let div1 = creDiv(["col-12"]); - let button = creBtn("確認", "noticeChkBtn", null, ["btn btn-sm btn-secondary ml-auto col-4"], {uuid:data.uuid}); + let button = creBtn("確認", "noticeChkBtn", null, ["btn btn-sm btn-secondary ml-auto col-4"], { uuid: data.uuid }); let btnDiv = creDiv(["d-flex m-0 gap-5 mt-2"]); btnDiv.append(button); // 繪製 每行告警資訊 @@ -1732,7 +1751,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li function getAllDevice() { let url = baseApiUrl + "/api/Device/GetAllDevice"; let result = []; - + ytAjax = new YourTeam.Ajax(url, null, function (res) { if (!res || res.code != "0000" || !res.data) { @@ -1783,7 +1802,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li }) localStorage.setItem("noticeStatus", "hide"); } - + } diff --git a/Frontend/js/forge/forgemodel.js b/Frontend/js/forge/forgemodel.js index a30b5c1..435e3e0 100644 --- a/Frontend/js/forge/forgemodel.js +++ b/Frontend/js/forge/forgemodel.js @@ -11,7 +11,7 @@ var levels;//剖面用 var lowerIdx;//剖面的下方樓層 var upperIdx;//剖面的上方樓層 -function launchViewer(urn, callback,failCallback, _selector = "#forgeViewer") { +function launchViewer(urn, callback, failCallback, _selector = "#forgeViewer") { selector = _selector; var options = { env: 'AutodeskProduction', @@ -38,7 +38,7 @@ function launchViewer(urn, callback,failCallback, _selector = "#forgeViewer") { failCallback ? failCallback(viewer) : ""; }) - //test + //test // for (let i = 0; i < urn.length; i++) { // Autodesk.Viewing.Document.load(urn[i]["urn"], async (doc) => { // let viewables = doc.getRoot().getDefaultGeometry(); @@ -90,7 +90,6 @@ function launchViewerForHotspot(urn, callback, failCallback, _selector = "#forge setShadowShow(); $(selector).on("autodesk:loaded", function (e, nodeIds) { callback ? callback(viewer, nodeIds) : ""; - console.log(viewer.get) }) $(selector).on("autodesk:loaded:fail", function (e) { @@ -168,6 +167,7 @@ class elevator3D { this.movStatus = 0; this.targetFloorZ = 0; this.floorHeight = option.floorHeight ?? [{}]; + this.sensorObjs = option.sensorObjs ?? null; this.init(); } @@ -177,7 +177,7 @@ class elevator3D { // 定義結果陣列 let result = []; // 使用 InstanceTree.enumNodeFragments 遍歷模型中的所有片段 - this.viewer?.model?.getData().instanceTree.enumNodeFragments(nodeId,(fragId) => { + this.viewer?.model?.getData().instanceTree.enumNodeFragments(nodeId, (fragId) => { // 將遍歷到的片段 ID 添加到結果陣列中 result.push(fragId); }, (nodeId) => { @@ -219,6 +219,12 @@ class elevator3D { let fragPosition = new THREE.Vector3(0, 0, 0);// 一樓0 二樓15 三樓 26 // 設置當前片段的位置 fragProxy.position = fragPosition; + + // if(nodeId === 13704) { + // // 改變感測器熱點位置 + // this.sensorObjs&&this.sensorObjs[0]?.changePos(13706, fragProxy.position.z) + // } + // 更新當前片段的動畫變換矩陣 fragProxy.updateAnimTransform(); }) @@ -294,10 +300,15 @@ class elevator3D { fragProxy.position.z += this.speed; } let tarFrag = this.fragProxys.filter(x => x.nodeId == nodeId && x.fragId == frag)[0]; - if (tarFrag) { + if (tarFrag) { tarFrag.frag.position.z = fragProxy.position.z; } fragProxyZ = fragProxy.position.z; + + if (nodeId === 13704) { + // 改變感測器熱點位置 + this.sensorObjs && this.sensorObjs[0]?.changePos(13706, fragProxyZ) + } fragProxy.updateAnimTransform() }) @@ -349,20 +360,20 @@ function onDocumentLoadSuccess(doc, eleOption) { viewer.addEventListener(Autodesk.Viewing.GEOMETRY_LOADED_EVENT, function () { let instanceTree = viewer.model?.getData().instanceTree; - console.log(instanceTree.nodeAccess) + // console.log(instanceTree.nodeAccess) allDbIdsStr = Object.keys(instanceTree.nodeAccess.dbIdToIndex); /*getNodeIdByDbIds("【電梯】", (nodeIds) => {*/ $(selector).trigger("autodesk:loaded"); /*});*/ - + }); - + } // 輔助函數,使用 Promise 封裝 viewer.getProperties 函數 -function viewerGetProperties(dbIds,attributeName = null) { +function viewerGetProperties(dbIds, attributeName = null) { // 在這裡,我們使用 viewer.getProperties 函數的成功回調函數作為 resolve 函數, // 並使用 viewer.getProperties 函數的失敗回調函數作為 resolve 函數的參數 // 這樣,當 viewer.getProperties 函數成功時,Promise 會傳回 properties 物件; @@ -373,9 +384,9 @@ function viewerGetProperties(dbIds,attributeName = null) { option.propFilter = [attributeName]; // 限制只返回指定的屬性 } viewer.model.getBulkProperties2(dbIds, option, // 取得指定元素的屬性信息 - function (elements) { - resolve(elements); // 成功時傳回 elements 物件 - }) + function (elements) { + resolve(elements); // 成功時傳回 elements 物件 + }) }); } @@ -390,12 +401,12 @@ async function getNodeIdBySearch(text) { }) } -// 主函數 - 透過 model 全部 node 取得特定 nodeId +// 主函數 - 透過 model 全部 node 取得特定 nodeId async function getNodeIdByDbIds(checkValue = [], callback = null) { let evelMap = new Map(); let hasElement = false; // 設置是否有 【tag_id】的node let targetNodeIds = await getNodeIdBySearch(checkValue); - let elements = await viewerGetProperties(targetNodeIds,"【tag_id】"); + 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); @@ -413,7 +424,7 @@ async function getNodeIdByDbIds(checkValue = [], callback = null) { // 二次篩選 chiElements = targetNodeIds.filter(x => x.properties.findIndex(y => y.displayName == "child") != -1); - // 獲取子元素的 nodeId + // 獲取子元素的 nodeId targetNodeIds = chiElements.map(x => x.properties[0].displayValue); // 獲取子元素的屬性信息 chiElements = await viewerGetProperties(targetNodeIds); @@ -560,8 +571,12 @@ class ADHeatMaps { init = async function () { // 載入 Autodesk Viewer 的資料視覺化擴充功能 const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization"); + this.dataVizExtn = dataVizExtn; // 儲存 Viewer 的模型 this.model = viewer.model; + this.addHeatMaps() + } + async addHeatMaps() { const { SurfaceShadingData, SurfaceShadingPoint, @@ -584,11 +599,12 @@ class ADHeatMaps { this.devices.filter(x => x.roomDbId == rDbid).forEach((device) => { const shadingPoint = new SurfaceShadingPoint( device.id, - device.position, + undefined, device.sensorTypes ); + shadingPoint.positionFromDBId(this.model, device.roomDbId) shadingNode.addPoint(shadingPoint); - device.temp = 0; + // device.temp = 0; }); heatmapData.addChild(shadingNode); @@ -598,12 +614,10 @@ class ADHeatMaps { heatmapData.initialize(this.model); // 對模型做表面顏色的渲染 - await dataVizExtn.setupSurfaceShading(this.model, heatmapData); + await this.dataVizExtn.setupSurfaceShading(this.model, heatmapData); // 對 "temperature" 的溫度設定兩種顏色:紅色和藍色 - dataVizExtn.registerSurfaceShadingColors("temperature", [0x0000ff, 0x00ff00, 0xffff00, 0xff0000]); - - this.dataVizExtn = dataVizExtn; + this.dataVizExtn.registerSurfaceShadingColors("temperature", [0x0000ff, 0x00ff00, 0xffff00, 0xff0000]); $.each(this.roomDbIds, (idx, rDbid) => { this.dataVizExtn.renderSurfaceShading("RoomPanel" + rDbid, "temperature", this.getSensorValue.bind(this)); @@ -613,8 +627,9 @@ class ADHeatMaps { this.onComplete ? this.onComplete() : ""; } - getSensorValue = function(device, sensorType) { + getSensorValue = function (device, sensorType) { let dev = this.devices.filter(x => x.id == device.id)[0]; + // shadingPoint.positionFromDBId(this.model, device.roomDbId) return dev.temp / 40; } @@ -627,7 +642,7 @@ class ADHeatMaps { dev.temp = temp; } }) - $.each(this.roomDbIds, (idx, rDbid) => { + $.each(this.roomDbIds, async (idx, rDbid) => { this.dataVizExtn.renderSurfaceShading("RoomPanel" + rDbid, "temperature", this.getSensorValue.bind(this)); }) //if (rDbid != null) { @@ -732,7 +747,7 @@ async function getLightData(data) { async function testNewLight(dataList) { dataList.forEach((myData, index) => { const position = JSON.parse(myData.device_coordinate_3d); - if (lightList.findIndex(x => x.device_guid == myData.device_guid) == -1) { + 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(0xff0000, 200, 20, 0.6, 0.5, 10) }); } @@ -745,7 +760,7 @@ async function testNewLight(dataList) { //let spotLightHelper = new THREE.SpotLightHelper(lightList[index].lightObject); //viewer.scene.add(spotLightHelper); - + }); viewer.impl.sceneUpdated(true); @@ -753,16 +768,22 @@ async function testNewLight(dataList) { //------------------- 加入熱點 ----------------- async function addHotPoint(data) { - var viewer = data.target; + 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 spriteColor = new THREE.Color(0xffffff); + let spriteColor = null; + let spriteIcon = ""; const dbIdStart = 10; const dbIdEnd = 19; - let spriteIcon = "/file/img/forge/hotspot.svg"; - if (location.href.indexOf("localhost:5966") != -1) { - spriteIcon = "/img/forge/hotspot.svg"; + if (pageAct.sysSubTag === "M12") { + return + } else { + spriteColor = new THREE.Color(0xffffff); + spriteIcon = "/file/img/forge/hotspot.svg"; + if (location.href.indexOf("localhost:5966") != -1) { + spriteIcon = "/img/forge/hotspot.svg"; + } } const style = new DataVizCore.ViewableStyle(viewableType, spriteColor, spriteIcon); @@ -770,7 +791,7 @@ async function addHotPoint(data) { if (lightDataList != undefined && lightDataList != null && lightDataList.length > 0) { testNewLight(lightDataList); } - + //熱點 點擊事件註冊 viewer.addEventListener(DataVizCore.MOUSE_CLICK, onSpriteClicked);// SPRITE_SELECTED @@ -793,15 +814,28 @@ async function addHotPoint(data) { await viewableData.finish(); dataVizExtn.addViewables(viewableData); + // console.log(dataVizExtn) $(selector).trigger("autodesk:complete:sprite", { myDataList }); //---------------- 熱點點擊事件 -------------------- function onSpriteClicked(event) { event.hasStopped = true; + if (pageAct.sysSubTag === "M12" && event != undefined && event != null) { + if (event.dbId >= dbIdStart) { + changeColorForHotspot(event.dbId); + changeScaleForHotspot(event.dbId, false); + let myData = [this.curDevice].filter(x => x.forge_dbid == event.dbId)[0]; + moveViewToDevice(myData.forge_dbid);//移動視角至該設備 + + $(selector).trigger("autodesk:click:sprite", { event, myData }); + } else { + $(selector).trigger("autodesk:clickOut:sprite", { event }); + } + } if (event != undefined && event != null) { if (event.dbId >= dbIdStart) {//event.dbId > 0 && event.dbId < 19 - console.log(`Sprite clicked: ${event.dbId}`); - + // console.log(`Sprite clicked: ${event.dbId}`); + for (let i = dbIdStart; i <= myDataList.length + 10; i++) { changeColorForHotspot(i); changeScaleForHotspot(i, false); @@ -821,7 +855,7 @@ async function addHotPoint(data) { //document.getElementById('deviceName').innerHTML = viewer.model.getInstanceTree().getNodeName(event.clickInfo.dbId); //document.getElementById('deviceDbid').innerHTML = event.clickInfo.dbId; //document.getElementById('devicePosition').innerHTML = "(" + (event.clickInfo.point.x).toFixed(2) + ", " + (event.clickInfo.point.y).toFixed(2) + ", " + (event.clickInfo.point.z).toFixed(2) + ")"; - console.log(`event>> dbId: ${event.clickInfo.dbId}, id: ${event.clickInfo.object.id}, position.x: ${event.clickInfo.point.x}, y: ${event.clickInfo.point.y}, z: ${event.clickInfo.point.z}, name: ${viewer.model.getInstanceTree().getNodeName(event.clickInfo.dbId)}`); + // console.log(`event>> dbId: ${event.clickInfo.dbId}, id: ${event.clickInfo.object.id}, position.x: ${event.clickInfo.point.x}, y: ${event.clickInfo.point.y}, z: ${event.clickInfo.point.z}, name: ${viewer.model.getInstanceTree().getNodeName(event.clickInfo.dbId)}`); } } } @@ -847,12 +881,13 @@ async function addHotPoint(data) { // 熱點 更換顏色 async function changeColorForHotspot(dbId, type = null) { const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization"); - let spriteColorFocus = new THREE.Color(0xffffff); - if (type == "focus") { + // console.log(dbId, dataVizExtn.viewableData.getViewableColor(dbId, false)) + let spriteColorFocus = dataVizExtn.viewableData?.getViewableColor(dbId, false) || new THREE.Color(0xffffff); + if (type == "focus" && pageAct.sysSubTag !== "M12") { spriteColorFocus = new THREE.Color(0x00ffe1); } else if (type == "error") { spriteColorFocus = new THREE.Color(0xff0000); - } + } const viewablesToUpdate = dbId; dataVizExtn.invalidateViewables(viewablesToUpdate, (viewable) => { return { @@ -861,6 +896,27 @@ async function changeColorForHotspot(dbId, type = null) { }); } + +// 熱點 更換顏色---環境感知器 +async function changeColorForSensorHotspot(dbId, temp) { + const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization"); + const temps = [new THREE.Color(0x0000ff), new THREE.Color(0x00ff00), new THREE.Color(0xffff00), new THREE.Color(0xff0000)] + let index = Math.floor(temp / 10); + if (index > 3) { + index = 3 + } + const viewablesToUpdate = dbId; + const color = temps[index] + + dataVizExtn.invalidateViewables(viewablesToUpdate, (viewable) => { + return { + color: color, + }; + }); + console.log(dataVizExtn) +} + + // 熱點 更換大小 async function changeScaleForHotspot(dbId, type = true) { const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization"); @@ -1050,7 +1106,7 @@ async function loadHeatmapForFloor() { //------------ 剖面 ---------------------- async function getRemoteLevels() { const aecData = await Autodesk.Viewing.Document.getAecModelData(this.viewer.model.getDocumentNode()); - if (!aecData.levels) return null; + if (!aecData || !aecData.levels) return null; const levels2 = aecData.levels; levels2.sort((a, b) => b.elevation - a.elevation); @@ -1058,7 +1114,7 @@ async function getRemoteLevels() { } async function getLevelsData(lowerFloor, upperFloor, callback = null) { - // 樓層正規化 取得樓層 + // 樓層正規化 取得樓層 const floorRegex = /[\d|\w]+F/gmi; const data = await this.getRemoteLevels(); for (var i = 0; i < data.length; i++) { @@ -1106,10 +1162,10 @@ async function newLight(lightPosition) { //聚光燈 var spotLight = new THREE.SpotLight(0xffffff, 200, 20, 0.6, 0.5, 10); spotLight.position.set(lightPosition.x, lightPosition.y, lightPosition.z); - console.log(lightPosition.x, lightPosition.y, lightPosition.z) + // 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); @@ -1119,7 +1175,7 @@ async function newLight(lightPosition) { //調整燈光 強度、顏色 async function setLightValues(deviceGuid, intensity, color) { - for (var i = 0; i < lightList.length; i++) { + for (var i = 0; i < lightList.length; i++) { if (lightList[i].device_guid == deviceGuid) { lightList[i].lightObject.intensity = intensity; diff --git a/Frontend/js/n4js/alarmbaja.js b/Frontend/js/n4js/alarmbaja.js index 1e63d7f..d15ce11 100644 --- a/Frontend/js/n4js/alarmbaja.js +++ b/Frontend/js/n4js/alarmbaja.js @@ -1,6 +1,6 @@ function addzero(num) { - return num < 10 ? '0' + num : num; + return num < 10 ? '0' + num : num; } /** @@ -85,45 +85,46 @@ function addzero(num) { // }); // } function getAlarmByBaja(startDate_millisecond, endDate_millisecond, isRecover, isAck, alarmClass, callback) { - let _sourceTmp; - var _result = ""; - var _ss = []; - var _bfName = ""; - var _sourceName = ""; - var _index = 0; - var _recoverState = isRecover ? "!= null" : "= null"; - var _ackState = isAck ? "= 'acked'" : "= 'unacked'"; - console.log("local:|foxs:|alarm:|bql:select timestamp, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where alarmClass = '" + alarmClass + "' and timestamp.millis > " + startDate_millisecond + " and timestamp.millis < " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp asc") - require(['baja!'], function (baja) { - baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackTime, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where alarmClass = '" + alarmClass + "' and timestamp.millis > " + startDate_millisecond + " and timestamp.millis < " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp asc").get() - .then(function (table) { - return table.cursor({ - each: function (record) { - const alarmDisplayName = record.get('alarmData').get('sourceName').split(":")[1] ?? record.get('alarmData').get('sourceName').split(":")[0] - //console.log(alarmDisplayName) - _sourceTmp = alarmDisplayName.split('_'); - _bfName = _sourceTmp[1] + "-" + _sourceTmp[4]; - _sourceName = _sourceTmp.slice(0, 8).join("_"); - _sourceTmp = _sourceTmp[7] + "-" + _sourceTmp[8]; - if (!_sourceTmp.includes("undefined")) { - _ss.push({ buildingFloorName_zh: _bfName, uuid: record.get('uuid'), timestamp: record.get('timestamp').$cEncStr, alarmClass: record.get('alarmClass'), sourceName_zh: _sourceName, sourceTmp: _sourceTmp, msgText: record.get('alarmData').get('msgText'), ackState: record.get('ackState'), normalTime: record.get('normalTime'), ackedTime: record.get('ackTime').$cEncStr }) - } - _index++ - }, - after: function () { - _result = { count: _index, data: _ss } + let _sourceTmp; + var _result = ""; + var _ss = []; + var _bfName = ""; + var _sourceName = ""; + var _index = 0; + var _recoverState = isRecover ? "!= null" : "= null"; + var _ackState = isAck ? "= 'acked'" : "= 'unacked'"; + console.log("local:|foxs:|alarm:|bql:select timestamp, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime where alarmClass = '" + alarmClass + "' and timestamp.millis > " + startDate_millisecond + " and timestamp.millis < " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp asc") + require(['baja!'], function (baja) { + baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackTime, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime where alarmClass = '" + alarmClass + "' and timestamp.millis > " + startDate_millisecond + " and timestamp.millis < " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp asc").get() + .then(function (table) { + return table.cursor({ + each: function (record) { + // console.log(record) + const alarmDisplayName = record.get('alarmData').get('sourceName').split(":")[1] ?? record.get('alarmData').get('sourceName').split(":")[0] + //console.log(alarmDisplayName) + _sourceTmp = alarmDisplayName.split('_'); + _bfName = _sourceTmp[1] + "-" + _sourceTmp[4]; + _sourceName = _sourceTmp.slice(0, 8).join("_"); + _sourceTmp = _sourceTmp[7] + "-" + _sourceTmp[8]; + if (!_sourceTmp.includes("undefined")) { + _ss.push({ buildingFloorName_zh: _bfName, uuid: record.get('uuid'), timestamp: record.get('timestamp').$cEncStr, alarmClass: record.get('alarmClass'), sourceName_zh: _sourceName, sourceTmp: _sourceTmp, msgText: record.get('alarmData').get('msgText'), ackState: record.get('ackState'), normalTime: record.get('normalTime'), ackedTime: record.get('ackTime').$cEncStr }) + } + _index++ + }, + after: function () { + _result = { count: _index, data: _ss } - //console.log(552, _result); + //console.log(552, _result); - if (typeof callback === 'function') { - callback(_result); - } - }, - limit: -1, - offset: 0 - }); - }); - }); + if (typeof callback === 'function') { + callback(_result); + } + }, + limit: -1, + offset: 0 + }); + }); + }); } /** @@ -161,45 +162,45 @@ function getAlarmByBaja(startDate_millisecond, endDate_millisecond, isRecover, i // }); // } function getOneDeviceAlarmTop10ByBaja(devicePath, callback) { - var _result = {}; - var _ss = []; - var _occurrenceTime = ""; - var _normalTime = ""; - var _index = 0; - //{ "count":2,"data": [{ "time": "2022/11/14 15:00:00", "errId": "0001", "ackCheck": "未確認", "errReason": "燈泡故障" }, { "time": "2022/11/14 15:00:00", "errId": "0002", "ackCheck": "未確認", "errReason": "燈泡故障" }]} - require(['baja!'], function (baja) { - baja.Ord.make("local:|foxs:|alarm:|bql:select top 10 timestamp, ackState, alarmData, alarmData.sourceName, sourceState, uuid, alarmData.msgText, normalTime where alarmData.sourceName like '%" + devicePath + "%' order by timestamp desc").get() - .then(function (table) { - return table.cursor({ - each: function (record) { - _occurrenceTime = ""; - _normalTime = ""; - // console.log(record.get('timestamp'),record.get('normalTime') ) - var _resultUuid = record.get('uuid').toString().split("-");//43dc7846-bd96-4be2-ab35-f11aec729c60 + var _result = {}; + var _ss = []; + var _occurrenceTime = ""; + var _normalTime = ""; + var _index = 0; + //{ "count":2,"data": [{ "time": "2022/11/14 15:00:00", "errId": "0001", "ackCheck": "未確認", "errReason": "燈泡故障" }, { "time": "2022/11/14 15:00:00", "errId": "0002", "ackCheck": "未確認", "errReason": "燈泡故障" }]} + require(['baja!'], function (baja) { + baja.Ord.make("local:|foxs:|alarm:|bql:select top 10 timestamp, ackState, alarmData, alarmData.sourceName, sourceState, uuid, alarmData.msgText, normalTime where alarmData.sourceName like '%" + devicePath + "%' order by timestamp desc").get() + .then(function (table) { + return table.cursor({ + each: function (record) { + _occurrenceTime = ""; + _normalTime = ""; + // console.log(record.get('timestamp'),record.get('normalTime') ) + var _resultUuid = record.get('uuid').toString().split("-");//43dc7846-bd96-4be2-ab35-f11aec729c60 - var _occurrenceTime = new Date(record.get('timestamp').$cEncStr).toLocaleString('zh-tw', { year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit" }); - // _occurrenceTime += _timestampTemp.getFullYear().toString() + "-" + addzero(_timestampTemp.getMonth() + 1).toString() + "-" + addzero(_timestampTemp.getDate()).toString() + " " + addzero(_timestampTemp.getHours()).toString() + ":" + addzero(_timestampTemp.getMinutes()).toString() + ":" + addzero(_timestampTemp.getSeconds()).toString(); + var _occurrenceTime = new Date(record.get('timestamp').$cEncStr).toLocaleString('zh-tw', { year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit" }); + // _occurrenceTime += _timestampTemp.getFullYear().toString() + "-" + addzero(_timestampTemp.getMonth() + 1).toString() + "-" + addzero(_timestampTemp.getDate()).toString() + " " + addzero(_timestampTemp.getHours()).toString() + ":" + addzero(_timestampTemp.getMinutes()).toString() + ":" + addzero(_timestampTemp.getSeconds()).toString(); - //var _occurrenceTime = _timestamp.format("yyyy-MM-dd hh:mm:ss");//.toLocaleString(); - var _normalTime = new Date(record.get('normalTime').$cEncStr).toLocaleString('zh-tw', { year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit" }); - // _normalTime += _normaltime.getFullYear().toString() + "-" + addzero(_normaltime.getMonth() + 1).toString() + "-" + addzero(_normaltime.getDate()).toString() + " " + addzero(_normaltime.getHours()).toString() + ":" + addzero(_normaltime.getMinutes()).toString() + ":" + addzero(_normaltime.getSeconds()).toString(); + //var _occurrenceTime = _timestamp.format("yyyy-MM-dd hh:mm:ss");//.toLocaleString(); + var _normalTime = new Date(record.get('normalTime').$cEncStr).toLocaleString('zh-tw', { year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit" }); + // _normalTime += _normaltime.getFullYear().toString() + "-" + addzero(_normaltime.getMonth() + 1).toString() + "-" + addzero(_normaltime.getDate()).toString() + " " + addzero(_normaltime.getHours()).toString() + ":" + addzero(_normaltime.getMinutes()).toString() + ":" + addzero(_normaltime.getSeconds()).toString(); - var _msgText = record.get('alarmData').get('msgText');// == 1 ? _occurrenceTime : "未確認"; - var _ackText = record.get('ackState') == 1 ? _occurrenceTime : "未確認"; - _ss.push({ uuid: _resultUuid[0], msgText: _msgText, ackState: _ackText, timestamp: _occurrenceTime, normalTime: _normalTime }) - _index++; - }, - after: function () { - _result = JSON.stringify({ count: _index, data: _ss }) - if (typeof callback === 'function') { - callback(_result); - } - }, - limit: -1, - offset: 0 - }); - }); - }); + var _msgText = record.get('alarmData').get('msgText');// == 1 ? _occurrenceTime : "未確認"; + var _ackText = record.get('ackState') == 1 ? _occurrenceTime : "未確認"; + _ss.push({ uuid: _resultUuid[0], msgText: _msgText, ackState: _ackText, timestamp: _occurrenceTime, normalTime: _normalTime }) + _index++; + }, + after: function () { + _result = JSON.stringify({ count: _index, data: _ss }) + if (typeof callback === 'function') { + callback(_result); + } + }, + limit: -1, + offset: 0 + }); + }); + }); } /** @@ -233,34 +234,34 @@ function getOneDeviceAlarmTop10ByBaja(devicePath, callback) { // }); // } function getOneSystemAlarmStateByBaja(systemPath, callback) { - var _result = ""; - var _ss = ""; - var _index = 0; -/* console.log("local:|foxs:|alarm:|bql:select alarmData, alarmData.sourceName, sourceState, uuid where alarmData.sourceName like '%" + systemPath + "%' order by timestamp desc")*/ - require(['baja!'], function (baja) { - baja.Ord.make("local:|foxs:|alarm:|bql:select alarmData, alarmData.sourceName, sourceState, uuid where alarmData.sourceName like '%" + systemPath + "%' order by timestamp desc").get() - .then(function (table) { - return table.cursor({ - each: function (record) { - if (_index == 0) - _ss += '{"uuid":"' + record.get('uuid') + '", "sourceName":"' + record.get('alarmData').get('sourceName') + '", "sourceState":"' + record.get('sourceState') + '"}'; - else - _ss += ',{"uuid":"' + record.get('uuid') + '", "sourceName":"' + record.get('alarmData').get('sourceName') + '", "sourceState":"' + record.get('sourceState') + '"}'; - _index++; - }, - after: function () { - _result += '{' + '"count": ' + _index + ', "data":['; - _result += _ss; - _result += ']}'; - if (typeof callback === 'function') { - callback(_result); - } - }, - limit: -1, - offset: 0 - }); - }); - }); + var _result = ""; + var _ss = ""; + var _index = 0; + /* console.log("local:|foxs:|alarm:|bql:select alarmData, alarmData.sourceName, sourceState, uuid where alarmData.sourceName like '%" + systemPath + "%' order by timestamp desc")*/ + require(['baja!'], function (baja) { + baja.Ord.make("local:|foxs:|alarm:|bql:select alarmData, alarmData.sourceName, sourceState, uuid where alarmData.sourceName like '%" + systemPath + "%' order by timestamp desc").get() + .then(function (table) { + return table.cursor({ + each: function (record) { + if (_index == 0) + _ss += '{"uuid":"' + record.get('uuid') + '", "sourceName":"' + record.get('alarmData').get('sourceName') + '", "sourceState":"' + record.get('sourceState') + '"}'; + else + _ss += ',{"uuid":"' + record.get('uuid') + '", "sourceName":"' + record.get('alarmData').get('sourceName') + '", "sourceState":"' + record.get('sourceState') + '"}'; + _index++; + }, + after: function () { + _result += '{' + '"count": ' + _index + ', "data":['; + _result += _ss; + _result += ']}'; + if (typeof callback === 'function') { + callback(_result); + } + }, + limit: -1, + offset: 0 + }); + }); + }); } /** @@ -269,35 +270,35 @@ function getOneSystemAlarmStateByBaja(systemPath, callback) { * @param {any} callback */ function getOneSystemStateByBaja(systemPath, callback) { - var _result = ""; - var _ss = ""; - var _index = 0; + var _result = ""; + var _ss = ""; + var _index = 0; - require(['baja!'], function (baja) { - baja.Ord.make("local:|foxs:|alarm:|bql:select top 1 alarmData, alarmData.sourceName, sourceState where alarmData.sourceName like '%" + systemPath + "%' order by timestamp desc").get() - .then(function (table) { - return table.cursor({ - each: function (record) { - //if (_index == 0) - // _ss += '{"sourceState":"' + record.get('sourceState') + '"}'; - //else - // _ss += '{"sourceState":"' + record.get('sourceState') + '"}'; - _ss += '{"sourceState":"' + record.get('sourceState') + '"}'; - _index++; - }, - after: function () { - _result += '{' + '"count": ' + _index + ', "data":['; - _result += _ss; - _result += ']}'; - if (typeof callback === 'function') { - callback(_result); - } - }, - limit: -1, - offset: 0 - }); - }); - }); + require(['baja!'], function (baja) { + baja.Ord.make("local:|foxs:|alarm:|bql:select top 1 alarmData, alarmData.sourceName, sourceState where alarmData.sourceName like '%" + systemPath + "%' order by timestamp desc").get() + .then(function (table) { + return table.cursor({ + each: function (record) { + //if (_index == 0) + // _ss += '{"sourceState":"' + record.get('sourceState') + '"}'; + //else + // _ss += '{"sourceState":"' + record.get('sourceState') + '"}'; + _ss += '{"sourceState":"' + record.get('sourceState') + '"}'; + _index++; + }, + after: function () { + _result += '{' + '"count": ' + _index + ', "data":['; + _result += _ss; + _result += ']}'; + if (typeof callback === 'function') { + callback(_result); + } + }, + limit: -1, + offset: 0 + }); + }); + }); } /** @@ -305,27 +306,27 @@ function getOneSystemStateByBaja(systemPath, callback) { * @param {any} callback */ function getAlarmCountByBaja(callback) { - var _result = { count: 0 }; - var _index = 0; + var _result = { count: 0 }; + var _index = 0; - require(['baja!'], function (baja) { - baja.Ord.make("local:|foxs:|alarm:|bql:select sourceState where sourceState = 'offnormal'").get() - .then(function (table) { - return table.cursor({ - each: function (record) { - _index++; - }, - after: function () { - _result.count = _index; - if (typeof callback === 'function') { - callback(_result); - } - }, - limit: -1, - offset: 0 - }); - }); - }); + require(['baja!'], function (baja) { + baja.Ord.make("local:|foxs:|alarm:|bql:select sourceState where sourceState = 'offnormal'").get() + .then(function (table) { + return table.cursor({ + each: function (record) { + _index++; + }, + after: function () { + _result.count = _index; + if (typeof callback === 'function') { + callback(_result); + } + }, + limit: -1, + offset: 0 + }); + }); + }); } /** @@ -333,27 +334,27 @@ function getAlarmCountByBaja(callback) { * @param {any} callback */ function getRecoverCountByBaja(callback) { - var _result = { count: 0 }; - var _index = 0; + var _result = { count: 0 }; + var _index = 0; - require(['baja!'], function (baja) { - baja.Ord.make("local:|foxs:|alarm:|bql:select normalTime where normalTime != null").get() - .then(function (table) { - return table.cursor({ - each: function (record) { - _index++; - }, - after: function () { - _result.count = _index; - if (typeof callback === 'function') { - callback(_result); - } - }, - limit: -1, - offset: 0 - }); - }); - }); + require(['baja!'], function (baja) { + baja.Ord.make("local:|foxs:|alarm:|bql:select normalTime where normalTime != null").get() + .then(function (table) { + return table.cursor({ + each: function (record) { + _index++; + }, + after: function () { + _result.count = _index; + if (typeof callback === 'function') { + callback(_result); + } + }, + limit: -1, + offset: 0 + }); + }); + }); } /** @@ -361,27 +362,27 @@ function getRecoverCountByBaja(callback) { * @param {any} callback */ function getCheckedAckedCountByBaja(callback) { - var _result = { count: 0 }; - var _index = 0; + var _result = { count: 0 }; + var _index = 0; - require(['baja!'], function (baja) { - baja.Ord.make("local:|foxs:|alarm:|bql:select ackState from openAlarms where ackState ='acked'").get() - .then(function (table) { - return table.cursor({ - each: function (record) { - _index++; - }, - after: function () { - _result.count = _index; - if (typeof callback === 'function') { - callback(_result); - } - }, - limit: -1, - offset: 0 - }); - }); - }); + require(['baja!'], function (baja) { + baja.Ord.make("local:|foxs:|alarm:|bql:select ackState from openAlarms where ackState ='acked'").get() + .then(function (table) { + return table.cursor({ + each: function (record) { + _index++; + }, + after: function () { + _result.count = _index; + if (typeof callback === 'function') { + callback(_result); + } + }, + limit: -1, + offset: 0 + }); + }); + }); } /** @@ -389,27 +390,27 @@ function getCheckedAckedCountByBaja(callback) { * @param {any} callback */ function getUnCheckedAckedCountByBaja(callback) { - var _result = { count: 0 }; - var _index = 0; + var _result = { count: 0 }; + var _index = 0; - require(['baja!'], function (baja) { - baja.Ord.make("local:|foxs:|alarm:|bql:select ackState from openAlarms where ackState ='unacked'").get() - .then(function (table) { - return table.cursor({ - each: function (record) { - _index++; - }, - after: function () { - _result.count = _index; - if (typeof callback === 'function') { - callback(_result); - } - }, - limit: -1, - offset: 0 - }); - }); - }); + require(['baja!'], function (baja) { + baja.Ord.make("local:|foxs:|alarm:|bql:select ackState from openAlarms where ackState ='unacked'").get() + .then(function (table) { + return table.cursor({ + each: function (record) { + _index++; + }, + after: function () { + _result.count = _index; + if (typeof callback === 'function') { + callback(_result); + } + }, + limit: -1, + offset: 0 + }); + }); + }); } /** @@ -417,32 +418,32 @@ function getUnCheckedAckedCountByBaja(callback) { * @param {any} callback */ function getSystemAlarmByBaja(callback) { - var _result = { count: 0, data: [] }; - var _index = 0; + var _result = { count: 0, data: [] }; + var _index = 0; - require(['baja!'], function (baja) { - //baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime where isAlarm").get() - baja.Ord.make("local:|foxs:|alarm:|bql:select alarmClass where isAlarm").get() - .then(function (table) { - return table.cursor({ - each: function (record) { - let main = {}; - main.alarmClass = record.get('alarmClass'); + require(['baja!'], function (baja) { + //baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime where isAlarm").get() + baja.Ord.make("local:|foxs:|alarm:|bql:select alarmClass where isAlarm").get() + .then(function (table) { + return table.cursor({ + each: function (record) { + let main = {}; + main.alarmClass = record.get('alarmClass'); - _result.data.push(main); - _index++; - }, - after: function () { - _result.count = _index; - if (typeof callback === 'function') { - callback(_result); - } - }, - limit: -1, - offset: 0 - }); - }); - }); + _result.data.push(main); + _index++; + }, + after: function () { + _result.count = _index; + if (typeof callback === 'function') { + callback(_result); + } + }, + limit: -1, + offset: 0 + }); + }); + }); } // /** @@ -523,150 +524,160 @@ function getSystemAlarmByBaja(callback) { * @param {any} callback */ function getOneDeviceAlarmByBaja(devicePath, callback) { - let _sourceTmp; - var _result = ""; - var _ss = []; - var _bfName = ""; - var _sourceName = ""; - var _index = 0; + let _sourceTmp; + var _result = ""; + var _ss = []; + var _bfName = ""; + var _sourceName = ""; + var _index = 0; - require(['baja!'], function (baja) { -/* console.log("local:|foxs:|alarm:|bql:select timestamp, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where alarmData.sourceName like '%" + devicePath + "%' order by timestamp desc");*/ - baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where alarmData.sourceName like '%" + devicePath + "%' order by timestamp desc").get() - .then(function (table) { - return table.cursor({ - each: function (record) { - _sourceTmp = (record.get('alarmData').get('sourceName')).toString().split('_'); - _bfName = _sourceTmp[1] + "-" + _sourceTmp[4]; - _sourceName = _sourceTmp[7] + "-" + _sourceTmp[8]; - _ss.push({ buildingFloorName_zh: _bfName, uuid: record.get('uuid'), timestamp: record.get('timestamp'), alarmClass: record.get('alarmClass'), sourceName_zh: _sourceName, msgText: record.get('alarmData').get('msgText'), ackState: record.get('ackState'), normalTime: record.get('normalTime') }) - _index++ - }, - after: function () { - _result = { count: _index, data: _ss } + require(['baja!'], function (baja) { + /* console.log("local:|foxs:|alarm:|bql:select timestamp, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where alarmData.sourceName like '%" + devicePath + "%' order by timestamp desc");*/ + baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where alarmData.sourceName like '%" + devicePath + "%' order by timestamp desc").get() + .then(function (table) { + return table.cursor({ + each: function (record) { + _sourceTmp = (record.get('alarmData').get('sourceName')).toString().split('_'); + _bfName = _sourceTmp[1] + "-" + _sourceTmp[4]; + _sourceName = _sourceTmp[7] + "-" + _sourceTmp[8]; + _ss.push({ buildingFloorName_zh: _bfName, uuid: record.get('uuid'), timestamp: record.get('timestamp'), alarmClass: record.get('alarmClass'), sourceName_zh: _sourceName, msgText: record.get('alarmData').get('msgText'), ackState: record.get('ackState'), normalTime: record.get('normalTime') }) + _index++ + }, + after: function () { + _result = { count: _index, data: _ss } - //console.log(552, _result); + //console.log(552, _result); - if (typeof callback === 'function') { - callback(_result); - } - }, - limit: -1, - offset: 0 - }); - }); - }); + if (typeof callback === 'function') { + callback(_result); + } + }, + limit: -1, + offset: 0 + }); + }); + }); } function getAllDeviceAlarmByBaja(startDate_millisecond, endDate_millisecond, isRecover, isAck, callback) { - var _result = { count: 0, data: [] }; - var _index = 0; - var _recoverState = isRecover ? "!= null" : "= null"; - var _ackState = isAck ? "= 'acked'" : "= 'unacked'"; + var _result = { count: 0, data: [] }; + var _index = 0; + var _recoverState = isRecover ? "!= null" : "= null"; + var _ackState = isAck ? "= 'acked'" : "= 'unacked'"; - let startUrl = ""; - if (startDate_millisecond) { - startUrl = "timestamp.millis >= " + startDate_millisecond + " and "; - } - // console.log("local:|foxs:|alarm:|bql:select timestamp, ackTime, priority ,ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where " + startUrl + "timestamp.millis <= " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp desc"); - require(['baja!'], function (baja) { + let startUrl = ""; + if (startDate_millisecond) { + startUrl = "timestamp.millis >= " + startDate_millisecond + " and "; + } + console.log("local:|foxs:|alarm:|bql:select timestamp, ackTime, priority ,ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime where " + startUrl + "timestamp.millis <= " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp desc"); + require(['baja!'], function (baja) { - baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackTime, priority ,ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where " + startUrl + "timestamp.millis <= " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp desc").get() - .then(function (table) { - return table.cursor({ - each: function (record) { - // console.log(record,record.get('alarmData').get('sourceName').split(':')) - let main = {}; - // console.log(record.get('alarmData').get('sourceName'),record.get('timestamp').$cEncStr) - const alarmDisplayName = record.get('alarmData').get('sourceName').split(":")[1] ?? record.get('alarmData').get('sourceName').split(":")[0] - //console.log(alarmDisplayName) - _sourceTmp = alarmDisplayName.split('_'); - let _bfName = _sourceTmp[1] + "-" + _sourceTmp[4] - let _sourceName = _sourceTmp.slice(0, 8).join("_"); - _sourceTmp = _sourceTmp[7] + "-" + _sourceTmp[8]; + baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackTime, priority ,ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime where " + startUrl + "timestamp.millis <= " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp desc").get() + .then(function (table) { + return table.cursor({ + each: function (record) { + // console.log(record) + let main = {}; + // console.log(record.get('alarmData').get('sourceName'),record.get('timestamp').$cEncStr) + const alarmDisplayName = record.get('alarmData').get('sourceName').split(":")[1] ?? record.get('alarmData').get('sourceName').split(":")[0] + //console.log(alarmDisplayName) + _sourceTmp = alarmDisplayName.split('_'); + let _bfName = _sourceTmp[1] + "-" + _sourceTmp[4] + let _sourceName = _sourceTmp.slice(0, 8).join("_"); + _sourceTmp = _sourceTmp[7] + "-" + _sourceTmp[8]; - main.buildingFloorName_zh = _bfName; - main.sourceName_zh = _sourceName; - main.uuid = record.get('uuid').$val; - main.timestamp = record.get('timestamp').$cEncStr; - main.alarmClass = record.get('alarmClass'); - main.point = _sourceTmp; - main.sourceTmp = _sourceTmp; - main.devicePath = _sourceName; - main.msgText = record.get('alarmData').get('msgText'); - main.normalTime = record.get('normalTime'); - main.priority = record.get('priority'); - main.ackedTime = record.get('ackTime').$cEncStr; - if (!_sourceTmp.includes("undefined")) { - _result.data.push(main); - } - _index++; - }, - after: function () { - _result.count = _index; - if (typeof callback === 'function') { - //console.log(_result) - callback(_result); - } - }, - limit: -1, - offset: 0 - }); - }); - }); + main.buildingFloorName_zh = _bfName; + main.sourceName_zh = _sourceName; + main.uuid = record.get('uuid').$val; + main.timestamp = record.get('timestamp').$cEncStr; + main.alarmClass = record.get('alarmClass'); + main.point = _sourceTmp; + main.sourceTmp = _sourceTmp; + main.devicePath = _sourceName; + main.msgText = record.get('alarmData').get('msgText'); + main.normalTime = record.get('normalTime'); + main.priority = record.get('priority'); + main.ackedTime = record.get('ackTime').$cEncStr; + main.ackState = record.get('ackState').$ordinal + if (!_sourceTmp.includes("undefined")) { + // console.log(main.ackState) + _result.data.push(main); + } + _index++; + }, + after: function () { + _result.count = _index; + if (typeof callback === 'function') { + //console.log(_result) + callback(_result); + } + }, + limit: -1, + offset: 0 + }); + }); + }); } function getDeviceAlarmCardByBaja(startDate_millisecond, endDate_millisecond, isRecover, isAck, callback) { - var _result = { count: 0, data: [] }; - var _index = 0; - var _recoverState = isRecover ? "!= null" : "= null"; - var _ackState = isAck ? "= 'acked'" : "= 'unacked'"; + var _result = { count: 0, data: [] }; + var _index = 0; + var _recoverState = isRecover ? "!= null" : "= null"; + var _ackState = isAck ? "= 'acked'" : "= 'unacked'"; - require(['baja!'], function (baja) { let startUrl = ""; if (startDate_millisecond) { - startUrl = "timestamp.millis >= " + startDate_millisecond + " and "; + startUrl = "timestamp.millis >= " + startDate_millisecond + " and "; } -/* console.log("local:|foxs:|alarm:|bql:select timestamp, ackTime, priority ,ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where " + startUrl + "timestamp.millis <= " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp desc");*/ + // console.log("首頁","local:|foxs:|alarm:|bql:select timestamp, ackTime, priority ,ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where " + startUrl + "timestamp.millis <= " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp desc"); + require(['baja!'], function (baja) { - baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackTime, priority ,ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where " + startUrl + "timestamp.millis <= " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp desc").get() - .then(function (table) { - return table.cursor({ - each: function (record) { - let main = {}; - //console.log(record.get('alarmData').get('sourceName')) - _sourcePoint = (record.get('alarmData').get('sourceName')).toString().split(':')[1]; - //console.log(_sourcePoint) - _sourceTmp = _sourcePoint.split("_"); + baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackTime, priority ,ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime where " + startUrl + "timestamp.millis <= " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp desc").get() + .then(function (table) { + return table.cursor({ + each: function (record) { + // console.log(record) + let main = {}; + // console.log(record.get('alarmData').get('sourceName'),record.get('timestamp').$cEncStr) + const alarmDisplayName = record.get('alarmData').get('sourceName').split(":")[1] ?? record.get('alarmData').get('sourceName').split(":")[0] + //console.log(alarmDisplayName) + _sourceTmp = alarmDisplayName.split('_'); + let _bfName = _sourceTmp[1] + "-" + _sourceTmp[4] + let _sourceName = _sourceTmp.slice(0, 8).join("_"); + _sourceTmp = _sourceTmp[7] + "-" + _sourceTmp[8]; - let _bfName = _sourceTmp[1] + "-" + _sourceTmp[4]; - let _sourceName = _sourceTmp[7] + "-" + _sourceTmp[8]; - main.buildingFloorName_zh = _bfName; - main.sourceName_zh = _sourceName; - main.uuid = record.get('uuid').$val; - main.timestamp = record.get('timestamp'); - main.alarmClass = record.get('alarmClass'); - main.point = _sourcePoint; - main.devicePath = _sourceTmp.slice(0, 8).join("_");; - main.msgText = record.get('alarmData').get('msgText'); - main.normalTime = record.get('normalTime'); - main.priority = record.get('priority'); - main.ackedTime = record.get('ackTime').$cEncStr; - _result.data.push(main); - _index++; - }, - after: function () { - _result.count = _index; - if (typeof callback === 'function') { - callback(_result); - } - }, - limit: -1, - offset: 0 - }); - }); - }); + main.buildingFloorName_zh = _bfName; + main.sourceName_zh = _sourceName; + main.uuid = record.get('uuid').$val; + main.timestamp = record.get('timestamp').$cEncStr; + main.alarmClass = record.get('alarmClass'); + main.point = _sourceTmp; + main.sourceTmp = _sourceTmp; + main.devicePath = _sourceName; + main.msgText = record.get('alarmData').get('msgText'); + main.normalTime = record.get('normalTime'); + main.priority = record.get('priority'); + main.ackedTime = record.get('ackTime').$cEncStr; + main.ackState = record.get('ackState').$ordinal + if (!_sourceTmp.includes("undefined")) { + // console.log(main.ackState) + _result.data.push(main); + } + _index++; + }, + after: function () { + _result.count = _index; + if (typeof callback === 'function') { + //console.log(_result) + callback(_result); + } + }, + limit: -1, + offset: 0 + }); + }); + }); } /** @@ -674,32 +685,32 @@ function getDeviceAlarmCardByBaja(startDate_millisecond, endDate_millisecond, is * @param {any} callback */ function getAlarmForChartDataByBaja(callback) { - var _result = ""; - var _ss = ""; - var _index = 0; + var _result = ""; + var _ss = ""; + var _index = 0; - require(['baja!'], function (baja) { - baja.Ord.make("local:|foxs:|alarm:|bql:select alarmClass, ackState, normalTime where isAlarm").get() - .then(function (table) { - return table.cursor({ - each: function (record) { - if (_index == 0) - _ss += '{"alarmClass":"' + record.get('alarmClass') + '", "ackState":"' + record.get('ackState') + '", "normalTime":"' + record.get('normalTime') + '"}'; - else - _ss += ',{"alarmClass":"' + record.get('alarmClass') + '", "ackState":"' + record.get('ackState') + '", "normalTime":"' + record.get('normalTime') + '"}'; - _index++; - }, - after: function () { - _result += '{' + '"count": ' + _index + ', "data":['; - _result += _ss; - _result += ']}'; - if (typeof callback === 'function') { - callback(_result); - } - }, - limit: -1, - offset: 0 - }); - }); - }); + require(['baja!'], function (baja) { + baja.Ord.make("local:|foxs:|alarm:|bql:select alarmClass, ackState, normalTime where isAlarm").get() + .then(function (table) { + return table.cursor({ + each: function (record) { + if (_index == 0) + _ss += '{"alarmClass":"' + record.get('alarmClass') + '", "ackState":"' + record.get('ackState') + '", "normalTime":"' + record.get('normalTime') + '"}'; + else + _ss += ',{"alarmClass":"' + record.get('alarmClass') + '", "ackState":"' + record.get('ackState') + '", "normalTime":"' + record.get('normalTime') + '"}'; + _index++; + }, + after: function () { + _result += '{' + '"count": ' + _index + ', "data":['; + _result += _ss; + _result += ']}'; + if (typeof callback === 'function') { + callback(_result); + } + }, + limit: -1, + offset: 0 + }); + }); + }); } \ No newline at end of file diff --git a/Frontend/js/site.js b/Frontend/js/site.js index d48d678..fdd43bc 100644 --- a/Frontend/js/site.js +++ b/Frontend/js/site.js @@ -5,25 +5,25 @@ }) -/** - * 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; @@ -34,7 +34,7 @@ $.fn.Loading = function (type = "close", text) { $("body").css("overflow", "auto"); $(aleObj.ele).YTAlert().hide(); $(ele).animate({ opacity: 0 }, 300, () => { - if ($(ele).data("loading-show-status") == "close") { + if ($(ele).data("loading-show-status") == "close") { $(ele).hide(); } }) @@ -82,9 +82,9 @@ $.fn.YTAlert = function () { } /** - * 設置 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"); @@ -106,19 +106,19 @@ function setDropdownItem(menuEle) { } /** - * 預設設備圖像 - * @param {any} obj - */ +* 預設設備圖像 +* @param {any} obj +*/ function defDev(obj) { 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; @@ -128,14 +128,14 @@ function dtAjaxResetSendData(table, sendData) { /** - * element 建造 - * @param {any} text - * @param {any} id - * @param {any} name - * @param {any} cls - * @param {any} data - * @param {any} 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}"` : ""; @@ -193,8 +193,8 @@ function creSpan(text = null, cls = [], id = null, attr = {}, data = {}, name = return creEle("span", text, id, name, cls, data, attr); } /** - * 根據該棟建築底下的'所有'電梯執行緒物件 - * */ +* 根據該棟建築底下的'所有'電梯執行緒物件 +* */ class ElevatorHandler { constructor(ele, option = {}) { this.ele = ele; @@ -428,7 +428,7 @@ function dateRanCutPart(start, end, cutNum) { let cutTimeArr = []; if (sTime < eTime) return []; - + let partNum = (sTime - eTime) / cutNum; for (let i = eTime; i <= sTime; i = i + partNum) { cutTimeArr.push(i) @@ -448,27 +448,27 @@ function isJSON(str) { } } -function addBsToast(container, type = "warning",title="",content ="", id, datas = {}, option = {}) { +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 = ` - - - ${title} - just now - - × - - - - ${content} - - ` + let strHtml = ` + + + ${title} + just now + + × + + + + ${content} + + ` } /** - * 取得資料庫電梯設備,根據 baja 訂閱移動 3D 電梯 - * */ +* 取得資料庫電梯設備,根據 baja 訂閱移動 3D 電梯 +* */ class Forge3DElevFull { constructor(option = {}) { this.allElevDevList = []; //全電梯設備清單 @@ -484,17 +484,18 @@ class Forge3DElevFull { this.selector = option.selector ?? "#forgeViewer"; this.bajaChaCallback = option.bajaChaCallback ?? null; this.bajaEndCallback = option.bajaEndCallback ?? null; - this.sensorObj = null + this.sensorObjs = option.sensorObjs ?? null; } - init = function () { - this.sensorObj = new Forge3DSensor({ - viewer: this.viewer, - ordPath: { ...this.ordPath }, - }) + init = function () { // 系統大類、小類固定 this.ordPath.system_tag = this.sysMainTag; this.ordPath.name_tag = this.sysSubTag; + + // if (pageAct.sysSubTag === "M12") { + // console.log("@@",pageAct, pageAct.sysSubTag) + // this.getSensorDevList(); + // } this.getElevDevList(); } @@ -534,6 +535,7 @@ class Forge3DElevFull { if (this.elev3DObj.length != 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.movElevator(); } @@ -593,6 +595,13 @@ class Forge3DElevFull { frags.forEach((fragProxy) => { fragProxy.frag.position.z = this.elev3DOption.floorHeight.filter(x => x.floor == subData["CP"])[0]?.height ?? 0; + console.log("1", fragProxy.frag.position.z) + let start = 0; + if (node === 13704 && start == 0) { + // 改變感測器熱點位置 + this.sensorObjs && this.sensorObjs[0]?.changePos(13706, fragProxy.frag.position.z); + start = 1; + } fragProxy.frag.updateAnimTransform(); }) elevObj.obj.viewer.impl.sceneUpdated(true); @@ -617,6 +626,7 @@ class Forge3DElevFull { viewer: this.viewer, nodeId: node, floorHeight: this.elev3DOption.floorHeight ?? [], + sensorObjs: this.sensorObjs, inited: function () { } @@ -637,9 +647,16 @@ class Forge3DElevFull { elevObj.obj = Object.assign(elevObj, elevator3DObj ?? {}) elevObj.obj.init(() => { 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; + console.log("2", fragProxy.frag.position.z) + // debugger + let start = 0; + if (node === 13704 && start == 0) { + // 改變感測器熱點位置 + this.sensorObjs && this.sensorObjs[0]?.changePos(13706, fragProxy.frag.position.z); + start = 1; + } fragProxy.frag.updateAnimTransform() }) elevObj.obj.viewer.impl.sceneUpdated(true); @@ -677,229 +694,211 @@ class Forge3DElevFull { } } + + /** - * 取得資料庫溫度感測器 - * 1. baja 取得溫度感測器改變顏色 - * 2. 參數取得要移動到的電梯位置 - * */ +* 取得資料庫溫度感測器 +* 1. baja 取得溫度感測器改變顏色 +* 2. 參數取得要移動到的電梯位置 +* */ class Forge3DSensor { - constructor(option = {}) { - this.allSensorDevList = []; //溫度調節器設備清單 - this.subDeviceData = []; //每個設備訂閱點位值 - this.viewer = option.viewer ?? null; - this.ordPath = option.ordPath; // TPE_B1 - this.sysMainTag = "ME"; - this.sysSubTag = "M12"; - this.selector = "#forgeViewer"; - this.heatMap = null; - this.bajaChaCallback = option.bajaChaCallback ?? null; - this.bajaEndCallback = option.bajaEndCallback ?? null; - this.floorHeight = 0; - this.dataVizExtn = null; - this.#init(); - } + constructor(option = {}) { + this.subDeviceData = []; //每個設備訂閱點位值 + this.viewer = option.viewer ?? null; + this.ordPath = option.ordPath; // TPE_B1 + this.sysMainTag = "ME"; + this.sysSubTag = "M12"; + this.selector = "#forgeViewer"; + this.heatMap = null; + this.bajaChaCallback = option.bajaChaCallback ?? null; + this.bajaEndCallback = option.bajaEndCallback ?? null; + this.floorHeight = 0; + this.dataVizExtn = null; + this.DataVizCore = null; + this.tempVal = 20; + this.curDevice = option.curDevice ?? null; + this.#init(); + } - #init = async function () { - // 系統大類、小類固定 - this.ordPath.system_tag = this.sysMainTag; - this.ordPath.name_tag = this.sysSubTag; - this.dataVizExtn = await this.viewer.loadExtension("Autodesk.DataVisualization"); - //this.getSensorDevList(); - } - // 取得Sensor設備列表 - getSensorDevList = function () { - let url = baseApiUrl + "/api/Device/GetDeviceList"; - let sendData = { - sub_system_tag: this.ordPath.name_tag, // M12 - building_tag: this.ordPath.building_tag, //B1 - }; - objSendData.Data = sendData; - ytAjax = new YourTeam.Ajax(url, objSendData, (res) => { - if (!res || res.code != "0000" || !res.data) { + #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.addHotPoint(); + this.changeColorForSensorHotspot(this.curDevice.forge_dbid, 35) + this.subSensorDevice(); - } else { - $.each(res.data, (index, floObj) => { - $.each(floObj.device_list, (index2, devObj) => { - this.allSensorDevList.push(devObj); - }) - }) - let devices = this.allSensorDevList.map((x) => { - if (x.device_number.includes("ME_M12")) { - return { - roomDbId: 12879, // Bank2 電梯 - 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"], - }; - } + + } + + // 建立熱點 + async addHotPoint() { + + // this.dataVizExtn.removeAllViewables() + await this.registerHotPoint() + this.subSensorDevice(); + // console.log("2",this.dataVizExtn) + } + + async registerHotPoint(color = "") { + var viewer = this.viewer; + const viewableType = this.DataVizCore.ViewableType.SPRITE;//DataVizCore.ViewableType.SPRITE; + const spriteColor = new THREE.Color(0x000000); + // 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 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); }); - //this.heatMap = new ADHeatMaps({ - // devices - //}); - //this.subSensorDevice(); - } - }, null, "POST").send(); - } + // console.log(viewableData) + await viewableData.finish(); + this.dataVizExtn.addViewables(viewableData); + // console.log("1",this.dataVizExtn) + viewer.addEventListener(this.DataVizCore.MOUSE_CLICK, onSpriteClicked.bind(this));// SPRITE_SELECTED - // 訂閱sensor設備 - subSensorDevice = function () { - let myBaja = new subscriptionDevices(); - let ordPath = this.ordPath; + // ---------------- 熱點點擊事件 -------------------- + function onSpriteClicked(event) { + event.hasStopped = true; + const dbIdStart = 10; + // debugger + if (event != undefined && event != null) { + if (event.dbId >= dbIdStart) { + changeColorForHotspot(event.dbId); + changeScaleForHotspot(event.dbId, false); + let myData = [this.curDevice].filter(x => x.forge_dbid == event.dbId)[0]; + moveViewToDevice(myData.forge_dbid);//移動視角至該設備 - myBaja.setSubscribeDevicesByBql(ordPath); - myBaja.setSubscribeDevicesCallBack((data) => { - this.bajaChaCallback ? this.bajaChaCallback(data) : ""; - if (this.allSensorDevList.length == 0) { - return false; - } - data.device_number = data.device_number_full; // "TPE_B1_ME_M12_U1F_NA_TH_N1" (forge TPE_B1_ME_M12_R2F_NA_TH_N1) + $(selector).trigger("autodesk:click:sprite", { event, myData }); + } else { + $(selector).trigger("autodesk:clickOut:sprite", { event }); + } + } + } + } - let matchDevice = this.allSensorDevList.find( - (x) => - x.device_number == data.device_number || - x.device_number == "TPE_B1_ME_M12_R2F_NA_TH_N1", - ); - if (!matchDevice) { - return; - } - //將訂閱值塞入 subDeviceData - if ( - this.subDeviceData.findIndex(d => d.device_number == matchDevice.device_number) == -1 - ) { - let obj = {}; - obj.device_number = matchDevice.device_number; - obj.dbid = matchDevice.forge_dbid; - this.subDeviceData.push(obj); - } - let subData = this.subDeviceData.find( - (x) => x.device_number == matchDevice.device_number || x.device_number == "TPE_B1_ME_M12_R2F_NA_TH_N1" - ); + // 改變熱點位置 + changePos(dbId, positionZ) { + this.dataVizExtn.invalidateViewables(dbId, (viewable) => { + // console.log(viewable._position) + const z = viewable._position.z + positionZ + const newPos = { ...viewable._position, z } + return { + // Move the viewable to a new location. + position: newPos + }; + }); + } - if (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.heatMap?.changeTemp( - matchDevice.device_number, - !isNaN(parseInt(data.value)) ? parseInt(data.value) : 0, - ); - let devIdx = this.allSensorDevList.findIndex( - (x) => - x.device_number == data.device_number_full || - x.device_number == "TPE_B1_ME_M12_R2F_NA_TH_N1", - ); - this.allSensorDevList[devIdx]._temp = !isNaN(parseInt(data.value)) - ? parseInt(data.value) - : 0; - } - }); + // 熱點 更換顏色---環境感知器 + changeColorForSensorHotspot(dbId, temp) { + 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) => { - //myBaja.setSubscribeDeviceEndCallBack((data) => { - // if (data.findIndex((x) => x.point_name == "Temp" || x.point_name == "TEMP") != -1) { - // // 顯示溫度條 - // console.log(showHeat) - // showHeat("[name=forgeHeatBar]"); - // } - //}); - } + return { + color: color, + }; + }); + // debugger + // console.log("3", this.dataVizExtn) + } - // 位置呈現 - changeSensorPos = async function () { - this.dataVizExtn.removeAllViewables(); - const DataVizCore = Autodesk.DataVisualization.Core; - const viewableType = DataVizCore.ViewableType.SPRITE; - const spriteColor = new THREE.Color(0x000000); - let spriteIcon = "/file/img/forge/hotspot.svg"; - if (location.href.indexOf("localhost:5966") != -1) { - spriteIcon = "/img/forge/hotspot.svg"; - } const style = new DataVizCore.ViewableStyle(viewableType, spriteColor, spriteIcon); - const viewableData = new DataVizCore.ViewableData(); - viewableData.spriteSize = 30 + // 訂閱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}) + // }) - // test 1 - // const myDataList = [{ position: { x: 0, y: 0, z: this.floorHeight } }]; - // myDataList.forEach((myData, index) => { - // const position = myData.position; - // const viewable = new DataVizCore.SpriteViewable(position, style, 12982); - // console.log(viewable) - // viewableData.addViewable(viewable); - // }); - // await viewableData.finish(); - // this.dataVizExtn.addViewables(viewableData); - // console.log(this.floorHeight,this.dataVizExtn) + let myBaja = new subscriptionDevices(); + myBaja.setSubscribeDevicesByBql(this.ordPath); - // test 2 - const myDataList = [{ position: { x: 0, y: 0, z: 0 } }]; - myDataList.forEach((myData, index) => { - const position = myData.position; - const viewable = new DataVizCore.SpriteViewable(position, style, 12982); - viewableData.addViewable(viewable); - }); - await viewableData.finish(); - this.dataVizExtn.addViewables(viewableData); - let spritesToUpdate = this.dataVizExtn.viewableData.viewables.map((v) => v.dbId); - this.dataVizExtn.invalidateViewables(spritesToUpdate, (viewable) => { - return { - // Move the viewable to a new location. - position: { x: 0, y: 0, z: 100 }, + myBaja.setSubscribeDevicesCallBack((data) => { + // console.log(data) + this.bajaChaCallback ? this.bajaChaCallback(data) : ""; + if (this.curDevice == null) { + return false; + } - }; - }); - console.log(this.floorHeight, this.dataVizExtn) - console.log("site") - //let nodeIds = this.allSensorDevList - // .filter((x) => !isNaN(parseInt(x.forge_dbid))) - // .map((x) => { - // return { devNum: x.device_number, nodeId: parseInt(x.forge_dbid) }; - // }); - //console.log("sensor", nodeIds) - //$.each(nodeIds, (idx, node) => { - // let options = { - // element: $(this.selector), - // viewer: this.viewer, - // nodeId: node, - // floorHeight: this.floorHeight ?? [], - // inited: function () { + data.device_number = data.device_number_full; // "TPE_B1_ME_M12_U1F_NA_TH_N1" (forge TPE_B1_ME_M12_R2F_NA_TH_N1) - // } - // } - // let elevator3DObj = new elevator3D(options); - // elevator3DObj.init(() => { + //將訂閱值塞入 subDeviceData + if ( + this.subDeviceData.findIndex(d => d.device_number == this.curDevice.id) == -1 + ) { + let obj = {}; + obj.device_number = this.curDevice.id; + obj.dbid = this.curDevice.roomDbId; + 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" + ); - // const frags = this.viewer.model.getFragmentList(); - // let scale = new THREE.Vector3(); - // let rotation = new THREE.Quaternion(); - // let translation = new THREE.Vector3(); - // frags.getAnimTransform(node.nodeId, scale, rotation, translation); - // console.log(frags.getAnimTransform(node.nodeId, scale, rotation, translation)) - // translation.z = this.floorHeight; - // frags.updateAnimTransform(node.nodeId, scale, rotation, translation); - // console.log(frags, frags.getAnimTransform(node.nodeId, scale, rotation, translation)) - // // let frags = elevator3DObj.fragProxys.filter(x => x.nodeId == node); - // // console.log("sensor",elevator3DObj, frags) + if (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; - // // let fragProxy = this.viewer.impl.getFragmentProxy(this.viewer.model, node.nodeId) - // // fragProxy.position = new THREE.Vector3(0, 0, 0) - // // console.log(node,fragProxy) - // // fragProxy.position.z = this.floorHeight - // // fragProxy.updateAnimTransform() + 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)) + } + }); - // // frags.forEach((fragProxy) => { - // // console.log("sensor", this) - // // console.log("elev2") - // // fragProxy.frag.position.z = this.floorHeight - // // console.log("sensor", fragProxy, fragProxy.frag) - // // fragProxy.frag.updateAnimTransform() - // // }) + myBaja.setSubscribeDeviceEndCallBack((data) => { + if (data.findIndex((x) => x.point_name == "Temp" || x.point_name == "TEMP") != -1) { + // 顯示溫度條 + showHeat("[name=forgeHeatBar]"); + } + }); + // window.x = 28 + // setInterval(()=>{ + // this.changeColorForSensorHotspot(this.curDevice.forge_dbid, x++) + // }, 2000) + } - // this.viewer.impl.sceneUpdated(true) - // }) - //}) - } } \ No newline at end of file diff --git a/Frontend/lib/skins/skin-master.css b/Frontend/lib/skins/skin-master.css index d8e6611..56b7f03 100644 --- a/Frontend/lib/skins/skin-master.css +++ b/Frontend/lib/skins/skin-master.css @@ -301,8 +301,9 @@ body:not(.mod-skin-light):not(.mod-skin-dark) #skin-default:before { color: #bdbdbd; } .mod-skin-dark:not(.mod-skin-light) .page-content-wrapper a:not(.btn):not(.badge):not(.dropdown-item):not(.nav-link):not(.navbar-brand):not(.card-title):not([class*="fc-"]):not([class*="text-"]):not(.btn-search-close), .mod-skin-dark:not(.mod-skin-light) .modal-body a:not(.btn):not(.badge):not(.dropdown-item):not(.nav-link):not(.page-link):not(.navbar-brand):not(.card-title) { - color: #ffffff; - /*color: var(--theme-primary-200);*/ } + /*color: #ffffff;*/ + color: var(--theme-primary-200); + } .mod-skin-dark:not(.mod-skin-light) .text-success { color: var(--theme-success-300) !important; } .mod-skin-dark:not(.mod-skin-light) .text-danger {
- PDF檔案不超過 3MB -
+ PDF檔案不超過 3MB +