From 745ee1d474b609830841a1d22f0af4ecd67308c3 Mon Sep 17 00:00:00 2001 From: dev01 Date: Fri, 13 Jan 2023 16:06:47 +0800 Subject: [PATCH 1/2] =?UTF-8?q?[FrontendWebApi]=20=E5=8F=96=E5=BE=97?= =?UTF-8?q?=E4=B8=8D=E5=8F=AF=E8=A6=963D=E6=A8=A1=E5=9E=8B=E9=A1=9E?= =?UTF-8?q?=E5=9E=8B=20API=20=E5=BB=BA=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ApiControllers/DeviceManageController.cs | 46 +++++++++++++++++++ FrontendWebApi/Models/Device.cs | 10 ++++ 2 files changed, 56 insertions(+) diff --git a/FrontendWebApi/ApiControllers/DeviceManageController.cs b/FrontendWebApi/ApiControllers/DeviceManageController.cs index 1f0e2eb..60866ea 100644 --- a/FrontendWebApi/ApiControllers/DeviceManageController.cs +++ b/FrontendWebApi/ApiControllers/DeviceManageController.cs @@ -898,6 +898,52 @@ namespace FrontendWebApi.ApiControllers var param = new { @main_system_tag = fdi.main_system_tag, @sub_system_tag = fdi.sub_system_tag, @points = fdi.points }; var fr = await backendRepository.GetAllAsync(sqlString, param); + apiResult.Code = "0000"; + apiResult.Data = fr; + } + catch (Exception exception) + { + apiResult.Code = "9999"; + apiResult.Msg = "系統內部錯誤,請聯絡管理者。"; + Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); + return Ok(apiResult); + } + return Ok(apiResult); + } + + /// + /// 取得 Forge 3D 模型不可見的類型 + /// + /// + [HttpPost] + [Route("api/Device/GetForgeInvType")] + public async Task>>> GetForgeInvType([FromBody] string search_tag) + { + ApiResult> apiResult = new ApiResult>(); + + try + { + var sqlString = $@"SELECT + v1.system_key AS 'invisible_type', + v1.system_value AS 'invisible_value', + v2.system_value AS 'sub_system_tag' + FROM variable v1 + LEFT JOIN variable v2 ON v2.id = v1.system_parent_id AND v2.deleted = '0' + WHERE + v1.deleted = '0' + AND v1.system_type = 'forge_3d_invisible_type' + AND ( + (@isDef = true AND v1.system_key = 'default_value') + OR (@isDef = false AND v2.system_value = @sub_system_tag) + OR (@isDef = false AND @sub_system_tag IS NULL AND v1.system_key = 'default_value') + OR (@isDef = false AND @sub_system_tag IS NULL AND v2.system_value = v2.system_value) + )"; + + var param = new { sub_system_tag = search_tag == "forge_default" ? null : search_tag, isDef = search_tag == "forge_default" }; + + var fr = await backendRepository.GetAllAsync(sqlString, param); + + apiResult.Code = "0000"; apiResult.Data = fr; } diff --git a/FrontendWebApi/Models/Device.cs b/FrontendWebApi/Models/Device.cs index 0508d4e..92ba15a 100644 --- a/FrontendWebApi/Models/Device.cs +++ b/FrontendWebApi/Models/Device.cs @@ -164,4 +164,14 @@ namespace FrontendWebApi.Models public string points { get; set; } } + + public class ForgeInvisible + { + public string invisible_type { get; set; } + public string invisible_value { get; set; } + public string sub_system_tag { get; set; } + + } + + } From 17ac7ab333fb655012ef48372168723aea1ed44e Mon Sep 17 00:00:00 2001 From: dev01 Date: Fri, 13 Jan 2023 16:49:55 +0800 Subject: [PATCH 2/2] =?UTF-8?q?[Frontend][=E5=85=A8=E5=9F=9F=E5=8A=9F?= =?UTF-8?q?=E8=83=BD]=20displayDate=20Fn=20=E7=A8=8B=E5=BA=8F=E8=AA=BF?= =?UTF-8?q?=E6=95=B4=20|=20=E5=91=8A=E8=AD=A6=E8=A8=8A=E6=81=AF=E8=A6=96?= =?UTF-8?q?=E7=AA=97=E6=B6=88=E5=A4=B1=E5=8A=A0=E5=BF=AB=20|=20[=E5=85=A8?= =?UTF-8?q?=E5=9F=9F=E5=8A=9F=E8=83=BD]=20=E5=A2=9E=E5=8A=A0=E9=A1=AF?= =?UTF-8?q?=E7=A4=BA=E9=9A=B1=E8=97=8F=E5=91=8A=E8=AD=A6=E8=A8=8A=E6=81=AF?= =?UTF-8?q?=E6=8C=89=E9=88=95=20|=20ack=20=E7=A2=BA=E8=AA=8D=E6=8C=89?= =?UTF-8?q?=E9=88=95=20POST=20obix=20API=20=E4=B8=B2=E6=8E=A5=20|=20[?= =?UTF-8?q?=E7=B3=BB=E7=B5=B1=E7=9B=A3=E6=8E=A7]=20=E7=87=88=E6=8E=A7?= =?UTF-8?q?=E6=8E=92=E6=88=90=E6=8F=9B=E4=B8=8A=20N4=20Url=20|=20[?= =?UTF-8?q?=E7=B3=BB=E7=B5=B1=E7=9B=A3=E6=8E=A7]=20forge3D=20=E4=B8=8D?= =?UTF-8?q?=E5=8F=AF=E8=A6=96=E6=A8=A1=E5=9E=8B=E9=A1=9E=E5=9E=8B=E5=8B=95?= =?UTF-8?q?=E6=85=8B=E5=91=88=E7=8F=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frontend/_sysMonAll.html | 54 ++++++++++-- Frontend/index.html | 86 +++++++++++++++++-- Frontend/js/forge/forgemodel.js | 5 ++ Frontend/js/n4js/bajatest.js | 1 - Frontend/js/style.js | 9 +- .../yourteam/plugins/yt-notice/yt-notice.js | 2 +- 6 files changed, 140 insertions(+), 17 deletions(-) diff --git a/Frontend/_sysMonAll.html b/Frontend/_sysMonAll.html index c316840..0d1e312 100644 --- a/Frontend/_sysMonAll.html +++ b/Frontend/_sysMonAll.html @@ -23,8 +23,10 @@

