[Frontend][全域功能] displayDate Fn 程序調整 | 告警訊息視窗消失加快 | [全域功能] 增加顯示隱藏告警訊息按鈕 | ack 確認按鈕 POST obix API 串接 | [系統監控] 燈控排成換上 N4 Url | [系統監控] forge3D 不可視模型類型動態呈現

This commit is contained in:
dev01 2023-01-13 16:49:55 +08:00
parent 745ee1d474
commit 17ac7ab333
6 changed files with 140 additions and 17 deletions

View File

@ -23,8 +23,10 @@
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<table id="lightSchTable" class="table table-bordered table-striped text-center m-0 w-100"> <!--<table id="lightSchTable" class="table table-bordered table-striped text-center m-0 w-100">
</table> </table>-->
<div id="lightSchBlock" style="height:60vh"></div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">關閉</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">關閉</button>
@ -39,6 +41,8 @@
var subDeviceData = []; var subDeviceData = [];
var heatMap = null; var heatMap = null;
var buildMenuData = {}; var buildMenuData = {};
var forgeInvType = null;
var forgeInvTypeDef = null;
$(function () { $(function () {
getBuildMenu((arr, data) => { getBuildMenu((arr, data) => {
@ -50,6 +54,7 @@
if (arr.indexOf(3) != -1) { if (arr.indexOf(3) != -1) {
getHotspotPoint(() => { getHotspotPoint(() => {
show3DModel(data.urn_3D); show3DModel(data.urn_3D);
getInviForge();
}); });
} }
}); });
@ -221,6 +226,13 @@
return strHtml; return strHtml;
} }
function setLightSchBlcok(obj) {
let devNum = $(obj).parents(".device-wrap").data("number");
let devPath = devNum.replaceAll("_", "/");
let iframe = `<iframe src="/ord?station:%7Cslot:/${devPath}/Sch|view:?fullScreen=true" style="min-height:100px;width:100%;height:100%"></iframe>`
$("#lightSchBlock").html(iframe);
}
// forge 3D 異常點位變紅色 // forge 3D 異常點位變紅色
function setForgeHotSpotColor(device) { function setForgeHotSpotColor(device) {
let subData = subDeviceData.filter(x => x.device_number == device.device_number)[0] let subData = subDeviceData.filter(x => x.device_number == device.device_number)[0]
@ -365,9 +377,14 @@
$(loadEle).Loading("start"); $(loadEle).Loading("start");
launchViewerForHotspot(urn, (viewer, nodeIds) => { launchViewerForHotspot(urn, (viewer, nodeIds) => {
let devDbIds = allDevList.map(x => x.forge_dbid); let devDbIds = allDevList.map(x => x.forge_dbid);
/*hideAllObjects(devDbIds);*/
setTransparentBuilding(0, devDbIds); // 從資料庫設定不可視模型的類型,若沒有取道該小類不可視類型,則套用資料庫設定預設類型
if (forgeInvType) {
setInviForge(forgeInvType, devDbIds);
} else {
setInviForge(forgeInvTypeDef, devDbIds);
}
$(loadEle).Loading("close"); $(loadEle).Loading("close");
let devices = allDevList.map(x => { let devices = allDevList.map(x => {
@ -406,7 +423,6 @@
} }
forge3DElev.init(); forge3DElev.init();
if (subDeviceData.length != 0) { if (subDeviceData.length != 0) {
let stSubArr = subDeviceData.map(x => Object.keys(x).filter(y => y == "ST").map(y => x)); let stSubArr = subDeviceData.map(x => Object.keys(x).filter(y => y == "ST").map(y => x));
@ -487,6 +503,32 @@
getLightData(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) {
console.log("devDbIds",devDbIds)
if (type == "Hide") {
hideAllObjects(devDbIds);
} else if (type == "Opacity") {
setTransparentBuilding(0, devDbIds);
}
}
var parentEle = ""; var parentEle = "";
onEvent("autodesk:click:sprite", "[name=forgeViewer]", function (e, obj) { onEvent("autodesk:click:sprite", "[name=forgeViewer]", function (e, obj) {
forgeUnFocusAll(); forgeUnFocusAll();

View File

@ -194,6 +194,20 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
</div> </div>
<div class="ml-auto d-flex mr-3"> <div class="ml-auto d-flex mr-3">
<div class="dropdown">
<a href="javascript:;" id="toggleNoticeBtn" class="d-flex align-items-center justify-content-center ml-2">
<!--<img src="img/demo/avatars/avatar-admin.png" class="profile-image rounded-circle"
alt="Dr. Codex Lantern">-->
<!--you can also add username next to the avatar with the codes below:-->
<div class="row m-0 justify-content-center userblock">
<i id="noticeConIcon" class=" fs-1-5 w-100 text-center"></i>
<span id="noticeConText" class="text-truncate text-truncate-header hidden-xs-down" data-hide="隱藏警告" data-show="顯示警告"></span>
</div>
</a>
</div>
<!--app user menu--> <!--app user menu-->
<div class="dropdown"> <div class="dropdown">
<a href="#" data-toggle="dropdown" data-target="logoutList" class="d-flex align-items-center justify-content-center ml-2"> <a href="#" data-toggle="dropdown" data-target="logoutList" class="d-flex align-items-center justify-content-center ml-2">
@ -213,6 +227,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
</a> </a>
</div> </div>
</div> </div>
</div> </div>
<div class="ml-2 text-center"> <div class="ml-2 text-center">
<label class="mb-0 fs-1-2">Diamond Controls<span class="fs-09 position-absolute">®</span></label><br> <label class="mb-0 fs-1-2">Diamond Controls<span class="fs-09 position-absolute">®</span></label><br>
@ -845,6 +860,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
getBuiList(); getBuiList();
getSysMonBtnList(); getSysMonBtnList();
checkDevState(); checkDevState();
loadNoticeConSta();
if (lastPage) { if (lastPage) {
let lastPageAct = {}; let lastPageAct = {};
@ -970,7 +986,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
onEvent("yt:tab:change", "#lightSch-tab", function () { onEvent("yt:tab:change", "#lightSch-tab", function () {
if (pageAct.sysMainTag == "LT" && $("#lightSchModal").length != 0) { if (pageAct.sysMainTag == "LT" && $("#lightSchModal").length != 0) {
loadLightSchTable(); setLightSchBlcok ? setLightSchBlcok(this) : "";
$("#lightSchModal").modal("show"); $("#lightSchModal").modal("show");
} }
}) })
@ -997,6 +1013,22 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
$(this).parents(".toast").YTNotice("hide"); $(this).parents(".toast").YTNotice("hide");
}) })
onEvent("click", "button[id^=bajaAckBtn]", function () {
let uuid = $(this).data("uuid");
let url = window.location.origin + "/obix/alarm/" + uuid + "/ack";
let myBaja = new MyBaja();
myBaja.setMyUserAccount((data) => {
let sendData = '<obj is="obix:AckAlarmIn"><str name="' + data + '" val="obix" /></obj>';
$.post(url, sendData, (rel) => {
$(this).parents(".toast").YTNotice("hide");
}, "text")
})
})
onEvent("click", "#toggleNoticeBtn", function () {
chaNoticeConSta();
})
$(window).on("timeout:3s", function () { $(window).on("timeout:3s", function () {
getSystemAlarmByBaja((data) => { getSystemAlarmByBaja((data) => {
@ -1115,7 +1147,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
let devName = $(ele).data("name"); //full_name let devName = $(ele).data("name"); //full_name
let lightHtml = type == "light" ? `<button type="button" id="lightSch-tab" class="btn btn-icon nav-link" role="tab" data-tabname="cardTab" data-target="#lightSch"><i class="fas fa-calendar-alt"></i></button>` : ""; let lightHtml = type == "light" ? `<button type="button" id="lightSch-tab" class="btn btn-icon nav-link" role="tab" data-tabname="cardTab" data-target="#lightSch"><i class="fas fa-calendar-alt"></i></button>` : "";
let option = { let option = {
html: `<div class="card m-1 border device-wrap"> html: `<div class="card m-1 border device-wrap" data-number="${devNum}">
<div class="card-header p-3"> <div class="card-header p-3">
<div class="position-absolute w-50" style="word-break: break-all;"> <div class="position-absolute w-50" style="word-break: break-all;">
@ -1644,7 +1676,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
<span class="m-0">異常訊息:<span>${data.errMsg}</span></span> <span class="m-0">異常訊息:<span>${data.errMsg}</span></span>
</div> </div>
<div class="d-flex m-0 gap-5 mt-2"> <div class="d-flex m-0 gap-5 mt-2">
<button class="btn btn-sm btn-primary col-8 text-nowrap">已至現場確認問題</button> <button id="bajaAckBtn${data.id}" data-uuid="${data.uuid}" class="btn btn-sm btn-primary col-8 text-nowrap">已至現場確認問題</button>
<button id="noticeChkBtn${data.id}" class="btn btn-sm btn-secondary col-4">確認</button> <button id="noticeChkBtn${data.id}" class="btn btn-sm btn-secondary col-4">確認</button>
</div> </div>
</div>` </div>`
@ -1662,11 +1694,55 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
}) })
if (notices.length != 0) { if (notices.length != 0) {
$("#noticeBlock").YTNotice("add_many", notices.oSort("id").reverse()); $("#noticeBlock").YTNotice("add_many", notices.oSort("id").reverse());
} }
console.log("res", res)
} }
}, null, "POST",true).send(); }, null, "POST",true).send();
} }
function loadNoticeConSta() {
let noticeStatus = localStorage.getItem("noticeStatus");
chaNoticeConSta(noticeStatus ?? "show");
}
function chaNoticeConSta(type = null) {
let showText = $("#toggleNoticeBtn #noticeConText").data("show");
let hideText = $("#toggleNoticeBtn #noticeConText").data("hide");
let iconArr = ["fal fa-comment-slash", "fal fa-comment-dots"];
$("#noticeConIcon").removeClass(iconArr[0]).removeClass(iconArr[1]);
if (type != null) {
if (type == "hide") {
setHide();
} else if (type == "show") {
setShow();
}
} else {
if ($("#noticeBlock").is(":visible")) {
setHide();
} else if (!$("#noticeBlock").is(":visible")) {
setShow();
}
}
function setShow() {
$("#toggleNoticeBtn").find("#noticeConText").text(hideText);
$("#noticeConIcon").addClass(iconArr[0]);
$("#noticeBlock").show();
$("#noticeBlock").animate({ opacity: 1 }, 200)
localStorage.setItem("noticeStatus", "show");
}
function setHide() {
$("#toggleNoticeBtn").find("#noticeConText").text(showText);
$("#noticeConIcon").addClass(iconArr[1]);
$("#noticeBlock").animate({ opacity: 0 }, 200, function () {
$("#noticeBlock").hide();
})
localStorage.setItem("noticeStatus", "hide");
}
}
</script> </script>
</body> </body>

View File

@ -227,6 +227,11 @@ class elevator3D {
// 通知檢視器更新場景 // 通知檢視器更新場景
this.viewer.impl.sceneUpdated(true); this.viewer.impl.sceneUpdated(true);
if (!$(this.ele)[0]) {
callback ? callback() : "";
return;
}
if (typeof $(this.ele)[0]._elevator3D == "undefined") { if (typeof $(this.ele)[0]._elevator3D == "undefined") {
$(this.ele)[0]._elevator3D = []; $(this.ele)[0]._elevator3D = [];
} }

View File

@ -296,7 +296,6 @@ function MyBaja() {
// 取得使用者帳號 // 取得使用者帳號
this.setMyUserAccount = function (callBackFunc = null) { this.setMyUserAccount = function (callBackFunc = null) {
require(['baja!'], function (baja) { require(['baja!'], function (baja) {
console.log("baja", baja)
user_name = baja.getUserName(); user_name = baja.getUserName();
callBackFunc ? callBackFunc(user_name) : ""; callBackFunc ? callBackFunc(user_name) : "";
}); });

View File

@ -375,9 +375,10 @@ function displayDate(dateTime, dateType = "YMdHms", locale = 'zh-TW') {
result += showArr.join("/"); result += showArr.join("/");
showArr = []; showArr = [];
} }
if (hour) showArr.push(hour.toString().padStart(2, '0'));
if (minute) showArr.push(minute.toString().padStart(2, '0')); if (hour !== "") showArr.push(hour.toString().padStart(2, '0'));
if (second) showArr.push(second.toString().padStart(2, '0')); if (minute !== "") showArr.push(minute.toString().padStart(2, '0'));
if (second !== "") showArr.push(second.toString().padStart(2, '0'));
if (millisecond) showArr.push(millisecond.toString().padStart(3, '0')); if (millisecond) showArr.push(millisecond.toString().padStart(3, '0'));
if (showArr.length != 0) { if (showArr.length != 0) {
result += " " + showArr.join(":"); result += " " + showArr.join(":");

View File

@ -180,7 +180,7 @@ class YTNoticeBlock {
} }
this.showNotices(); this.showNotices();
}, 500) }, 100)
} }