From 3f9aca1e4eec4e9045f3b297eec699766740e44a Mon Sep 17 00:00:00 2001 From: dev01 Date: Wed, 28 Dec 2022 13:12:08 +0800 Subject: [PATCH] =?UTF-8?q?[Frontend]=20[=E7=B3=BB=E7=B5=B1=E7=9B=A3?= =?UTF-8?q?=E6=8E=A7]=20=E7=86=B1=E9=BB=9E=E9=A1=AF=E7=A4=BA=20popover=20|?= =?UTF-8?q?=20[=E5=85=A8=E5=9F=9F=E5=8A=9F=E8=83=BD]=20YT-Tooltip=20?= =?UTF-8?q?=E6=A0=B9=E6=93=9A=E7=B5=95=E5=B0=8D=E5=BA=A7=E6=A8=99=E9=A1=AF?= =?UTF-8?q?=E7=A4=BA=20popover=20=E7=A8=8B=E5=BA=8F=E5=BB=BA=E7=BD=AE=20|?= =?UTF-8?q?=20[=E5=84=80=E8=A1=A8=E6=9D=BF]=20demo=E7=94=A8=E7=B3=BB?= =?UTF-8?q?=E7=B5=B1=E5=B0=8F=E9=A1=9ECard=E7=A8=8B=E5=BA=8F=E5=BB=BA?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frontend/_dashboard.html | 109 ++++++++++++------ Frontend/_sysMonAll.html | 26 ++++- Frontend/index.html | 22 +++- Frontend/js/forge/forgemodel.js | 5 +- .../yourteam/plugins/yt-tooltip/yt-tooltip.js | 23 +++- 5 files changed, 135 insertions(+), 50 deletions(-) diff --git a/Frontend/_dashboard.html b/Frontend/_dashboard.html index a36c561..0ac082f 100644 --- a/Frontend/_dashboard.html +++ b/Frontend/_dashboard.html @@ -2,9 +2,9 @@
- -
- + +
+
@@ -144,7 +144,7 @@
- +
@@ -156,10 +156,10 @@
- +
- +
@@ -183,7 +183,7 @@
-->
- +
@@ -202,16 +202,16 @@
+
+
+ 3/10 +
+
+ +

14,134

