diff --git a/Frontend/_sysElevator.html b/Frontend/_sysElevator.html index 401d1ed..7e03d59 100644 --- a/Frontend/_sysElevator.html +++ b/Frontend/_sysElevator.html @@ -968,7 +968,9 @@ $(`#${matchDevice.device_number}_card [name=devStatus]`).text(data.value); //若為異常(match資料庫點位值)且後台有設定為閃爍 if (getValueByName("ST") == matchDevice.device_error_point_value) { - $(`#${matchDevice.device_number}_card`).addClass("light-flash") + $(`#${matchDevice.device_number}_card`).addClass("light-flash"); + } else { + $(`#${matchDevice.device_number}_card`).removeClass("light-flash"); } } //現在樓層 diff --git a/Frontend/_sysMonAll.html b/Frontend/_sysMonAll.html index f52f202..c316840 100644 --- a/Frontend/_sysMonAll.html +++ b/Frontend/_sysMonAll.html @@ -189,6 +189,8 @@ //是否閃爍 if (isFlashing) { $(ele).parents(".card.device-wrap").addClass("light-flash"); + } else { + $(ele).parents(".card.device-wrap").removeClass("light-flash"); } }) } @@ -219,12 +221,6 @@ return strHtml; } - // 設置 Forge 3D 溫度條 - function setTopHeatBar() { - let strHtml = ``; - return strHtml; - } - // forge 3D 異常點位變紅色 function setForgeHotSpotColor(device) { let subData = subDeviceData.filter(x => x.device_number == device.device_number)[0] @@ -474,7 +470,6 @@ setHotspotPoint(myDataList); if (pageAct.sysMainTag == "LT") { setLightPoint(myDataList); - console.log("myDataList", myDataList) } callback ? callback() : ""; } diff --git a/Frontend/_sysMonFloor.html b/Frontend/_sysMonFloor.html index ff6ff9b..81b429c 100644 --- a/Frontend/_sysMonFloor.html +++ b/Frontend/_sysMonFloor.html @@ -18,6 +18,9 @@
+
+ +
@@ -32,6 +35,7 @@ var global_emergency_alarm_device_number = []; var zoomToggle = 3; $(function () { + drawHeatBar(); getHotspotPoint(() => { show3DModel(pageAct.urn); }); @@ -465,10 +469,17 @@ floMyBaja.setSubscribeDeviceEndCallBack(function (data) { endPageLoading(); + if (data.findIndex(x => x.point_name == "Temp") != -1) { + // 顯示溫度條 + showHeat("[name=forgeHeatBar]"); + } }); } + function drawHeatBar() { + $("#forgeHeatBarDiv").html(setTopHeatBar()); + } // 電梯 3D 位置呈現 function set3DElevPos(viewer) { @@ -1070,7 +1081,6 @@ } forge3DElev.init(); - }); } diff --git a/Frontend/index.html b/Frontend/index.html index 34c8456..e0ddb44 100644 --- a/Frontend/index.html +++ b/Frontend/index.html @@ -203,7 +203,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li - + +
+ +
+ @@ -832,7 +836,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li * 登入驗證完成 Callback * */ function isValidLogin() { - + getUserInfo(); iniFroList(); showMainSys(); @@ -840,7 +844,6 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li getSysMonBtnList(); checkDevState(); - if (lastPage) { let lastPageAct = {}; if (isJSON(sessionStorage.getItem("pageAct"))) { @@ -852,7 +855,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li } else { $(`[data-tabname=topFunBtn][data-page=${lastPage}]`).YTTab("setAndClick"); } - + /*$(`[name=topFunBtn][data-page=${lastPage}]`).click();*/ } else { $("#app").load("_dashboard.html", loadCallback); @@ -922,7 +925,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li if (!page) { return; } - if (page != "systemMonitor") { + if (page != "systemMonitor" && page != "sysElevator") { $("#sysMonBtnList .dropdown-item").removeClass("active"); pageAct.sysMainTag = null; pageAct.sysSubTag = null; @@ -939,15 +942,10 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li endPageLoading(); $(".yt-alert").YTAlert().hide(); - if (typeof timeOuters != "undefined" && timeOuters) { - $.each(timeOuters, (idx, timeOut) => { - clearInterval(timeOut); - }) - timeOuters = []; - } + getUserInfo(); - + sessionStorage.setItem("lastPage", page); sessionStorage.setItem("pageAct", JSON.stringify(pageAct)); $("#app").load(`_${page}.html`, loadCallback); @@ -959,14 +957,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li location.href = "/logout"; }) - onEvent("click", "#sysMonBtnList a", function (e) { - //pageAct.sysMainTag = $(this).data("subSysObj").main_system_tag; - //pageAct.sysSubTag = $(this).data("subSysObj").sub_system_tag; - //pageAct.sysSubName = $(this).data("subSysObj").full_name; - //pageAct.sysSubObj = $(this).data("subSysObj"); - //getDevItem(); - }) - + onEvent("active:change", "#buiList", function (e, actEle) { if (actEle) { pageAct.buiTag = $(actEle).prop("id").split("buiBtn")[1]; @@ -988,12 +979,20 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li } }) + onEvent("scroll", window, function () { + if ($(window).scrollTop() != 0) { + $("#noticeBlock").css("top", 0); + } else { + $("#noticeBlock").css("top", 70); + } + }) + onEvent("click", "#testsysbtn", function () { }) - + let fronIdx = 1; $(window).on("timeout:3s", function () { - + getSystemAlarmByBaja((data) => { if (typeof getAlarmSub != "undefined" && getAlarmSub) { getAlarmSub(data); @@ -1001,7 +1000,28 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li alarmIconBlink(); }) - showWarToast(); + let content = `
+
+ 異常編號:001 +
+
+ 異常等級:2 +
+
+ 異常類別:S01 +
+
+ 設備名稱:電表01 +
+
+ 異常訊息:壞掉 +
+ +
` + let titleHtml = `異常通知` + + $("#noticeBlock").YTNotice("add", titleHtml + fronIdx, content,"warning"); + fronIdx++; }) } @@ -1084,7 +1104,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li function drawErrRecTabBlo() { let strHtml = ` -
` + ` return strHtml; } @@ -1092,7 +1112,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li function drawOpeRecTabBlo() { let strHtml = ` -
` + ` return strHtml; } @@ -1109,35 +1129,35 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li let lightHtml = type == "light" ? `` : ""; let option = { html: `
-
+
-
- -
- -
-
-
- ${drawStateTabBlo(devNum)} -
-
+
+ +
+ +
+
+
+ ${drawStateTabBlo(devNum)} +
+
-
-
- ${drawErrRecTabBlo()} -
-
- ${drawOpeRecTabBlo()} -
-
-
`, +
+
+ ${drawErrRecTabBlo()} +
+
+ ${drawOpeRecTabBlo()} +
+
+ `, group: "device", onShow: function (tooltipEle, oriEle) { // 執行 pop 視窗上方 Tab 類別 @@ -1164,7 +1184,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li }); // pop 視窗卡片可縮放功能初始化 $(tooltipEle).resizable({ - resize: function (event,ui) { + resize: function (event, ui) { let iframe = $(ui.element).find("iframe"); if (iframe.length != 0) { if (ui.size.width != ui.originalSize.width) { @@ -1175,11 +1195,11 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li } let cardBodyHeight = $(ui.element).find(".card-body").css("height"); $(ui.element).find(".scrolledTable").css("height", cardBodyHeight) - + errRecTable.draw(false) }, minWidth: 200, - minHeight:150, + minHeight: 150, }); // 電梯管理 - Card table 更新 typeof subDeviceSetTable != "undefined" ? subDeviceSetTable($(oriEle).data("number")) : "" @@ -1415,6 +1435,12 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li return parentEle; } + // 設置 Forge 3D 溫度條 + function setTopHeatBar() { + let strHtml = ``; + return strHtml; + } + //============================================================================== // ↑ 系統監控 - 共用 Function ↑ //============================================================================== @@ -1433,7 +1459,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li function getDevItem() { let url = baseApiUrl + "/api/Device/GetDeviceItem"; - + objSendData.Data = { main_system_tag: pageAct.sysMainTag, sub_system_tag: pageAct.sysSubTag, @@ -1458,7 +1484,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li function timeOutGetData() { let timeOut3s = null, timeOut5m = null; let events = $._data($(window)[0], "events"); - + if (Object.keys(events).findIndex(x => x == "timeout:3s") != -1) { timeOut3s = setInterval(() => { $(window).trigger("timeout:3s"); @@ -1509,35 +1535,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 += `
- + -
`; + `; 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} +
+ `; } }); @@ -1561,7 +1587,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li } else { $("#sysMonBtnList").html("") - + $.each(res.data.history_Main_Systems, (index, mainSysObj) => { $.each(mainSysObj.history_Sub_systems, (index2, subSysObj) => { let page = "systemMonitor"; @@ -1581,12 +1607,12 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li }, null, "POST").send(); } - function getLogo() { + function getLogo() { url = baseApiUrl + '/api/GetLogo'; ytAjax = new YourTeam.Ajax(url, null, function (res) { $('[name=webLogo]').attr('src', baseImgUrl + '/img/' + res.data); }, null, "POST").send(); - } + } function getUserInfo() { let url = baseApiUrl + varApiUrl + "getUserFull"; @@ -1602,55 +1628,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li }, null, "POST").send(); } - function showWarToast() { - //let options = { - // "closeButton": false, - // "debug": false, - // "newestOnTop": true, - // "progressBar": false, - // "positionClass": "toast-top-right", - // "preventDuplicates": false, - // "onclick": null, - // "showDuration": "300", - // "hideDuration": "1000", - // "timeOut": 0, - // "extendedTimeOut": 0, - // "showEasing": "swing", - // "hideEasing": "linear", - // "showMethod": "fadeIn", - // "hideMethod": "fadeOut", - // "tapToDismiss": false - //} - - //if ($("#toast-container .toast").length < 2) { - // let strConHtml = `
- //
- // 異常編號:001 - //
- //
- // 異常等級:2 - //
- //
- // 異常類別:S01 - //
- //
- // 設備名稱:電表01 - //
- //
- // 異常訊息:壞掉 - //
- - //
`; - // let titleHtml = `
- //
- // 異常通知 - // 2023/01/01 12:00:00 - //
- //
` - // toastr.warning(strConHtml, titleHtml, options) - //} - - } + diff --git a/Frontend/js/forge/forgemodel.js b/Frontend/js/forge/forgemodel.js index b633566..d96b474 100644 --- a/Frontend/js/forge/forgemodel.js +++ b/Frontend/js/forge/forgemodel.js @@ -734,12 +734,16 @@ async function testNewLight(dataList) { lightList[index].lightObject.position.set(position.x, position.y, position.z); lightList[index].lightObject.castShadow = true; lightList[index].lightObject.visible = true; - lightList[index].lightObject.target.position.set(position.x, position.y, position.z - 20); + lightList[index].lightObject.target.position.set(position.x, position.y, position.z - 100); viewer.scene.add(lightList[index].lightObject.target); viewer.scene.add(lightList[index].lightObject); - viewer.impl.sceneUpdated(true); + + //let spotLightHelper = new THREE.SpotLightHelper(lightList[index].lightObject); + //viewer.scene.add(spotLightHelper); + }); + viewer.impl.sceneUpdated(true); } //------------------- 加入熱點 ----------------- diff --git a/Frontend/js/site.js b/Frontend/js/site.js index 532e847..ec0da10 100644 --- a/Frontend/js/site.js +++ b/Frontend/js/site.js @@ -439,6 +439,161 @@ function isJSON(str) { } } +function addBsToast(container, type = "warning",title="",content ="", id, datas = {}, option = {}) { + datas = Object.keys(datas).length != 0 ? `${Object.keys(datas).map(x => `data-${x}="${datas[x]}"`).join(" ")}` : ""; + let iconClass = option.iconHtml ?? `fas fa-exclamation-triangle`; + let strHtml = `` +} + +class YTNotice { + constructor(option = {}) { + this.title = option.title ?? ""; + this.content = option.content ?? ""; + this.type = option.type ?? null; + this.keepTime = 0; + this.iconClass = option.iconClass ?? ""; + this.container = ""; + this.eIcon = ""; + this.eTitle = ""; + this.eTimeAgo = ""; + this.eCloseBtn = ""; + this.eContent = ""; + this.init(); + } + + init = function () { + this.setIconClass(); + this.setContainer(); + + if (this.title) { + this.setTitle(this.title); + } + if (this.content) { + this.setContent(this.content); + } + } + + setContainer = function () { + this.container = $(``); + + this.setIcon(this.iconClass); + this.eTitle = $(``); + this.eTimeAgo = $(`just now`); + this.eCloseBtn = $(``); + this.eContent = $(`
`); + if (this.type != null) { + this.container.find(".toast-header").append(this.eIcon); + this.eIcon.addClass("text-" + this.type); + } + this.container.find(".toast-header").append(this.eTitle); + this.container.find(".toast-header").append(this.eTimeAgo); + this.container.find(".toast-header").append(this.eCloseBtn); + this.container.find(".toast-body").append(this.eContent); + } + + setIconClass = function () { + if (this.type == "success") { + this.iconClass = `fas fa-check`; + } else if (this.type == "warning") { + this.iconClass = `fas fa-exclamation-triangle`; + } else if (this.type == "danger") { + this.iconClass = `fas fa-times`; + } + } + + setIcon = function (iconClass) { + this.eIcon = $(``); + this.eIcon.addClass(iconClass); + } + + setTitle = function (title = "") { + this.eTitle.html(title); + } + + setTimeAgo = function (timeAgo = "") { + this.eTimeAgo.text(timeAgo); + } + + setContent = function (content = "") { + this.eContent.html(content); + } + +} + +class YTNoticeBlock { + constructor(option = {}) { + this.element = option.element; + this.offsetBottom = 200; + this.noticeArr = []; + } + + addNotice = function (option = {}) { + let notice = new YTNotice(option); + $(this.element).prepend(notice.container); + let lastNoticeOffset = $(this.element).find(".toast").last().offset(); + if (lastNoticeOffset.top + this.offsetBottom > $(window).height()) { + $(this.noticeArr[0].obj.container).toast('dispose'); + setTimeout(() => { + $(this.noticeArr[0].obj.container).remove(); + this.noticeArr.shift(); + }, 500) + + } + $(notice.container).toast('show'); + this.noticeArr.push({ obj: notice, time: (new Date()).getTime() }); + } +} + +$.fn.YTNotice = function (method = "init", ...args) { + let _this = this; + + if (method == "init") { + initNoticeBlock(); + } + + if (method == "add") { + let argArr = ["title", "content", "type", "iconClass"]; + let opt = {}; + let noticeBlock = _this[0]._noticeBlock; + if (!noticeBlock) { + initNoticeBlock(); + noticeBlock = _this[0]._noticeBlock; + } + argArr.forEach((arg, idx) => { + opt[argArr[idx]] = args[idx]; + }) + + noticeBlock.addNotice(opt); + } + + + function initNoticeBlock() { + let option = {}; + option.element = _this; + let noticeBlock = new YTNoticeBlock(option); + _this[0]._noticeBlock = noticeBlock; + } + +} /** * 取得資料庫電梯設備,根據 baja 訂閱移動 3D 電梯 diff --git a/Frontend/js/style.js b/Frontend/js/style.js index edee415..ff91a6e 100644 --- a/Frontend/js/style.js +++ b/Frontend/js/style.js @@ -1427,8 +1427,12 @@ async function download(token,url, filename,callback = null) { } function onEvent(type, selector, callback) { - $("body").off(type, selector); - $("body").on(type, selector, callback); + if (selector == "body" || selector == window) { + $(selector).on(type, callback); + } else { + $("body").off(type, selector); + $("body").on(type, selector, callback); + } } /**