[前台][系統監控] 點擊 device 卡片 data-number 適應 building_tag 開頭為數字轉換

This commit is contained in:
dev01 2023-07-10 18:23:18 +08:00
parent 7e07ac738b
commit 93c03ae844
3 changed files with 25 additions and 7 deletions

View File

@ -54,7 +54,6 @@
$(function () { $(function () {
$(loadEle).Loading("start"); $(loadEle).Loading("start");
debugger
getBuildMenu((arr, data) => { getBuildMenu((arr, data) => {
buildMenuData = data; buildMenuData = data;
if (arr.indexOf(4) != -1) { if (arr.indexOf(4) != -1) {
@ -576,7 +575,7 @@
devObj.device_image devObj.device_image
}" class="profile-image rounded-circle" onerror="defDev(this)" alt="..."> }" class="profile-image rounded-circle" onerror="defDev(this)" alt="...">
</span> </span>
<a name="devItemName" data-number="${devObj.device_number <a name="devItemName" data-number="${deviceNumber(devObj.device_number)
}" href="javascript:;">${devObj.full_name }" href="javascript:;">${devObj.full_name
}</a> }</a>
</div> </div>

View File

@ -1276,7 +1276,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
setSysTagForPageAct(this); setSysTagForPageAct(this);
$("#sysMonTopBtn").YTTab("set"); $("#sysMonTopBtn").YTTab("set");
$(`#subSysBtn${pageAct.sysSubTag}`).YTTab("set"); $(`#subSysBtn${pageAct.sysSubTag}`).YTTab("set");
debugger
if (pageAct.isShowBuildingInMenu) { if (pageAct.isShowBuildingInMenu) {
let building_tag = $(this).data("building-tag"); let building_tag = $(this).data("building-tag");
$(`#buildTab${building_tag}`).YTTab("set"); $(`#buildTab${building_tag}`).YTTab("set");
@ -1570,7 +1570,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
: ""; : "";
let option = { let option = {
html: `<div class="card m-1 border device-wrap" data-number="${devNum}" data-position="left"> html: `<div class="card m-1 border device-wrap" data-number="${deviceNumber(devNum)}" data-position="left">
<div class="card-header p-3"> <div class="card-header p-3">
<div class="position-absolute mr-5" style="word-break: break-all;"> <div class="position-absolute mr-5" style="word-break: break-all;">
@ -1701,10 +1701,12 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
function devItemNameEvent() { function devItemNameEvent() {
onEvent("click", "[name=devItemName]", function () { onEvent("click", "[name=devItemName]", function () {
let devNum = $(this).data("number"); let devNum = $(this).data("number");
let devObj = $(`[name=devItem][data-number=${devNum}]`).data( let devObj = $(`[name=devItem][data-number=${deviceNumber(devNum)}]`).data(
"devobj" "devobj"
); );
moveViewToDevice(devObj.forge_dbid); if(devObj){
moveViewToDevice(devObj.forge_dbid);
}
}); });
} }

View File

@ -13,7 +13,9 @@ function getAllLeafComponents(viewer, callback) {
var cbCount = 0; var cbCount = 0;
var tree; var tree;
var jsData = []; var jsData = [];
if(typeof viewer == 'undefined'){
return;
}
function getLeafComponentsRec(current, parent) { function getLeafComponentsRec(current, parent) {
cbCount++; cbCount++;
if (tree.getChildCount(current) != 0) { if (tree.getChildCount(current) != 0) {
@ -833,6 +835,9 @@ async function changeColorForHotspot(dbId, type = null, OnOff = false) {
// 更換 icon // 更換 icon
async function changeScaleForHotspot(dbId, type = true) { async function changeScaleForHotspot(dbId, type = true) {
if(typeof viewer == 'undefined'){
return;
}
const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization"); const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization");
let spriteErrIcon = baseForgeApiUrl + "/file/img/forge/sensor_circle.svg"; let spriteErrIcon = baseForgeApiUrl + "/file/img/forge/sensor_circle.svg";
if (location.href.indexOf("localhost:5966") != -1) { if (location.href.indexOf("localhost:5966") != -1) {
@ -848,6 +853,9 @@ async function changeScaleForHotspot(dbId, type = true) {
// 熱點 更換大小 // 熱點 更換大小
async function changeScaleForHotspot(dbId, type = true) { async function changeScaleForHotspot(dbId, type = true) {
if(typeof viewer == 'undefined'){
return;
}
const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization"); const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization");
let scale = 1; let scale = 1;
if (type) { if (type) {
@ -1266,17 +1274,26 @@ function getHopspotPoint(data) {
//呼叫載入熱圖 //呼叫載入熱圖
async function toLoadHeatmap(roomArr) { async function toLoadHeatmap(roomArr) {
if(typeof viewer == 'undefined'){
return;
}
const model = viewer.model; const model = viewer.model;
loadHeatmaps(model, roomArr); loadHeatmaps(model, roomArr);
} }
function setShadowShow(type = false) { function setShadowShow(type = false) {
if(typeof viewer == 'undefined'){
return;
}
viewer.setGroundShadow(type); viewer.setGroundShadow(type);
viewer.impl.sceneUpdated(true); viewer.impl.sceneUpdated(true);
} }
//============================= end =================================== //============================= end ===================================
function moveViewToDevice(letter) { function moveViewToDevice(letter) {
if(typeof viewer == 'undefined'){
return;
}
if (letter != "") { if (letter != "") {
viewer.clearSelection(); viewer.clearSelection();
viewer.select(letter); viewer.select(letter);