+
+
+
-->
已完成
6
@@ -237,7 +237,7 @@ \ No newline at end of file diff --git a/Frontend/index.html b/Frontend/index.html index e232a14..14b0b0d 100644 --- a/Frontend/index.html +++ b/Frontend/index.html @@ -1978,6 +1978,8 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
+ + @@ -2253,6 +2255,10 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li $("#lightSchModal").modal("show"); } }) + + onEvent("click", "#testsysbtn", function () { + + }) $(window).on("timeout:3s", function () { getSystemAlarmByBaja((data) => { @@ -2357,13 +2363,13 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li } // Card 呈現初始化 - function initPopover(type = null) { - $("[name=devItem]").each((index, ele) => { + function initPopover(type = null, extOption = {},selector = "[name=devItem]") { + $(selector).each((index, ele) => { let devNum = $(ele).data("number"); //設備編號 let devGuid = $(ele).data("id"); //guid let devName = $(ele).data("name"); //full_name let lightHtml = type == "light" ? `` : ""; - $(ele).YTTooltip({ + let option = { html: `
@@ -2402,10 +2408,14 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li //loadErrRecTable2($(oriEle).data("number")); //loadErrRecTable(); loadErr($(oriEle).data("number")); - $(tooltipEle).find("#info").html(typeof drawInfoTabBlo != "undefined"? drawInfoTabBlo(devGuid) : ""); - typeof subDeviceSetTable != "undefined "? subDeviceSetTable($(oriEle).data("number")) : "" + $(tooltipEle).find("#info").html(typeof drawInfoTabBlo != "undefined" ? drawInfoTabBlo(devGuid) : ""); + typeof subDeviceSetTable != "undefined " ? subDeviceSetTable($(oriEle).data("number")) : "" } - }) + }; + + $.extend(option, extOption); + + $(ele).YTTooltip(option); }) } diff --git a/Frontend/js/forge/forgemodel.js b/Frontend/js/forge/forgemodel.js index 3729e3c..1a927de 100644 --- a/Frontend/js/forge/forgemodel.js +++ b/Frontend/js/forge/forgemodel.js @@ -640,7 +640,7 @@ async function addHotPoint(data) { const dbId = 10 + index; const myPosition = myData.position; const viewable = new DataVizCore.SpriteViewable(myPosition, style, dbId); - + myData._dbId = dbId; viewableData.addViewable(viewable); }); @@ -653,7 +653,8 @@ async function addHotPoint(data) { if (event.dbId >= 10 && event.dbId <= 13) {//event.dbId > 0 && event.dbId < 19 console.log(`Sprite clicked: ${event.dbId}`); openHotspotModal(); - $(selector).trigger("autodesk:click:sprite", event); + let myData = myDataList.filter(x => x._dbId == event.dbId)[0]; + $(selector).trigger("autodesk:click:sprite", event, myData); } if (event.clickInfo != null) { diff --git a/Frontend/js/yourteam/plugins/yt-tooltip/yt-tooltip.js b/Frontend/js/yourteam/plugins/yt-tooltip/yt-tooltip.js index f0b9dc2..60208ba 100644 --- a/Frontend/js/yourteam/plugins/yt-tooltip/yt-tooltip.js +++ b/Frontend/js/yourteam/plugins/yt-tooltip/yt-tooltip.js @@ -31,6 +31,12 @@ $.fn.YTTooltip = function (option) { hideTooltipEvent: hideTooltipEvent, onShow: option.onShow || null, group: option.group || null, + targetPosition: { + left: option.tpLeft || null, + top: option.tpTop || null, + offsetWidth: option.tpOffWidth || null, + offsetHeight: option.tpOffHeight || null, + } }; if (obj.toggle == "hover") { @@ -49,10 +55,21 @@ $.fn.YTTooltip = function (option) { let bodyHeight = $("body")[0].offsetHeight; //計算引用元素 offset let offset = $(this).offset(); + if (obj.targetPosition.left != null) { + offset.left = obj.targetPosition.left; + } + if (obj.targetPosition.top != null) { + offset.top = obj.targetPosition.top; + } //引用元素 高寬 let width = $(this)[0].offsetWidth; + if (obj.targetPosition.offsetWidth != null) { + width = obj.targetPosition.offsetWidth; + } let height = $(this)[0].offsetHeight; - + if (obj.targetPosition.offsetHeight != null) { + height = obj.targetPosition.offsetHeight; + } $(this).data("yttooltipid", ranId); $(clone).attr("id", "yt_tooltip_" + ranId); if (obj.group) { @@ -85,15 +102,17 @@ $.fn.YTTooltip = function (option) { } else if (obj.direction == "right") { left = offset.left + toolWidth + width > bodyWidth ? offset.left - toolWidth - 10 : offset.left + width + 10; } else if (obj.direction == "bottom") { + left = offset.left + toolWidth + width > bodyWidth ? offset.left - toolWidth - 10 : offset.left; top = offset.top + toolHeight + height > bodyHeight ? offset.top + height + 10 : offset.top + height + 10; } else if (obj.direction == "top") { + left = offset.left + toolWidth + width > bodyWidth ? offset.left - toolWidth - 10 : offset.left; top = offset.top < toolHeight ? offset.top + height + 5 : offset.top - toolHeight - 10; } if (obj.direction == "left" || obj.direction == "right") { $(clone).css({ left: left, top: offset.top }); } else if (obj.direction == "top" || obj.direction == "bottom"){ - $(clone).css({ left: offset.left, top: top}); + $(clone).css({ left: left, top: top}); } setTimeout(function () { obj.onShow ? obj.onShow(clone, obj.ele, obj) : "";