@@ -845,6 +860,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li getBuiList(); getSysMonBtnList(); checkDevState(); + loadNoticeConSta(); if (lastPage) { 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 () { if (pageAct.sysMainTag == "LT" && $("#lightSchModal").length != 0) { - loadLightSchTable(); + setLightSchBlcok ? setLightSchBlcok(this) : ""; $("#lightSchModal").modal("show"); } }) @@ -996,6 +1012,22 @@ 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^=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 = ''; + $.post(url, sendData, (rel) => { + $(this).parents(".toast").YTNotice("hide"); + }, "text") + }) + }) + + onEvent("click", "#toggleNoticeBtn", function () { + chaNoticeConSta(); + }) $(window).on("timeout:3s", function () { @@ -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 lightHtml = type == "light" ? `` : ""; let option = { - html: `
+ html: `
@@ -1644,7 +1676,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li 異常訊息:${data.errMsg}
- +
` @@ -1662,11 +1694,55 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li }) if (notices.length != 0) { $("#noticeBlock").YTNotice("add_many", notices.oSort("id").reverse()); + } - console.log("res", res) + } }, 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"); + } + + } diff --git a/Frontend/js/forge/forgemodel.js b/Frontend/js/forge/forgemodel.js index d96b474..6f33971 100644 --- a/Frontend/js/forge/forgemodel.js +++ b/Frontend/js/forge/forgemodel.js @@ -227,6 +227,11 @@ class elevator3D { // 通知檢視器更新場景 this.viewer.impl.sceneUpdated(true); + if (!$(this.ele)[0]) { + callback ? callback() : ""; + return; + } + if (typeof $(this.ele)[0]._elevator3D == "undefined") { $(this.ele)[0]._elevator3D = []; } diff --git a/Frontend/js/n4js/bajatest.js b/Frontend/js/n4js/bajatest.js index e20d5f0..d9260a0 100644 --- a/Frontend/js/n4js/bajatest.js +++ b/Frontend/js/n4js/bajatest.js @@ -296,7 +296,6 @@ function MyBaja() { // 取得使用者帳號 this.setMyUserAccount = function (callBackFunc = null) { require(['baja!'], function (baja) { - console.log("baja", baja) user_name = baja.getUserName(); callBackFunc ? callBackFunc(user_name) : ""; }); diff --git a/Frontend/js/style.js b/Frontend/js/style.js index babf74b..250cb25 100644 --- a/Frontend/js/style.js +++ b/Frontend/js/style.js @@ -365,7 +365,7 @@ function displayDate(dateTime, dateType = "YMdHms", locale = 'zh-TW') { date = [year, String(month).padStart(2, '0'), String(day).padStart(2, '0')].filter(n => n).join("/"); time = [String(hour).padStart(2, '0'), String(minute).padStart(2, '0')].join(":"); - + if (dateType != "date" && dateType != "time" && dateType != "datetime") { let showArr = []; if (year) showArr.push(year); @@ -375,9 +375,10 @@ function displayDate(dateTime, dateType = "YMdHms", locale = 'zh-TW') { result += showArr.join("/"); showArr = []; } - if (hour) showArr.push(hour.toString().padStart(2, '0')); - if (minute) showArr.push(minute.toString().padStart(2, '0')); - if (second) showArr.push(second.toString().padStart(2, '0')); + + if (hour !== "") showArr.push(hour.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 (showArr.length != 0) { result += " " + showArr.join(":"); diff --git a/Frontend/js/yourteam/plugins/yt-notice/yt-notice.js b/Frontend/js/yourteam/plugins/yt-notice/yt-notice.js index cc959e4..9e01431 100644 --- a/Frontend/js/yourteam/plugins/yt-notice/yt-notice.js +++ b/Frontend/js/yourteam/plugins/yt-notice/yt-notice.js @@ -180,7 +180,7 @@ class YTNoticeBlock { } this.showNotices(); - }, 500) + }, 100) }