若沒有 forge 則不執行相關程序 | 樓層平面圖只有左半邊則自動切換全版呈現

This commit is contained in:
dev01 2023-07-06 15:33:26 +08:00
parent 779a0b7927
commit 0298d6f7c9
8 changed files with 82 additions and 61 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) {
@ -195,7 +194,7 @@
? parseInt(data.value) ? parseInt(data.value)
: 0; : 0;
} }
if ( if (
data.point_name == norDevPoiName && data.point_name == norDevPoiName &&
data.value == matchDevice.device_normal_point_value && data.value == matchDevice.device_normal_point_value &&

View File

@ -17,7 +17,7 @@
<div class="d-flex"> <div class="d-flex">
<div class="col-12 my-3 col-md-6" id="floorLeftBlock"> <div class="col-12 my-3 col-md-6" id="floorLeftBlock">
<div id="floChart" <div id="floChart"
style="height: 100%; width: 100%; background-color: #fff"></div> style="height: 80vh; width: 100%; background-color: #fff"></div>
</div> </div>
<div class="col-12 my-3 col-md-6" id="floorRightBlock"> <div class="col-12 my-3 col-md-6" id="floorRightBlock">
<!-- <div id="forgeViewer" class="position-relative" style="height:100%"> <!-- <div id="forgeViewer" class="position-relative" style="height:100%">
@ -42,8 +42,7 @@
var lightControl = "device"; // device 群控 node 燈控 var lightControl = "device"; // device 群控 node 燈控
var zoomToggle = 1.3; var zoomToggle = 1.3;
$(function () { $(function () {
$(loadEle).Loading("start"); if(!pageAct.urn || pageAct.urn == "undefined"){
if(!pageAct.urn){
$("#floorRightBlock").hide(); $("#floorRightBlock").hide();
$("#floorLeftBlock").removeClass("col-md-6"); $("#floorLeftBlock").removeClass("col-md-6");
} }
@ -515,6 +514,7 @@
//baja 訂閱設備 //baja 訂閱設備
function subDevice() { function subDevice() {
debugger
console.log("subDevice 開始"); console.log("subDevice 開始");
let option = floChart.getOption(); let option = floChart.getOption();
@ -535,6 +535,7 @@
let deviceScatterNormalArr = []; let deviceScatterNormalArr = [];
let deviceScatterCloseArr = []; let deviceScatterCloseArr = [];
let deviceScatterErrorArr = []; let deviceScatterErrorArr = [];
debugger
floMyBaja.setSubscribeDevicesCallBack(function (data) { floMyBaja.setSubscribeDevicesCallBack(function (data) {
let matchDevice = currentData.filter( let matchDevice = currentData.filter(
(x) => x.device_number == data.device_number_full (x) => x.device_number == data.device_number_full
@ -729,6 +730,7 @@
floMyBaja.setSubscribeDeviceEndCallBack(function (data) { floMyBaja.setSubscribeDeviceEndCallBack(function (data) {
endPageLoading(); endPageLoading();
$(loadEle).Loading("close");
if ( if (
pageAct.sysSubTag !== "M12" && pageAct.sysSubTag !== "M12" &&
data.findIndex( data.findIndex(
@ -1517,58 +1519,61 @@
// show 3D 模型 // show 3D 模型
function show3DModel(urn) { function show3DModel(urn) {
launchViewerForHotspot(urn, (viewer, nodeIds) => { if(typeof launchViewerForHotspot != "undefined"){
// 隱藏 toolbar launchViewerForHotspot(urn, (viewer, nodeIds) => {
document.querySelector("#guiviewer3d-toolbar").style.display = "none"; // 隱藏 toolbar
let nextFloor = getNextFloor(pageAct.floGuid); document.querySelector("#guiviewer3d-toolbar").style.display = "none";
let curFloTag = pageAct.floTag; let nextFloor = getNextFloor(pageAct.floGuid);
let curFloTag = pageAct.floTag;
if (!nextFloor) {
toast_warning("超出樓層範圍"); if (!nextFloor) {
return; toast_warning("超出樓層範圍");
} return;
}
if (curFloTag?.startsWith("U")) {
curFloTag = curFloTag.split("U")[1]; if (curFloTag?.startsWith("U")) {
} curFloTag = curFloTag.split("U")[1];
if (nextFloor?.startsWith("U")) { }
nextFloor = nextFloor.split("U")[1]; if (nextFloor?.startsWith("U")) {
} nextFloor = nextFloor.split("U")[1];
}
getLevelsData(curFloTag, nextFloor, function () {
viewer.model.search( getLevelsData(curFloTag, nextFloor, function () {
"天花板", viewer.model.search(
(nodeIds) => { "天花板",
// console.log("2",nodeIds) (nodeIds) => {
viewer.hide(nodeIds); // console.log("2",nodeIds)
}, viewer.hide(nodeIds);
(e) => { },
console.log(e); (e) => {
} console.log(e);
); }
);
});
setHeatMap();
if (
(pageAct.sysSubTag == "M12" || pageAct.sysSubTag == "ELEV") &&
elevatorShow
) {
let elevOption = {
viewer: viewer,
ordPath: {
area_tag: pageAct.AreaTag,
building_tag: pageAct.buiTag,
},
};
// 電梯移動訂閱程序載入
let forge3DElev = new Forge3DElevFull(elevOption);
forge3DElev.bajaEndCallback = function () {
endPageLoading();
};
forge3DElev.init();
}
}); });
}
setHeatMap();
if (
(pageAct.sysSubTag == "M12" || pageAct.sysSubTag == "ELEV") &&
elevatorShow
) {
let elevOption = {
viewer: viewer,
ordPath: {
area_tag: pageAct.AreaTag,
building_tag: pageAct.buiTag,
},
};
// 電梯移動訂閱程序載入
let forge3DElev = new Forge3DElevFull(elevOption);
forge3DElev.bajaEndCallback = function () {
endPageLoading();
};
forge3DElev.init();
}
});
} }
function setHeatMap() { function setHeatMap() {

View File

@ -1276,6 +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");
@ -1328,7 +1329,6 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
pageAct.buiTag = $(this).prop("id").split("buildTab")[1]; pageAct.buiTag = $(this).prop("id").split("buildTab")[1];
pageAct.buiName = $(this).text(); pageAct.buiName = $(this).text();
pageAct.urn = $(this).data("urn"); pageAct.urn = $(this).data("urn");
console.log("building");
$(this).parents("ul").find("a").removeClass("active"); $(this).parents("ul").find("a").removeClass("active");
$(this).parent("a").addClass("active"); $(this).parent("a").addClass("active");
console.log(e, arg); console.log(e, arg);

View File

@ -797,6 +797,9 @@ function hexToRgb(hex) {
// 熱點 更換顏色 // 熱點 更換顏色
async function changeColorForHotspot(dbId, type = null, OnOff = false) { async function changeColorForHotspot(dbId, type = null, OnOff = false) {
if(typeof viewer === "undefined"){
return;
}
const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization"); const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization");
let spriteColorFocus = new THREE.Color(0xffffff); let spriteColorFocus = new THREE.Color(0xffffff);

View File

@ -3,14 +3,14 @@
// var baseImgUrl = "https://localhost:44376"; // 本地開發用 // var baseImgUrl = "https://localhost:44376"; // 本地開發用
// Mitsubishi // Mitsubishi
// var baseApiUrl = "http://220.132.206.5:8005"; // production 用 var baseApiUrl = "http://220.132.206.5:8005"; // production 用
var baseImgUrl = "http://220.132.206.5:8053"; // production 用 var baseImgUrl = "http://220.132.206.5:8053"; // production 用
// WSP // WSP
// var baseApiUrl = "http://192.168.0.136:8005"; // production 用 // var baseApiUrl = "http://192.168.0.136:8005"; // production 用
// var baseImgUrl = "http://192.168.0.136:8053"; // production 用 // var baseImgUrl = "http://192.168.0.136:8053"; // production 用
var baseApiUrl = "http://localhost:3604"; // var baseApiUrl = "http://localhost:3604";
//var baseImgUrl = "http://localhost:8848"; //var baseImgUrl = "http://localhost:8848";
var varRegApiUrl = "/reg/api/"; //註冊API路徑 var varRegApiUrl = "/reg/api/"; //註冊API路徑

View File

@ -250,6 +250,7 @@ function getOneDeviceAlarmTop10ByBaja(devicePath, callback) {
_index++; _index++;
}, },
after: function () { after: function () {
$(loadEle).Loading("close");
_result = JSON.stringify({ count: _index, data: _ss }); _result = JSON.stringify({ count: _index, data: _ss });
if (typeof callback === "function") { if (typeof callback === "function") {
callback(_result); callback(_result);
@ -258,6 +259,10 @@ function getOneDeviceAlarmTop10ByBaja(devicePath, callback) {
limit: -1, limit: -1,
offset: 0, offset: 0,
}); });
})
.catch(() => {
$(loadEle).Loading("close");
}); });
}); });
} }

View File

@ -440,6 +440,16 @@ function subscriptionAlarms() {
function subscriptionElectricmeter() { function subscriptionElectricmeter() {
// 用BQL的方式去訂閱 // 用BQL的方式去訂閱
this.setSubscribeElectricmeterByBql = function (tempOrdPath) { this.setSubscribeElectricmeterByBql = function (tempOrdPath) {
if(tempOrdPath.devicePath?.includes("/")){
let newDevPath = [];
for(var tag of tempOrdPath.devicePath?.split("/")){
if(!isNaN(parseInt(tag.slice(0,1)))){
tag = "$3" + tag;
}
newDevPath.push(tag);
}
tempOrdPath.devicePath = newDevPath.join("/");
}
BajaSubscribeElectricmeterByBql(tempOrdPath); BajaSubscribeElectricmeterByBql(tempOrdPath);
}; };
// BQL去訂閱回傳的Function // BQL去訂閱回傳的Function

View File

@ -38,12 +38,10 @@ function getHistoryDataByBaja(devicePath, startDate_millisecond, endDate_millise
var _result = {}; var _result = {};
var _ss = []; var _ss = [];
var _index = 0; var _index = 0;
require(['baja!'], function (baja) { require(['baja!'], function (baja) {
console.log('local:|foxs:|history:/' + company + '/' + devicePath + '|bql:select * from control:ControlPoint where timestamp.millis > ' + startDate_millisecond + ' and timestamp.millis < ' + endDate_millisecond); console.log('local:|foxs:|history:/' + company + '/' + devicePath + '|bql:select * from control:ControlPoint where timestamp.millis > ' + startDate_millisecond + ' and timestamp.millis < ' + endDate_millisecond);
baja.Ord.make('local:|foxs:|history:/' + company + '/' + devicePath + '|bql:select * from control:ControlPoint where timestamp.millis > ' + startDate_millisecond + ' and timestamp.millis < ' + endDate_millisecond).get() baja.Ord.make('local:|foxs:|history:/' + company + '/' + devicePath + '|bql:select * from control:ControlPoint where timestamp.millis > ' + startDate_millisecond + ' and timestamp.millis < ' + endDate_millisecond).get()
.then(function (table) { .then(function (table) {
$(loadEle).Loading("start");
return table.cursor({ return table.cursor({
each: function (record) { each: function (record) {
console.log(record.get('timestamp')) console.log(record.get('timestamp'))
@ -75,6 +73,7 @@ function getHistoryDataByBaja(devicePath, startDate_millisecond, endDate_millise
}) })
.catch(()=>{ .catch(()=>{
console.log("error"); console.log("error");
$(loadEle).Loading("close");
// const res = JSON.stringify({count:0, data:[]}) // const res = JSON.stringify({count:0, data:[]})
callback() callback()
}); });