[Frontend] forge 熱點共用化調整 |
This commit is contained in:
parent
3e149a2cd9
commit
64e9b8e3f0
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
var allDevList = []; //全設備清單
|
var allDevList = []; //全設備清單
|
||||||
let devicePointList = [];
|
var devicePointList = [];
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
getBuildMenu((arr, data) => {
|
getBuildMenu((arr, data) => {
|
||||||
@ -47,7 +47,6 @@
|
|||||||
if (arr.indexOf(5) != -1) {
|
if (arr.indexOf(5) != -1) {
|
||||||
setHotspotPoint();
|
setHotspotPoint();
|
||||||
show3DModel(data.urn_3D);
|
show3DModel(data.urn_3D);
|
||||||
console.log("start ---------");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -246,28 +245,37 @@
|
|||||||
}, null, "POST").send();
|
}, null, "POST").send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Card 即時狀態
|
||||||
|
function drawStateTabBlo() {
|
||||||
|
let strHtml = `<div style="height:15rem">
|
||||||
|
<iframe src="/ord?station:%7Cslot:/TPE/B1/EE/E4/R2F/NA/WHT/N1|view:?fullScreen=true" width="100%" height="100%"></iframe>
|
||||||
|
</div>`
|
||||||
|
return strHtml;
|
||||||
|
}
|
||||||
|
|
||||||
function show3DModel(urn) {
|
function show3DModel(urn) {
|
||||||
launchViewerForHotspot(urn, (viewer, nodeIds) => {
|
launchViewerForHotspot(urn, (viewer, nodeIds) => {
|
||||||
|
getHotspotPoint();
|
||||||
});
|
},"[name=forgeViewer]");
|
||||||
}
|
}
|
||||||
|
|
||||||
function getHotspotPoint() {
|
function getHotspotPoint() {
|
||||||
let url = baseApiUrl + "/api/GetDevForCor";
|
let url = baseApiUrl + "/api/GetDevForCor";
|
||||||
let sendData = {
|
let sendData = [{
|
||||||
"area_tag": pageAct.AreaTag,
|
"device_area_tag": pageAct.AreaTag,
|
||||||
"building_tag": pageAct.buiTag,
|
"device_building_tag": pageAct.buiTag,
|
||||||
"system_tag": pageAct.sysMainTag,
|
"device_system_tag": pageAct.sysMainTag,
|
||||||
"name_tag": pageAct.sysSubTag,
|
"device_name_tag": pageAct.sysSubTag,
|
||||||
};
|
}];
|
||||||
objSendData.Data = sendData;
|
objSendData.Data = sendData;
|
||||||
$.post(url, sendData, function (rel) {
|
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
|
||||||
if (rel.code == "9999") {
|
if (!res || res.code != "0000" || !res.data) {
|
||||||
toast_error(rel.msg);
|
|
||||||
return;
|
} else {
|
||||||
|
devicePointList.push(res.data.device_coordinate_3d);
|
||||||
}
|
}
|
||||||
devicePointList.push(rel.data.device_coordinate_3d);
|
}, null, "POST").send();
|
||||||
}, 'json');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setHotspotPoint() {
|
function setHotspotPoint() {
|
||||||
|
@ -2248,7 +2248,6 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
|||||||
})
|
})
|
||||||
|
|
||||||
onEvent("yt:tab:change", "#lightSch-tab", function () {
|
onEvent("yt:tab:change", "#lightSch-tab", function () {
|
||||||
debugger
|
|
||||||
if (pageAct.sysMainTag == "LT" && $("#lightSchModal").length != 0) {
|
if (pageAct.sysMainTag == "LT" && $("#lightSchModal").length != 0) {
|
||||||
loadLightSchTable();
|
loadLightSchTable();
|
||||||
$("#lightSchModal").modal("show");
|
$("#lightSchModal").modal("show");
|
||||||
|
@ -6,7 +6,8 @@ var elevatorSpeed;
|
|||||||
var selector = "#forgeViewer";
|
var selector = "#forgeViewer";
|
||||||
let myDataList;
|
let myDataList;
|
||||||
|
|
||||||
function launchViewer(urn, callback, selector = "#forgeViewer") {
|
function launchViewer(urn, callback, _selector = "#forgeViewer") {
|
||||||
|
selector = _selector;
|
||||||
var options = {
|
var options = {
|
||||||
env: 'AutodeskProduction',
|
env: 'AutodeskProduction',
|
||||||
getAccessToken: getForgeToken
|
getAccessToken: getForgeToken
|
||||||
@ -52,7 +53,8 @@ function launchViewer(urn, callback, selector = "#forgeViewer") {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function launchViewerForHotspot(urn, callback, selector = "#forgeViewer") {
|
function launchViewerForHotspot(urn, callback, _selector = "#forgeViewer") {
|
||||||
|
selector = _selector;
|
||||||
var av = Autodesk.Viewing;
|
var av = Autodesk.Viewing;
|
||||||
var options = {
|
var options = {
|
||||||
env: 'AutodeskProduction',
|
env: 'AutodeskProduction',
|
||||||
@ -305,13 +307,14 @@ function onDocumentLoadSuccess(doc, eleOption) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNodeIdByDbIds(allDbIdsStr,callback) {
|
function getNodeIdByDbIds(allDbIdsStr, callback = null) {
|
||||||
let curDbId = 0;
|
let curDbId = 0;
|
||||||
let tagId = 0;
|
let tagId = 0;
|
||||||
let _parentId = 0;
|
let _parentId = 0;
|
||||||
let _childId = 0;
|
let _childId = 0;
|
||||||
let evelMap = new Map();
|
let evelMap = new Map();
|
||||||
let finTimeout = null;
|
let finTimeout = null;
|
||||||
|
let isCalled = false;
|
||||||
|
|
||||||
allDbIdsStr.forEach((dbId) => {
|
allDbIdsStr.forEach((dbId) => {
|
||||||
curDbId = parseInt(dbId);
|
curDbId = parseInt(dbId);
|
||||||
@ -338,7 +341,10 @@ function getNodeIdByDbIds(allDbIdsStr,callback) {
|
|||||||
console.log("map: " + evelMap);
|
console.log("map: " + evelMap);
|
||||||
clearTimeout(finTimeout)
|
clearTimeout(finTimeout)
|
||||||
finTimeout = setTimeout(() => {
|
finTimeout = setTimeout(() => {
|
||||||
|
if (isCalled == false) {
|
||||||
|
isCalled = true;
|
||||||
callback ? callback(evelMap) : "";
|
callback ? callback(evelMap) : "";
|
||||||
|
}
|
||||||
}, 10)
|
}, 10)
|
||||||
|
|
||||||
})
|
})
|
||||||
@ -346,6 +352,14 @@ function getNodeIdByDbIds(allDbIdsStr,callback) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
clearTimeout(finTimeout)
|
||||||
|
finTimeout = setTimeout(() => {
|
||||||
|
if (isCalled == false) {
|
||||||
|
isCalled = true;
|
||||||
|
callback ? callback([]) : "";
|
||||||
|
}
|
||||||
|
}, 10)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
@ -441,9 +455,25 @@ function onDocumentLoadFailure(viewerErrorCode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getForgeToken(callback) {
|
function getForgeToken(callback) {
|
||||||
fetch(baseApiUrl + '/api/forge/oauth/token').then(res => {
|
fetch(forgeTokenBase.url).then(res => {
|
||||||
res.json().then(data => {
|
res.json().then(data => {
|
||||||
callback(data.dictionary.access_token, data.dictionary.expires_in);
|
let limitResType = ["object", "undefined"];
|
||||||
|
let access_token = data;
|
||||||
|
$.each(forgeTokenBase.res_access_token, (idx, dict) => {
|
||||||
|
access_token = access_token[dict];
|
||||||
|
})
|
||||||
|
|
||||||
|
let expires_in = data;
|
||||||
|
$.each(forgeTokenBase.res_expires_in, (idx, dict) => {
|
||||||
|
expires_in = expires_in[dict];
|
||||||
|
})
|
||||||
|
|
||||||
|
if (limitResType.includes(typeof access_token) || limitResType.includes(typeof expires_in)) {
|
||||||
|
access_token = "", expires_in = "";
|
||||||
|
throw "access_token or expires_in on the ForgeTokenBase object for getting forge token by URL is not the correct path.";
|
||||||
|
}
|
||||||
|
|
||||||
|
callback(access_token, expires_in);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
//callback("eyJhbGciOiJSUzI1NiIsImtpZCI6IlU3c0dGRldUTzlBekNhSzBqZURRM2dQZXBURVdWN2VhIn0.eyJzY29wZSI6WyJkYXRhOndyaXRlIiwiZGF0YTpyZWFkIiwiYnVja2V0OnJlYWQiLCJidWNrZXQ6dXBkYXRlIiwiYnVja2V0OmNyZWF0ZSJdLCJjbGllbnRfaWQiOiJUQTNocXNGZnpRYk5PVVhLcGxkS1VLU2V3NFNKMj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rlkOSqLeIrAdnKdBDNBWKgrGJt_xcmXc3dZ3XNKf9L_F6Ex808rUlo6cem1mcPpKl1jCBDqKu1mAX7aDtZ65TTQZbGGhbG4HdnET-d1i5w4LunGN11UAHhDUW3n0SWWIBL27PiiUQONZttajhD5st6IngYLcjr93BYVyJmDF7-wm4WZlHSw2OnXIfbJcFXEd83uVv_Rej4UXjzZ0e6kHwzc2nvGvKSIFu3Nt7CabdR8CkA", 3599);
|
||||||
|
@ -17,6 +17,13 @@ var common = {
|
|||||||
SysErr: "系統內部發生錯誤,請聯繫系統管理員"
|
SysErr: "系統內部發生錯誤,請聯繫系統管理員"
|
||||||
}
|
}
|
||||||
var objSendData = { Data: null };
|
var objSendData = { Data: null };
|
||||||
|
var initAreaTag = "TPE";
|
||||||
|
var n4Sup = "Mitsubishi_Sup";
|
||||||
|
var forgeTokenBase = {
|
||||||
|
url: baseApiUrl + '/api/forge/oauth/token',
|
||||||
|
res_access_token: ["dictionary", "access_token"],
|
||||||
|
res_expires_in: ["dictionary", "expires_in"]
|
||||||
|
};
|
||||||
|
|
||||||
//重新轉址 for Niagara4
|
//重新轉址 for Niagara4
|
||||||
var temp_cuurent_Url_pathname = window.location.pathname.split("/").slice(0, 3);
|
var temp_cuurent_Url_pathname = window.location.pathname.split("/").slice(0, 3);
|
||||||
|
Loading…
Reference in New Issue
Block a user