This commit is contained in:
dev02 2023-01-05 18:43:29 +08:00
commit 3b19c70a75
16 changed files with 605 additions and 671 deletions

View File

@ -16,7 +16,7 @@
<div class="d-flex" id="graTree"></div>
</div>
<div class="col-10">
<div class="row my-2">
<div class="row my-2 mx-0">
<a href="javascript:;" id="creGraMan" class="btn btn-success">
+新增
</a>
@ -65,7 +65,7 @@
</div>
</div>
<div class="col-md-12 mt-2">
<label>原設計</label>
<label>檔案</label>
</div>
<div class="col-md-12">
@ -278,8 +278,8 @@
let dowLoaEle = YT.Alert.Tip("準備下載中...", "show", true);
let rowData = graTable.row($(this).closest("tr")).data();
let apiUrl = baseApiUrl + `/File/Download?type=graph&savename=${rowData.oriSavName}&oriname=${rowData.oriOrgName}`;
let extname = rowData.oriOrgName?.split(".").slice(-1) || "dwg";
download(token, apiUrl, rowData.name + "_原設計圖" + "." + extname, function () {
download(token, apiUrl, rowData.oriOrgName, function () {
$(dowLoaEle.ele).YTAlert().hide();
});
})
@ -390,8 +390,8 @@
Create: {
label: "新增",
_disabled: function (data) {
if (depth >= 3) {
return true; //第層後無法新增
if (depth >= 4) {
return true; //第層後無法新增
}
return false;
},
@ -405,6 +405,12 @@
},
Rename: {
label: "重新命名",
_disabled: function (data) {
if ($node.id == "0") {
return true; //最上層無法編輯
}
return false;
},
action: function (obj) {
tree.edit($node);
/* tree.sort($node, true)*/
@ -412,6 +418,12 @@
},
Remove: {
label: "移除",
_disabled: function (data) {
if ($node.id == "0") {
return true; //最上層無法移除
}
return false;
},
action: function (obj) {
tree.delete_node($node);
}
@ -426,18 +438,27 @@
}
function treeEvent() {
let selectedNode = [];
$('#graTree').on("loaded.jstree", function (e, data) {
let topNode = $('#graTree').jstree(true).get_node("#");
let topNode = $('#graTree').jstree(true).get_node("0");
$('#graTree').jstree(true).select_node(topNode.children[0]);
$("#graTree").jstree("open_node", 0);
})
$('#graTree').on("select_node.jstree", function (e, data) {
dtAjaxResetSendData(graTable, { layer_id: parseInt(data.node.id) });
graTable.ajax.reload();
curLayerId = parseInt(data.node.id);
$("#graLayer").text(levelNameByNodeId(data.node));
$("#curLevText").text(levelNameByNodeId(data.node));
if (data.node.id != "0") {
dtAjaxResetSendData(graTable, { layer_id: parseInt(data.node.id) });
graTable.ajax.reload();
selectedNode.unshift(data.node.id);
if (selectedNode.length > 3) {
selectedNode.splice(selectedNode.length - 1, 1);
}
curLayerId = parseInt(data.node.id);
$("#graLayer").text(levelNameByNodeId(data.node));
$("#curLevText").text(levelNameByNodeId(data.node));
} else {
$("#graTree").jstree(true).deselect_node(data.node);
$("#graTree").jstree(true).select_node(selectedNode[0]);
}
})
$("#graTree").on('create_node.jstree', function (e, data) {
let main = {};
@ -537,14 +558,14 @@
let names = [];
let curNode = $('#graTree').jstree(true).get_node(node);
let parents = curNode.parents.reverse();
for (let i = parents.length - 1; i >= 0; i--) {
if (parents[i] != "#") {
if (parents[i] != "#") {
let node = $('#graTree').jstree(true).get_node(parents[i]);
names.push(node.text);
}
}
names.push(curNode.text);
return names.join("/");

View File

@ -2371,8 +2371,9 @@
//載入3D模型
function load3DModel() {
launchViewer(pageAct.urn, (viewer) => {
let elevOption = {
selector: "#forgeViewer",
viewer: viewer,
@ -2382,12 +2383,17 @@
// 電梯移動訂閱程序載入
let forge3DElev = new Forge3DElevFull(elevOption);
forge3DElev.bajaEndCallback = function () {
debugger
/*hideAllObjects(this.getNodeIds());*/
setTransparentBuilding(0);
endPageLoading();
}
forge3DElev.bajaChaCallback = function (data) {
subDeviceSetStatus(data);
}
forge3DElev.init();
});
}

View File

@ -36,6 +36,7 @@
<script>
var allDevList = []; //全設備清單
var subDeviceData = [];
var heatMap = null;
$(function () {
@ -45,12 +46,9 @@
setLightColor();
}
if (arr.indexOf(3) != -1) {
getHotspotPoint(() => {
getLightDevice();
show3DModel(data.urn_3D);
});
}
});
})
@ -66,18 +64,7 @@
break;
case 4:
strHtml = `<div class="d-flex mb-4" style="gap:15px">
<div class="row m-0 align-items-center">
<span id="sysNorLight" class="circle-light mr-2 " data-light-type="normal"></span>
<label class="mb-0">正常</label>
</div>
<div class="row m-0 align-items-center">
<span id="sysCloLight" class="circle-light mr-2" data-light-type="close"></span>
<label class="mb-0">關機</label>
</div>
<div class="row m-0 align-items-center">
<span id="sysErrLight" class="circle-light mr-2" data-light-type="error"></span>
<label class="mb-0">異常</label>
</div>
${setTopLight()}
</div>
<div class="col-12 p-0" id="floDevList">
@ -107,13 +94,26 @@
if (!matchDevice) {
return false;
}
console.log(data)
//將訂閱值塞入 subDeviceData
if (subDeviceData.findIndex(x => x.device_number == matchDevice.device_number) == -1) {
let obj = {};
obj.device_number = matchDevice.device_number;
obj.dbid = matchDevice.forge_dbid;
subDeviceData.push(obj)
}
let subData = subDeviceData.filter(x => x.device_number == matchDevice.device_number)[0];
if (subData) {
subData[data.point_name] = data.value;
}
let norDevPoiName = matchDevice.device_normal_point_name;
let cloDevPoiName = matchDevice.device_close_point_name;
let errDevPoiName = matchDevice.device_error_point_name;
if (data.point_name == "Temp") {
console.log(data)
heatMap?.changeTemp(data.device_number_full, !isNaN(parseInt(data.value)) ? parseInt(data.value) : 0);
let devIdx = allDevList.findIndex(x => x.device_number == data.device_number_full);
allDevList[devIdx]._temp = !isNaN(parseInt(data.value)) ? parseInt(data.value) : 0;
@ -127,15 +127,18 @@
} else if (data.point_name == errDevPoiName && data.value == matchDevice.device_error_point_value) {
$(`#${matchDevice.device_number}_status`).attr("data-light-type", "error").data("light-type", "error");
}
setLightColor();
setForgeHotSpotColor(matchDevice);
});
myBaja.setSubscribeDeviceEndCallBack(function (data) {
endPageLoading();
});
}
function setLightColor() {
$("[data-light-type]").each((index, ele) => {
let type = $(ele).data("light-type");
@ -163,7 +166,41 @@
})
}
//取得設備列表 並繪製卡片
// 設置昇位圖上方 燈號
function setTopLight() {
let sysSubObj = pageAct.sysSubObj;
let strHtml = ``;
if (sysSubObj.device_normal_point_name != null && sysSubObj.device_normal_point_value != null) {
strHtml += ` <div class="row m-0 align-items-center">
<span id="sysNorLight" class="circle-light mr-2 " data-light-type="normal"></span>
<label class="mb-0">${sysSubObj.device_normal_text}</label>
</div>`;
}
if (sysSubObj.device_close_point_name != null && sysSubObj.device_close_point_value != null) {
strHtml += ` <div class="row m-0 align-items-center">
<span id="sysCloLight" class="circle-light mr-2" data-light-type="close"></span>
<label class="mb-0">${sysSubObj.device_close_text}</label>
</div>`;
}
if (sysSubObj.device_error_point_name != null && sysSubObj.device_error_point_value != null) {
strHtml += ` <div class="row m-0 align-items-center">
<span id="sysErrLight" class="circle-light mr-2" data-light-type="error"></span>
<label class="mb-0">${sysSubObj.device_error_text}</label>
</div>`;
}
return strHtml;
}
// forge 3D 異常點位變紅色
function setForgeHotSpotColor(device) {
let subData = subDeviceData.filter(x => x.device_number == device.device_number)[0]
if (subData && subData[device.device_error_point_name] == device.device_error_point_value && !isNaN(parseInt(device.spriteDbid))) {
changeColorForHotspot(parseInt(device.spriteDbid), "error");
}
}
// 取得設備列表 並繪製卡片
function getFloDevList() {
let url = baseApiUrl + "/api/Device/GetDeviceList";
let sendData = {
@ -216,7 +253,7 @@
}
}, null, "POST").send();
}
function getBuildMenu(callback = null) {
let url = baseApiUrl + "/api/Device/GetBuildMenu";
let sendData = {
@ -256,15 +293,24 @@
}
// 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>
function drawStateTabBlo(devNum) {
let devPath = devNum.replaceAll("_", "/");
let strHtml = `<div style="height:100%">
<iframe src="/ord?station:%7Cslot:/${devPath}|view:?fullScreen=true" style="width:100%;height:100%;min-height:30vh"></iframe>
</div>`
return strHtml;
}
function iframeResize(obj) {
obj.style.height = obj.contentWindow.document.documentElement.scrollHeight + 'px';
}
function show3DModel(urn) {
$(loadEle).Loading("start");
launchViewerForHotspot(urn, (viewer, nodeIds) => {
let devDbIds = allDevList.map(x => x.forge_dbid);
/*hideAllObjects(devDbIds);*/
setTransparentBuilding(0, devDbIds);
$(loadEle).Loading("close");
let devices = allDevList.map(x => {
return {
roomDbId: !isNaN(parseInt(x.room_dbid)) ? parseInt(x.room_dbid) : -1,
@ -286,7 +332,7 @@
}
let elevOption = {
selector:"[name=forgeViewer]",
selector: "[name=forgeViewer]",
viewer: viewer,
ordPath: {
"area_tag": pageAct.AreaTag,
@ -300,9 +346,42 @@
endPageLoading();
}
forge3DElev.init();
if (subDeviceData.length != 0) {
let stSubArr = subDeviceData.map(x => Object.keys(x).filter(y => y == "ST").map(y => x));
for (let sub of stSubArr) {
let matchDevice = allDevList.filter(x => x.device_number == sub[0]?.device_number)[0];
if (matchDevice) {
setForgeHotSpotColor(matchDevice);
}
}
}
getWaterNodeId();
}, () => {
$(loadEle).Loading("close");
}, "[name=forgeViewer]");
}
// 供水系統 - 取得欲染色 dbid
function getWaterNodeId() {
let url = baseApiUrl + "/api/Device/GetForgeNodeIdFromVar";
let sendData = { forgeNodeKey: "water_wupply" };
objSendData.Data = sendData;
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
if (!res || res.code != "0000" || !res.data) {
} else {
if (!isNaN(parseInt(res.data[0]?.system_value))) {
changeColor(parseInt(res.data[0]?.system_value))
}
console.log(res.data)
}
}, null, "POST").send();
}
function getHotspotPoint(callback = null) {
let url = baseApiUrl + "/api/GetDevForCor";
@ -337,50 +416,11 @@
}
async function getLightDevice() {//callback = null
getLightData(null);
let url = baseApiUrl + "/api/GetDevNodeForCor";
let sendData = {
"device_area_tag": pageAct.AreaTag,
"device_building_tag": pageAct.buiTag,
"device_system_tag": pageAct.sysMainTag,
"device_name_tag": pageAct.sysSubTag,
};
objSendData.Data = sendData;
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
if (!res || res.code != "0000" || !res.data) {
} else {
let myLightList = [];
$.each(res.data, (idx, data) => {
let item = {};
item.position = {};
if (data.device_node_coordinate_3d != null && isJSON(data.device_node_coordinate_3d)) {
item.position = JSON.parse(data.device_node_coordinate_3d);
}
$.extend(item, data);
myLightList.push(item);
})
console.log("2", myLightList);
setLightList(myLightList);
//callback ? callback() : "";
}
}, null, "POST").send();
}
function setHotspotPoint(myDataList = []) {
console.log(myDataList)
getHopspotPoint(myDataList);
}
async function setLightList(myDataList = []) {
console.log(myDataList);
getLightData(myDataList);
}
var parentEle = "";
onEvent("autodesk:click:sprite", "[name=forgeViewer]", function (e, obj) {
forgeUnFocusAll();
@ -398,10 +438,18 @@
})
onEvent("autodesk:complete:sprite", "[name=forgeViewer]", function (e, obj) {
$("#floDevList a[name=devItem]").each((idx, ele) => {
let devNum = $(ele).data("number");
let dbid = obj.myDataList.filter(x => x.device_number == devNum)[0]?._dbId;
allDevList.forEach((dev, idx) => {
if (dev.device_number == devNum) {
dev.spriteDbid = dbid;
setForgeHotSpotColor(dev);
}
})
$(ele).data("dbId", dbid);
})
})

View File

@ -1034,10 +1034,11 @@
// show 3D 模型
function show3DModel(urn) {
$(loadEle).Loading("start");
launchViewerForHotspot(urn, (viewer, nodeIds) => {
let nextFloor = getNextFloor(pageAct.floGuid);
let curFloTag = pageAct.floTag;
debugger
if (!nextFloor) {
toast_warning("超出樓層範圍");
return;
@ -1050,7 +1051,9 @@
nextFloor = nextFloor.split("U")[1];
}
getLevelsData(curFloTag, nextFloor);
getLevelsData(curFloTag, nextFloor, function () {
$(loadEle).Loading("close");
});
setHeatMap();
let elevOption = {
@ -1066,6 +1069,8 @@
endPageLoading();
}
forge3DElev.init();
});
}

View File

@ -1,216 +1,71 @@

:root {
--yt-main-gray: #c2c7d0;
--yt-main-black: #212529;
--yt-main-gray-hover: #c2c7d0;
--yt-gray: #505050;
--yt-gray-hover: #3c3c3c;
--yt-gray-2: #8f8c8c;
--yt-gray-2-hover: #646060;
--yt-gray-3: #ededed;
--yt-gray-4: #dddddd;
--yt-pink: #ff95d0;
--yt-pink-hover: #ef84c0;
--yt-red-2: #d34949;
--yt-yellow-1: #ffc902;
}
:root { --yt-main-gray: #c2c7d0; --yt-main-black: #212529; --yt-main-gray-hover: #c2c7d0; --yt-gray: #505050; --yt-gray-hover: #3c3c3c; --yt-gray-2: #8f8c8c; --yt-gray-2-hover: #646060; --yt-gray-3: #ededed; --yt-gray-4: #dddddd; --yt-pink: #ff95d0; --yt-pink-hover: #ef84c0; --yt-red-2: #d34949; --yt-yellow-1: #ffc902; }
.mod-skin-dark:not(.mod-skin-light) .panel-hdr, .mod-skin-dark:not(.mod-skin-light) .card-header {
background: rgba(0, 0, 0, 0.03);
}
.mod-skin-dark:not(.mod-skin-light) .panel-hdr, .mod-skin-dark:not(.mod-skin-light) .card-header { background: rgba(0, 0, 0, 0.03); }
.btn-sm-2 {
padding: 2px 19px;
}
.btn-sm-2 { padding: 2px 19px; }
.table td {
word-break: break-all;
}
.table td { word-break: break-all; }
label[id$='-error'].error {
color: var(--yt-red-2);
}
label[id$='-error'].error { color: var(--yt-red-2); }
[id^=yt_tooltip] {
min-width: 650px !important;
}
[id^=yt_tooltip] { min-width: 650px !important; }
.circle-light {
display: inline-block;
width: 25px;
height: 25px;
border-radius: 50px;
}
.circle-light { display: inline-block; width: 25px; height: 25px; border-radius: 50px; }
.light-flash {
--flash-color-1: #ffa100;
--flash-color-2: #26272b;
animation: flashing-bg 0.5s linear infinite;
}
.light-flash { --flash-color-1: #ffa100; --flash-color-2: #26272b; animation: flashing-bg 0.5s linear infinite; }
.light-flash-c {
--flash-color-1: #ffa100;
--flash-color-2: #26272b;
animation: flashing-c 0.5s linear infinite;
}
.light-flash-c { --flash-color-1: #ffa100; --flash-color-2: #26272b; animation: flashing-c 0.5s linear infinite; }
.light-flash-c-bd {
--flash-color-1: #ffa100;
--flash-color-2: #26272b;
animation: flashing-c-bd 0.5s linear infinite;
}
.light-flash-c-bd { --flash-color-1: #ffa100; --flash-color-2: #26272b; animation: flashing-c-bd 0.5s linear infinite; }
/* checkbox switch */
input.toggle:checked::before {
content: '';
position: absolute;
top: 2px;
left: 24px;
display: block;
border-radius: 25px;
width: 20px;
height: 20px;
background: #3f8635;
}
input.toggle:checked::before { content: ''; position: absolute; top: 2px; left: 24px; display: block; border-radius: 25px; width: 20px; height: 20px; background: #3f8635; }
input.toggle::before {
content: '';
position: absolute;
top: 2px;
left: 3px;
display: block;
border-radius: 25px;
width: 20px;
height: 20px;
background: #656565;
transition: 0.2s;
}
input.toggle::before { content: ''; position: absolute; top: 2px; left: 3px; display: block; border-radius: 25px; width: 20px; height: 20px; background: #656565; transition: 0.2s; }
input.toggle {
cursor: pointer;
appearance: none;
position: relative;
width: 48px;
height: 24px;
background: #464646;
border-radius: 50px;
align-content: center;
}
input.toggle { cursor: pointer; appearance: none; position: relative; width: 48px; height: 24px; background: #464646; border-radius: 50px; align-content: center; }
input.toggle:checked {
background: #97c193;
}
input.toggle:checked { background: #97c193; }
.loading-bg {
background: #0000009c;
background-repeat: no-repeat;
opacity: 0;
width: 100%;
height: 100vh;
position: fixed;
z-index: 3000;
}
.loading-bg { background: #0000009c; background-repeat: no-repeat; opacity: 0; width: 100%; height: 100vh; position: fixed; z-index: 3000; }
.dropdown-menu {
z-index:3000;
}
.dropdown-menu { z-index: 3000; }
.adsk-viewing-viewer {
top:0px;
}
.adsk-viewing-viewer { top: 0px; }
.lds-ring {
display: inline-block;
position: relative;
width: 25px;
height: 25px;
margin-right:0.8rem;
}
.lds-ring { display: inline-block; position: relative; width: 25px; height: 25px; margin-right: 0.8rem; }
.lds-ring div {
top: -4px;
box-sizing: border-box;
display: block;
position: absolute;
width: 25px;
height: 25px;
margin: 6px;
border: 6px solid #fff;
border-radius: 50%;
animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
border-color: #fff transparent transparent transparent;
}
.lds-ring div { top: -4px; box-sizing: border-box; display: block; position: absolute; width: 25px; height: 25px; margin: 6px; border: 6px solid #fff; border-radius: 50%; animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite; border-color: #fff transparent transparent transparent; }
.lds-ring div:nth-child(1) {
animation-delay: -0.45s;
}
.lds-ring div:nth-child(1) { animation-delay: -0.45s; }
.lds-ring div:nth-child(2) {
animation-delay: -0.3s;
}
.lds-ring div:nth-child(2) { animation-delay: -0.3s; }
.lds-ring div:nth-child(3) {
animation-delay: -0.15s;
}
.lds-ring div:nth-child(3) { animation-delay: -0.15s; }
/* js-tree */
.jstree-node {
padding-bottom:3px;
}
.jstree-default-dark {
background-color:transparent;
}
.jstree a.jstree-anchor {
color:#d6d6d6 !important;
}
.jstree-node { padding-bottom: 3px; }
.jstree-default-dark { background-color: transparent; }
.jstree a.jstree-anchor { color: #d6d6d6 !important; }
.dropzone .dz-preview.dz-file-preview .dz-image {
background: linear-gradient(to bottom, #675d72, #4d4a56) !important;
}
.dropzone .dz-preview.dz-file-preview .dz-image { background: linear-gradient(to bottom, #675d72, #4d4a56) !important; }
.dz-remove {
position: absolute;
top: -8px;
right: -8px;
z-index: 100;
}
.dz-remove { position: absolute; top: -8px; right: -8px; z-index: 100; }
.dz-remove span {
width: 30px;
height: 30px;
font-size: 24px;
border-radius: 10px;
color: white;
cursor: pointer !important;
padding-top: 3px;
transition: 0.2s;
}
.dz-remove span { width: 30px; height: 30px; font-size: 24px; border-radius: 10px; color: white; cursor: pointer !important; padding-top: 3px; transition: 0.2s; }
.dz-remove span.mi-delete {
background: var(--danger);
}
.dz-remove span.mi-delete { background: var(--danger); }
.dz-remove span.mi-cancel {
font-size: 30px;
color: var(--color_grey);
}
.dz-remove span.mi-cancel { font-size: 30px; color: var(--color_grey); }
.dz-remove:hover span {
transform: scale(1.1);
transition: 0.2s;
}
.dropzone .dz-preview.dz-image-preview {
background-color:transparent !important;
}
.dz-remove:hover span { transform: scale(1.1); transition: 0.2s; }
.dropzone .dz-preview.dz-image-preview { background-color: transparent !important; }
input:-webkit-autofill {
background-color:rgba(0, 0, 0, 0.15)!important;
}
input:-webkit-autofill { background-color: rgba(0, 0, 0, 0.15) !important; }
.d-grid {
display: grid;
}
.d-grid { display: grid; }
.grid-gap-1 { grid-gap: 1px; }
.grid-gap-2 { grid-gap: 2px; }
@ -219,411 +74,228 @@ input:-webkit-autofill {
.grid-gap-5 { grid-gap: 5px; }
.grid-gap-c { grid-gap: var(--c-grid-gap); }
.grid-temp-col-c {
grid-template-columns: var(--c-grid-temp-col);
}
.grid-temp-col-c { grid-template-columns: var(--c-grid-temp-col); }
.vakata-context, .vakata-context ul { background-color: #3f3f3f; box-shadow: 2px 2px 2px #111111; }
.vakata-context li > a { color: white; text-shadow: 1px 1px 0 #4b4b4b; }
.vakata-context .vakata-context-hover > a { background-color: #666666; box-shadow: 0 0 2px #2f2f2f; }
.vakata-context li > a:hover { background-color: #636363; box-shadow: 0 0 2px #2f2f2f; }
.yt-left-navbar { position: fixed; left: 0; top: 0; height: 100%; z-index: 10; background-color: var(--theme-fusion-900); width: auto; max-width: 300px; margin-top: 4.125rem; }
.yt-left-navbar { position: fixed; left: 0; top: 0; height: 100%; z-index: 10; background-color: rgb(25 25 25 / 95%); width: auto; max-width: 300px; margin-top: 4.125rem; }
.yt-navbar-content ul { padding: 1rem 0rem; list-style-type: none; }
.yt-navbar-content ul li { position: relative; display: flex; flex-wrap: wrap; }
.yt-navbar-content ul li a { font-size: 0.9rem; padding: 0.75rem 2rem; position: relative; width: 100%; }
.yt-navbar-content ul li a:hover { background-color: var(--theme-fusion-600); }
.yt-navbar-content ul li a:active, .yt-navbar-content ul li a.active { background-color: var(--theme-fusion-500); }
@media screen and (max-width: 576px){
.card-header.p-3.ui-draggable-handle:hover { cursor: move; }
@media screen and (max-width: 576px) {
.yt-left-navbar { width: 100%; max-width: 100%; margin-top: 0; }
}
@keyframes lds-ring {
0% {
transform: rotate(0deg);
}
0% { transform: rotate(0deg); }
100% {
transform: rotate(360deg);
}
100% { transform: rotate(360deg); }
}
@keyframes flashing-c {
0% {
color: var(--flash-color-1);
}
0% { color: var(--flash-color-1); }
49% {
color: var(--flash-color-1);
}
49% { color: var(--flash-color-1); }
50% {
color: var(--flash-color-2);
}
50% { color: var(--flash-color-2); }
99% {
color: var(--flash-color-2);
}
99% { color: var(--flash-color-2); }
}
@keyframes flashing-bg {
0% {
background: var(--flash-color-1);
}
0% { background: var(--flash-color-1); }
49% {
background: var(--flash-color-1);
}
49% { background: var(--flash-color-1); }
50% {
background: var(--flash-color-2);
}
50% { background: var(--flash-color-2); }
99% {
background: var(--flash-color-2);
}
99% { background: var(--flash-color-2); }
}
@keyframes flashing-c-bd {
0% {
border-color: var(--flash-color-1);
}
0% { border-color: var(--flash-color-1); }
49% {
border-color: var(--flash-color-1);
}
49% { border-color: var(--flash-color-1); }
50% {
border-color: var(--flash-color-2);
}
50% { border-color: var(--flash-color-2); }
99% {
border-color: var(--flash-color-2);
}
99% { border-color: var(--flash-color-2); }
}
/* ================================================================ */
/* 單一方法 */
/* ================================================================ */
/* cursor */
.cur-def { cursor: default !important; }
/* 單一方法 */
/* ================================================================ */
/* cursor */
.cur-def { cursor: default !important; }
.cur-poi {
cursor: pointer !important;
}
.cur-poi { cursor: pointer !important; }
/*left 距離*/
.left-05 {
left: 0.5rem !important;
}
.left-05 { left: 0.5rem !important; }
.left-04 {
left: 0.4rem !important;
}
.left-04 { left: 0.4rem !important; }
.left-03 {
left: 0.3rem !important;
}
.left-03 { left: 0.3rem !important; }
.left-02 {
left: 0.2rem !important;
}
.left-02 { left: 0.2rem !important; }
.left-01 {
left: 0.1rem !important;
}
.left-01 { left: 0.1rem !important; }
/*right 距離*/
.right-05 {
right: 0.5rem !important;
}
.right-05 { right: 0.5rem !important; }
.right-04 {
right: 0.4rem !important;
}
.right-04 { right: 0.4rem !important; }
.right-03 {
right: 0.3rem !important;
}
.right-03 { right: 0.3rem !important; }
.right-02 {
right: 0.2rem !important;
}
.right-02 { right: 0.2rem !important; }
.right-01 {
right: 0.1rem !important;
}
.right-01 { right: 0.1rem !important; }
/*bottom 0.5rem*/
.bm-05 {
bottom: 0.5rem !important;
}
.bm-05 { bottom: 0.5rem !important; }
.bm-04 {
bottom: 0.4rem !important;
}
.bm-04 { bottom: 0.4rem !important; }
.bm-03 {
bottom: 0.3rem !important;
}
.bm-03 { bottom: 0.3rem !important; }
.bm-02 {
bottom: 0.2rem !important;
}
.bm-02 { bottom: 0.2rem !important; }
.bm-01 {
bottom: 0.1rem !important;
}
.bm-01 { bottom: 0.1rem !important; }
/*top 0.5rem*/
.tp-05 {
top: 0.5rem !important;
}
.tp-05 { top: 0.5rem !important; }
.tp-04 {
top: 0.4rem !important;
}
.tp-04 { top: 0.4rem !important; }
.tp-03 {
top: 0.3rem !important;
}
.tp-03 { top: 0.3rem !important; }
.tp-02 {
top: 0.2rem !important;
}
.tp-02 { top: 0.2rem !important; }
.tp-01 {
top: 0.1rem !important;
}
.tp-01 { top: 0.1rem !important; }
/* font-weight */
.fw-1 {
font-weight: 100;
}
.fw-1 { font-weight: 100; }
.fw-2 {
font-weight: 200;
}
.fw-2 { font-weight: 200; }
.fw-3 {
font-weight: 300;
}
.fw-3 { font-weight: 300; }
.fw-4 {
font-weight: 400;
}
.fw-4 { font-weight: 400; }
.fw-5 {
font-weight: 500;
}
.fw-5 { font-weight: 500; }
.fw-6 {
font-weight: 600;
}
.fw-6 { font-weight: 600; }
.fw-7 {
font-weight: 700;
}
.fw-7 { font-weight: 700; }
.fw-8 {
font-weight: 800;
}
.fw-8 { font-weight: 800; }
.fw-9 {
font-weight: 900;
}
.fw-9 { font-weight: 900; }
/* font-size */
.fs-05 {
font-size: 0.5rem;
}
.fs-05 { font-size: 0.5rem; }
.fs-075 {
font-size: 0.75rem;
}
.fs-075 { font-size: 0.75rem; }
.fs-09 {
font-size: 0.9rem;
}
.fs-09 { font-size: 0.9rem; }
.fs-1 {
font-size: 1rem;
}
.fs-1 { font-size: 1rem; }
.fs-1-05 {
font-size: 1.05rem;
}
.fs-1-05 { font-size: 1.05rem; }
.fs-1-1 {
font-size: 1.1rem;
}
.fs-1-1 { font-size: 1.1rem; }
.fs-1-2 {
font-size: 1.2rem;
}
.fs-1-2 { font-size: 1.2rem; }
.fs-1-3 {
font-size: 1.3rem;
}
.fs-1-3 { font-size: 1.3rem; }
.fs-1-5 {
font-size: 1.5rem;
}
.fs-1-5 { font-size: 1.5rem; }
.fs-2 {
font-size: 2rem;
}
.fs-2 { font-size: 2rem; }
.fs-2-5 {
font-size: 2.5rem;
}
.fs-2-5 { font-size: 2.5rem; }
/* border width */
.bd-0 {
border-width: 0px;
}
.bd-0 { border-width: 0px; }
.bd-1 {
border-width: 1px;
}
.bd-1 { border-width: 1px; }
.bd-2 {
border-width: 2px;
}
.bd-2 { border-width: 2px; }
/* border direction */
.bd-l {
border-left-style: solid;
}
.bd-l { border-left-style: solid; }
.bd-r {
border-right-style: solid;
}
.bd-r { border-right-style: solid; }
.bd-t {
border-top-style: solid;
}
.bd-t { border-top-style: solid; }
.bd-b {
border-bottom-style: solid;
}
.bd-b { border-bottom-style: solid; }
/* border radius */
.br-1 {
border-radius: 1px;
}
.br-1 { border-radius: 1px; }
.br-2 {
border-radius: 2px;
}
.br-2 { border-radius: 2px; }
.br-3 {
border-radius: 3px;
}
.br-3 { border-radius: 3px; }
.br-4 {
border-radius: 4px;
}
.br-4 { border-radius: 4px; }
.br-5 {
border-radius: 5px;
}
.br-5 { border-radius: 5px; }
/* flex-gap */
.gap-1 {
gap: 1px;
}
.gap-1 { gap: 1px; }
.gap-2 {
gap: 2px;
}
.gap-2 { gap: 2px; }
.gap-3 {
gap: 3px;
}
.gap-3 { gap: 3px; }
.gap-4 {
gap: 4px;
}
.gap-4 { gap: 4px; }
.gap-5 {
gap: 5px;
}
.gap-5 { gap: 5px; }
.gap-6 {
gap: 6px;
}
.gap-6 { gap: 6px; }
.gap-7 {
gap: 7px;
}
.gap-7 { gap: 7px; }
.gap-8 {
gap: 8px;
}
.gap-8 { gap: 8px; }
/* vertical-align */
.va-t {
vertical-align: top;
}
.va-t { vertical-align: top; }
.va-m {
vertical-align: middle;
}
.va-m { vertical-align: middle; }
.va-b {
vertical-align: bottom;
}
.va-b { vertical-align: bottom; }
.bg-orange {
background-color: #ffa100;
}
.bg-orange { background-color: #ffa100; }
/* text color */
.t-main-purple {
color: #623c80 !important;
}
.t-main-purple { color: #623c80 !important; }
.t-black {
color: #000 !important;
}
.t-black { color: #000 !important; }
.t-white {
color: #fff !important;
}
.t-white { color: #fff !important; }
.t-fb-blue {
color: #466ac2 !important;
}
.t-fb-blue { color: #466ac2 !important; }
.t-line-green {
color: #54C814 !important;
}
.t-line-green { color: #54C814 !important; }
.t-red {
color: #db0000 !important;
}
.t-red { color: #db0000 !important; }
.t-red-2 {
color: var(--yt-red-2) !important;
}
.t-red-2 { color: var(--yt-red-2) !important; }
.t-gray {
color: var(--yt-gray);
}
.t-gray { color: var(--yt-gray); }
.t-main-gray {
color: var(--yt-main-gray);
}
.t-main-gray { color: var(--yt-main-gray); }
.t-gray-2 {
color: var(--yt-gray-2) !important;
}
.t-gray-2 { color: var(--yt-gray-2) !important; }
.t-gray-3 {
color: var(--yt-gray-3);
}
.t-gray-3 { color: var(--yt-gray-3); }
.t-yellow {
color: var(--yt-yellow-1);
}
.t-yellow { color: var(--yt-yellow-1); }

View File

@ -47,6 +47,10 @@
<button type="button" class="btn btn-dark" onclick="cancelTransparentModel()">取消透明物件</button>
<button type="button" class="btn btn-danger" onclick="proFile()">剖面</button>
<button type="button" class="btn btn-dark" onclick="getLevels()">取得levels</button>
<div style="height: 50px">
<canvas id="iot-heatmap-legend" width="300" height="50"></canvas>
</div>
<button type="button" class="btn btn-info" onclick="showHeat()">顯示熱圖圖示</button>
<!--<input id="lightBar" type="range" min="0" max="100" step="5" onchange="changeLightPower()">亮度-->
<!-- <input type="range">Main Axis</input> -->
</div>
@ -191,7 +195,9 @@
<script>
var curLightIsOpen = true;
var light;
//var light;
var cavas;
this.canvas = document.getElementById('iot-heatmap-legend');
$(document).ready(function () {
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDLm53ZA');
@ -351,16 +357,16 @@
}
function openOrCloseLight() {
if (light != null) {
//if (light != null) {
if (curLightIsOpen) {
curLightIsOpen = false;
setLightOpenOrClose(curLightIsOpen, light);
setLightOpenOrClose(curLightIsOpen);//, light
}
else {
curLightIsOpen = true;
setLightOpenOrClose(curLightIsOpen, light);
setLightOpenOrClose(curLightIsOpen);//, light
}
}
//}
}
function changeColorHotspot() {
@ -395,7 +401,42 @@
function proFile() {
profile();
}
function showHeat() {
const labels = [
`${(10).toFixed(2) }${"°C"}`,
`${(40 / 2).toFixed(2)}${"°C"}`,
`${(30).toFixed(2) }${"°C"}`
];
const colorStops = ['blue', 'green', 'yellow', 'red'];
createHeatmapRect(labels, colorStops);
}
function createHeatmapRect(labels, colorStops) {
if (!this.canvas) {
return;
}
const context = this.canvas.getContext('2d');
let i, len;
context.clearRect(0, 0, 300, 50);
context.fillStyle = 'back';//white
for (i = 0, len = labels.length; i < len; i++) {
let x = 10 + 280 * i / (len - 1);
if (i === len - 1) {
x -= context.measureText(labels[i]).width;
}
else if (i > 0) {
x -= 0.5 * context.measureText(labels[i]).width;
}
context.fillText(labels[i], x, 10);
}
const gradient = context.createLinearGradient(0, 0, 300, 0);
for (i = 0, len = colorStops.length; i < len; i++) {
gradient.addColorStop(i / (len - 1), colorStops[i]);
}
context.fillStyle = gradient;
context.fillRect(10, 20, 280, 20);
}

View File

@ -34,6 +34,8 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
<link rel="mask-icon" href="img/favicon/safari-pinned-tab.svg" color="#5bbad5">
<!-- Font Awesome -->
<link href="lib/fontawesome-free/css/all.min.css" rel="stylesheet" />
<link href="lib/jquery-ui/jquery-ui.min.css" rel="stylesheet" />
<link href="lib/chart.js/Chart.min.css" rel="stylesheet" />
<link href="lib/jstree-master/themes/default/style.min.css" rel="stylesheet" />
<link href="lib/jstree-master/themes/default-dark/style.min.css" rel="stylesheet" />
@ -140,7 +142,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
<!--we need this logo when user switches to nav-function-top-->
<div class="page-logo">
<a href="javascript:;" name="topFunBtn" data-page="dashboard" class="page-logo-link press-scale-down d-flex align-items-center position-relative">
<img name="webLogo" src="img/logo.png" alt="SmartAdmin WebApp" aria-roledescription="logo">
<img src="img/logo.png" alt="SmartAdmin WebApp" aria-roledescription="logo">
<!--<span class="page-logo-text mr-1">SmartAdmin WebApp</span>-->
<!--<span class="position-absolute text-white opacity-50 small pos-top pos-right mr-2 mt-n2"></span>
@ -770,6 +772,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
"lib/jquery-validation/dist/jquery.validate",
"lib/jquery-validation/dist/additional-methods.min",
"lib/jquery-validation/dist/localization/messages_zh_TW",
"lib/jquery-ui/jquery-ui.min",
"lib/chart.js/Chart.min",
"lib/dropzone/dropzone-min",
"lib/jstree-master/jstree.min",
@ -824,7 +827,6 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
function isValidLogin() {
$("#app").load("_dashboard.html", loadCallback);
getLogo();
getUserInfo();
iniFroList();
showMainSys();
@ -1078,7 +1080,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
</div>
</div>
<div class="card-body p-2 tab-content">
<div id="state" class="show active" data-tabname="cardTab" data-tabrole="child">
<div id="state" class="show active" data-tabname="cardTab" data-tabrole="child" style="height:100%">
${drawStateTabBlo(devNum)}
</div>
<div id="info" data-tabname="cardTab" data-tabrole="child">
@ -1096,13 +1098,27 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
onShow: function (tooltipEle, oriEle) {
var tab = new YT.Tab({ tabName: "cardTab" })
loadOpeRecTable(devGuid);
//loadErrRecTable2($(oriEle).data("number"));
//loadErrRecTable();
loadErr($(oriEle).data("number"));
$(tooltipEle).find("#info").html(typeof drawInfoTabBlo != "undefined" ? drawInfoTabBlo(devGuid) : "");
if ($(oriEle).data("dbId")) {
controlFocusHotspot($(oriEle).data("dbId"));
}
$(tooltipEle).draggable({
cursor: "move",
handle: ".card-header" // 只能通过卡片的标题栏拖拽
});
$(tooltipEle).resizable({
resize: function (event,ui) {
let iframe = $(ui.element).find("iframe");
if (iframe.length != 0) {
//let cardBodyHei = $(ui.element).find(".card-body").css("height");
//if (cardBodyHei) {
// $(iframe).css("height", cardBodyHei);
//}
}
}
});
typeof subDeviceSetTable != "undefined" ? subDeviceSetTable($(oriEle).data("number")) : ""
},
onHide: function (tooltipEle, oriEle) {
@ -1221,7 +1237,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
}
function controlFocusHotspot(dbId, open = true) {
changeColorForHotspot(dbId, open);
changeColorForHotspot(dbId, open ? "focus" : null);
changeScaleForHotspot(dbId, open);
}
@ -1457,7 +1473,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
}
let li = creEle("li");
let a = creA(subSysObj.full_name, { "href": "javascript:;" }, [], `subSysBtn${subSysObj.sub_system_tag}`, { page: page, tabname: page }, "topFunBtn");
let a = creA(subSysObj.full_name, { "href": "javascript:;" }, [], `subSysBtn${subSysObj.sub_system_tag}`, { page: page, tabname: "systemMonitor" }, "topFunBtn");
li.append(a);
a.data("subSysObj", subSysObj)
subSysObj.main_system_tag = mainSysObj.main_system_tag;

View File

@ -11,11 +11,15 @@ var levels;//剖面用
var lowerIdx;//剖面的下方樓層
var upperIdx;//剖面的上方樓層
function launchViewer(urn, callback, _selector = "#forgeViewer") {
function launchViewer(urn, callback,failCallback, _selector = "#forgeViewer") {
selector = _selector;
var options = {
env: 'AutodeskProduction',
getAccessToken: getForgeToken
getAccessToken: getForgeToken,
settings: {
ambientShadows: false,
groundShadows: false
}
};
Autodesk.Viewing.Initializer(options, () => {
@ -25,11 +29,14 @@ function launchViewer(urn, callback, _selector = "#forgeViewer") {
var documentId = 'urn:' + urn;
Autodesk.Viewing.Document.load(documentId, onDocumentLoadSuccess, onDocumentLoadFailure);
setShadowShow();
$(selector).on("autodesk:loaded", function (e, nodeIds) {
callback ? callback(viewer, nodeIds) : "";
})
$(selector).on("autodesk:loaded:fail", function (e) {
failCallback ? failCallback(viewer) : "";
})
//test
// for (let i = 0; i < urn.length; i++) {
@ -58,12 +65,16 @@ function launchViewer(urn, callback, _selector = "#forgeViewer") {
});
}
function launchViewerForHotspot(urn, callback, _selector = "#forgeViewer") {
function launchViewerForHotspot(urn, callback, failCallback, _selector = "#forgeViewer") {
selector = _selector;
var av = Autodesk.Viewing;
var options = {
env: 'AutodeskProduction',
getAccessToken: getForgeToken
getAccessToken: getForgeToken,
settings: {
ambientShadows: false,
groundShadows: false
}
};
Autodesk.Viewing.Initializer(options, () => {
@ -76,18 +87,27 @@ function launchViewerForHotspot(urn, callback, _selector = "#forgeViewer") {
});
Autodesk.Viewing.Document.load(documentId, onDocumentLoadSuccess, onDocumentLoadFailure);
setShadowShow();
$(selector).on("autodesk:loaded", function (e, nodeIds) {
callback ? callback(viewer, nodeIds) : "";
console.log(viewer.get)
})
$(selector).on("autodesk:loaded:fail", function (e) {
failCallback ? failCallback(viewer) : "";
})
});
}
function launchViewerNoTools(urn, callback, _selector = "#forgeViewer") {
function launchViewerNoTools(urn, callback, failCallback, _selector = "#forgeViewer") {
selector = _selector;
var options = {
env: 'AutodeskProduction',
getAccessToken: getForgeToken
getAccessToken: getForgeToken,
settings: {
ambientShadows: false,
groundShadows: false
}
};
Autodesk.Viewing.Initializer(options, () => {
@ -97,10 +117,14 @@ function launchViewerNoTools(urn, callback, _selector = "#forgeViewer") {
var documentId = 'urn:' + urn;
Autodesk.Viewing.Document.load(documentId, onDocumentLoadSuccess, onDocumentLoadFailure);
setShadowShow();
$(selector).on("autodesk:loaded", function (e, nodeIds) {
callback ? callback(viewer, nodeIds) : "";
})
$(selector).on("autodesk:loaded:fail", function (e) {
failCallback ? failCallback(viewer) : "";
})
});
}
@ -495,7 +519,7 @@ function getAllDbIds(viewer) {
* Autodesk.Viewing.Document.load() failuire callback.
*/
function onDocumentLoadFailure(viewerErrorCode) {
$(selector).trigger("autodesk:loaded");
$(selector).trigger("autodesk:loaded:fail");
console.error("onDocumentLoadFailure() - errorCode:" + viewerErrorCode);
}
@ -622,10 +646,14 @@ class ADHeatMaps {
}
//全部物件 透明度: 輸入0:透明輸入1:不透明
function setTransparentBuilding(transparent) {
for (var i = 0; i < allDbIdsStr.length; i++) {
setTransparency(parseInt(allDbIdsStr[i]), transparent);
}
function setTransparentBuilding(transparent, filDbids = []) {
for (var i = 0; i < allDbIdsStr.length; i++) {
setTransparency(parseInt(allDbIdsStr[i]), transparent);
}
for (var i = 0; i < filDbids.length; i++) {
setTransparency(parseInt(filDbids[i]), transparent == 0 ? 1 : 0);
}
}
//設定模型 透明度
@ -636,7 +664,11 @@ function setTransparency(nodeId, opacity) {
model.getData().instanceTree.enumNodeFragments(
nodeId, (fragId) => {
// 將遍歷到的片段 ID 添加到結果陣列中
fragIds.push(fragId)
}, (nodeId) => {
// 如果遍歷到的節點是葉節點,则返回 true表示繼續遍歷該節點的片段
return model.getData().instanceTree.isLeaf(nodeId);
});
fragIds.forEach((fragId) => {
@ -656,12 +688,34 @@ function setTransparency(nodeId, opacity) {
viewer.impl.invalidate(true, true, true);
}
function changeColor(nodeId) {//電梯變綠色
function changeColor(nodeId, color = [0, 255, 0, 1]) {//電梯變綠色
let model = viewer.model;
let fragList = viewer.model.getFragmentList();
let instanceTree = viewer.model.getData().instanceTree;
color = color.map((x, i) => i < 3 ? x / 255 : x);
color = new THREE.Vector4().fromArray(color);
model.getData().instanceTree.enumNodeFragments(
nodeId, (fragId) => {
// 將遍歷到的片段 ID 添加到結果陣列中
let material = fragList.getMaterial(fragId);
if (material) {
//设置透明度
material.opacity = 1;//0.5;
material.transparent = true;
//标记更新
material.needsUpdate = true;
}
}, (nodeId) => {
// 如果遍歷到的節點是葉節點,则返回 true表示繼續遍歷該節點的片段
return model.getData().instanceTree.isLeaf(nodeId);
});
instanceTree.enumNodeChildren(nodeId, function (chiNodeId) {
var color = new THREE.Vector4(0, 1, 0, 1);
viewer.setThemingColor(chiNodeId, color);
}, true)
}, (chiNodeId) => {
// 如果遍歷到的節點是葉節點,则返回 true表示繼續遍歷該節點的片段
return model.getData().instanceTree.isLeaf(chiNodeId);
})
}
function hideColor(nodeId) {//顏色改成透明
@ -734,11 +788,11 @@ async function addHotPoint(data) {
function onSpriteClicked(event) {
event.hasStopped = true;
if (event != undefined && event != null) {
if (event.dbId >= dbIdStart && event.dbId <= dbIdEnd) {//event.dbId > 0 && event.dbId < 19
if (event.dbId >= dbIdStart) {//event.dbId > 0 && event.dbId < 19
console.log(`Sprite clicked: ${event.dbId}`);
openHotspotModal();
for (let i = dbIdStart; i <= dbIdEnd; i++) {
changeColorForHotspot(i, false);
for (let i = dbIdStart; i <= myDataList.length + 10; i++) {
changeColorForHotspot(i);
changeScaleForHotspot(i, false);
}
let myData = myDataList.filter(x => x._dbId == event.dbId)[0];
@ -776,12 +830,14 @@ async function addHotPoint(data) {
}
// 熱點 更換顏色
async function changeColorForHotspot(dbId, type = true) {
async function changeColorForHotspot(dbId, type = null) {
const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization");
let spriteColorFocus = new THREE.Color(0x00ffe1);
if (!type) {
spriteColorFocus = new THREE.Color(0xffffff);
}
let spriteColorFocus = new THREE.Color(0xffffff);
if (type == "focus") {
spriteColorFocus = new THREE.Color(0x00ffe1);
} else if (type == "error") {
spriteColorFocus = new THREE.Color(0xff0000);
}
const viewablesToUpdate = dbId;
dataVizExtn.invalidateViewables(viewablesToUpdate, (viewable) => {
return {
@ -1001,7 +1057,7 @@ async function getRemoteLevels() {
return levels2;
}
async function getLevelsData(lowerFloor, upperFloor) {
async function getLevelsData(lowerFloor, upperFloor, callback = null) {
// 樓層正規化 取得樓層
const floorRegex = /[\d|\w]+F/gmi;
const data = await this.getRemoteLevels();
@ -1015,7 +1071,7 @@ async function getLevelsData(lowerFloor, upperFloor) {
}
}
this.levels = data;
profile();
profile(callback);
}
function getCutPlaneParam(idx, n) {
@ -1036,12 +1092,13 @@ function getCutPlaneParam(idx, n) {
return new THREE.Vector4(0, 0, n, d);
}
function profile() {
function profile(callback = null) {
//const upperIdx = 6;
const upperCutPlaneParam = this.getCutPlaneParam(upperIdx, 1);
//const lowerIdx = 7;
const lowerCutPlaneParam = this.getCutPlaneParam(lowerIdx, -1);
this.viewer.setCutPlanes([upperCutPlaneParam, lowerCutPlaneParam]);
callback ? callback() : "";
}
//----------------- end -----------------------------------------------
//新增燈光
@ -1091,11 +1148,15 @@ function changeColorTransparency(nodeId, color) {//變綠色
}
//隱藏全物件
function hideAllObjects() {
function hideAllObjects(filDbids = []) {
//viewer.hide(4);//只針對一個物件(dbid為4)做隱藏
for (var i = 0; i < allDbIdsStr.length; i++) {
viewer.hide(parseInt(allDbIdsStr[i]));
}
for (var i = 0; i < filDbids.length; i++) {
viewer.show(parseInt(filDbids[i]), viewer.model);
}
}
//顯示全物件
function showAllObjects() {
@ -1121,4 +1182,10 @@ async function toLoadHeatmap(roomArr) {
const model = viewer.model;
loadHeatmaps(model, roomArr);
}
function setShadowShow(type = false) {
viewer.setGroundShadow(type);
viewer.impl.sceneUpdated(true);
}
//============================= end ===================================

View File

@ -4,12 +4,14 @@ var targetFloorZ;
var elevatorSpeed;
var allDbIdsStr;
let bulbLight;//點燈
let spotLight;//聚光燈
var spotLight;//聚光燈
var myDataList;//設備清單
var viewableData;
var dataVizExtn;
var spriteColorRed;
var levels;//剖面用
var light;
let pointLightHelper;
function launchViewer(urn) {
var av = Autodesk.Viewing;
@ -71,7 +73,7 @@ function onDocumentLoadSuccess(doc) {
var currSelection = viewer.getSelection();
var domElem = document.getElementById('id_printer');
domElem.innerText = currSelection[0];
var a = newLight();
/*var a = newLight();*/
//var color = new THREE.Vector4(255 / 255, 0, 0, 1);
@ -464,8 +466,8 @@ function onDocumentLoadSuccess(doc) {
//spotLight.target = cube;
//viewer.scene.add(spotLight);
//var light = newLight();
/*newLight();*/
//light = newLight();
newLight();
}
@ -480,7 +482,7 @@ async function addHotPoint(data) {
const spriteIcon = "https://d2zqnmauvnpnnm.cloudfront.net/assets-1/images/circle.svg"; //"/img/forge/hotspot.svg";
const style = new DataVizCore.ViewableStyle(viewableType, spriteColor, spriteIcon);
var a = newLight();
//function onSpriteClicked(event) {
// console.log(`Sprite clicked: ${event.dbId}`);
//}
@ -519,6 +521,7 @@ async function addHotPoint(data) {
event.hasStopped = true;
if (event != undefined && event != null) {
if (event.dbId >= 10 && event.dbId <= 13) {//event.dbId > 0 && event.dbId < 19
setLightValues(20, 0x00ff00)
console.log(`Sprite clicked: ${event.dbId}`);
openHotspotModal();
}
@ -1139,8 +1142,10 @@ async function loadHeatmaps(model) {
// Setup surface shading
await dataVizExtn.setupSurfaceShading(model, heatmapData);
//dataVizExtn.registerSurfaceShadingColors("co2", [0x00ff00, 0xff0000]);
dataVizExtn.registerSurfaceShadingColors("temperature", [0xff0000, 0x0000ff]);
const sensorColors = [0x0000ff, 0x00ff00, 0xffff00, 0xff0000];//0 ~ 1 藍綠黃紅
//dataVizExtn.registerSurfaceShadingColors("co2", [0x00ff00, 0xff0000]); 0~1
dataVizExtn.registerSurfaceShadingColors("temperature", sensorColors);//[0xff0000, 0x0000ff]
function getSensorValue(device, sensorType) {
return sensorVals[parseInt(device.id.slice(-1)) - 1]; // 值: 0~1之間
@ -1382,33 +1387,31 @@ async function newLight() {
//angle - 光從其上界為 Math.PI / 2 的方向散射的最大角度。
//半影 - 由於半影而衰減的聚光燈錐體的百分比。取值介於 0 和 1 之間。默認值為零。
//decay - 光沿光的距離變暗的量。
spotLight = new THREE.SpotLight(0xffffff, 200, 20, 0.6, 0.5, 10);//0xffffff 80, 10 //15, 20 , Math.PI / 12
spotLight.position.set(43.72, -15.65, -44.96); //set(-17.33, 51.03, -2.52); // -7.58, 18.20, -0.25 -44.96
spotLight.castShadow = false;
spotLight.visible = true;
//var geom = new THREE.BoxGeometry(); //create 幾何對象 -17.33, 51.03, -4.52
//var material = new THREE.MeshLambertMaterial({ color: 0xffff00 });//0xff0000
//var cube = new THREE.Mesh(geom, material);
//cube.position.set(43.72, -15.65, -46); //set(-17.33, 51.03, -10);//-4.52 // -7.58, 18.20, -1
//cube.scale.set(0.5, 0.5, 0.5);
//viewer.scene.add(cube);
//spotLight.target = cube;
//spotLight = new THREE.SpotLight(0xff0000, 200, 20, 0.6, 0.5, 10);//0xffffff 80, 10 //15, 20 , Math.PI / 12
//spotLight.position.set(43.72, -15.65, -44.96); //set(-17.33, 51.03, -2.52); // -7.58, 18.20, -0.25 -44.96
//spotLight.castShadow = false;
//spotLight.visible = true;
spotLight.target.position.set(43.72, -15.65, -60);// -15.65 -48
viewer.scene.add(spotLight.target);
//spotLight.target.position.set(43.72, -15.65, -60);// -15.65 -48
//viewer.scene.add(spotLight.target);
viewer.scene.add(spotLight);
//viewer.scene.add(spotLight);
viewer.impl.sceneUpdated(true);
//viewer.impl.sceneUpdated(true);
//return spotLight;
//加入點燈光
//bulbLight = new THREE.PointLight(0xff0000, 50, 20, 2);//0xff0000
//bulbLight.position.set(43.72, -15.65, -44.96);//17.880840301513672
//bulbLight.castShadow = true;
//viewer.scene.add(bulbLight);
//viewer.impl.sceneUpdated(true);
bulbLight = new THREE.PointLight(0xff0000, 50, 20, 2);//0xff0000
bulbLight.position.set(43.72, -15.65, -44.96);//17.880840301513672
bulbLight.castShadow = true;
bulbLight.visible = true;
viewer.scene.add(bulbLight);
//pointLightHelper = new THREE.PointLightHelper(pointLight);
//viewer.scene.add(pointLightHelper);
viewer.impl.sceneUpdated(true);
}
//-------------- 更改燈光範圍 --------------------------
@ -1418,23 +1421,31 @@ function setLightPower(value) {
viewer.impl.sceneUpdated(true);
}
function setLightValues(intensity, distance, angle, penumbra, decay) {
function setLightValues(intensity, color) {// distance, angle, penumbra, decay,
viewer.scene.remove(spotLight)
spotLight.intensity = intensity;
spotLight.distance = distance;
spotLight.angle = angle;
spotLight.penumbra = penumbra;
spotLight.decay = decay;
//spotLight.distance = distance;
//spotLight.angle = angle;
//spotLight.penumbra = penumbra;
//spotLight.decay = decay;
var tempcolor = new THREE.Color().setHex(color);
spotLight.color = tempcolor;
viewer.impl.sceneUpdated(true);
viewer.scene.add(spotLight);
viewer.impl.sceneUpdated(true);
}
function setLightOpenOrClose(value, light) {
function setLightOpenOrClose(value) {//, light
if (value) {
light.visible = true;
//light.visible = true;
//spotLight.visible = true;
bulbLight.visible = true;
}
else {
light.visible = false;
//light.visible = false;
//spotLight.visible = false;
bulbLight.visible = false;
}
viewer.impl.sceneUpdated(true);
}

View File

@ -604,4 +604,8 @@ class Forge3DElevFull {
}
}, null, "POST").send();
}
getNodeIds = function () {
return this.elev3DObj.map(x => x.nodeId);
}
}

View File

@ -83,7 +83,7 @@ class YourTeamNavbar {
}
initClose = function () {
debugger
let width = $(this.element)[0].offsetWidth;
if (this.type == "left") {
$(this.element).css("left", 0 - width);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -61,7 +61,9 @@ namespace FrontendWebApi.ApiControllers
{
var dbsub = await frontendRepository.GetAllAsync<HistoryDBMainSub>(
@$"select distinct v1.system_key main_name, v1.system_value main_system_tag, v2.system_key sub_name, v2.system_value sub_system_tag, v1.system_priority, v2.system_priority,
dk.device_normal_color, dk.device_close_color, dk.device_error_color,dk.device_normal_flashing, dk.device_close_flashing, dk.device_error_flashing
dk.device_normal_color, dk.device_close_color, dk.device_error_color,dk.device_normal_flashing, dk.device_close_flashing, dk.device_error_flashing,
dk.device_normal_text, dk.device_close_text, dk.device_error_text,dk.device_normal_point_name, dk.device_close_point_name, dk.device_error_point_name,
dk.device_normal_point_value, dk.device_close_point_value, dk.device_error_point_value
-- di.full_name as device_item_name, di.points as device_item_points, di.unit as device_item_unit, di.is_show_riserDiagram as device_item_is_show_riserDiagram,
-- di.is_controll as device_item_is_controll, di.is_bool as device_item_is_bool, di.is_link as device_item_is_link
from role_auth a
@ -89,7 +91,7 @@ namespace FrontendWebApi.ApiControllers
history_Main_System.History_Sub_systems = new List<History_Sub_system>();
var subs = dbsub.Where(x => x.main_system_tag == main.Select(m => m.main_system_tag).FirstOrDefault()).ToList();
foreach(var sub in subs)
foreach (var sub in subs)
{
History_Sub_system history_Sub_System = new History_Sub_system();
history_Sub_System.sub_system_tag = sub.sub_system_tag;
@ -100,6 +102,15 @@ namespace FrontendWebApi.ApiControllers
history_Sub_System.device_normal_flashing = sub.device_normal_flashing;
history_Sub_System.device_close_flashing = sub.device_close_flashing;
history_Sub_System.device_error_flashing = sub.device_error_flashing;
history_Sub_System.device_normal_text = sub.device_normal_text;
history_Sub_System.device_close_text = sub.device_close_text;
history_Sub_System.device_error_text = sub.device_error_text;
history_Sub_System.device_normal_point_name = sub.device_normal_point_name;
history_Sub_System.device_close_point_name = sub.device_close_point_name;
history_Sub_System.device_error_point_name = sub.device_error_point_name;
history_Sub_System.device_normal_point_value = sub.device_normal_point_value;
history_Sub_System.device_close_point_value = sub.device_close_point_value;
history_Sub_System.device_error_point_value = sub.device_error_point_value;
history_Main_System.History_Sub_systems.Add(history_Sub_System);
}
@ -174,7 +185,7 @@ namespace FrontendWebApi.ApiControllers
public async Task<ActionResult<ApiResult<List<BuildList>>>> GetBuild()
{
ApiResult<List<BuildList>> apiResult = new ApiResult<List<BuildList>>();
try
{
var sqlString = $@"select building_tag, full_name, urn_3D from building where deleted = 0 order by priority";
@ -287,7 +298,7 @@ namespace FrontendWebApi.ApiControllers
var dlParam = new { @sub_system_tag = fd.sub_system_tag, @building_tag = fd.building_tag, @floor_tag = f.full_name };
dl = await backendRepository.GetAllAsync<DeviceLists>(sqlString, dlParam);
foreach(var d in dl)
foreach (var d in dl)
{
var sql_node = $@"SELECT
dn.device_node_guid,
@ -298,7 +309,7 @@ namespace FrontendWebApi.ApiControllers
FROM device_node dn
WHERE dn.deleted = 0 AND dn.device_guid = @device_guid
ORDER BY dn.priority ASC";
d.Device_nodes = await backendRepository.GetAllAsync<DeviceNode>(sql_node, new { device_guid = d.device_guid });
}
f.device_list = dl;
@ -333,7 +344,7 @@ namespace FrontendWebApi.ApiControllers
object param = new { @device_guid = fd.device_guid };
var device = await backendRepository.GetOneAsync<DeviceBaseInfo>(sql, param);
if(device == null)
if (device == null)
{
apiResult.Msg = "查無次設備";
apiResult.Code = "0001";
@ -536,7 +547,7 @@ namespace FrontendWebApi.ApiControllers
//alarmObj.alarmorion = Alarmorions.GroupBy(a => new { a.device_number, a.alarm_timestamp }).Select(a => a.First()).ToList();
foreach(var alarm in alarms)
foreach (var alarm in alarms)
{
var temp_alarm = alarmObj.alarmorion.Find(x => x.device_number == alarm.device_number);
@ -691,7 +702,7 @@ namespace FrontendWebApi.ApiControllers
from device where deleted = 0 and device_area_tag = @device_area_tag and device_building_tag = @device_building_tag
and device_system_tag = @device_system_tag and device_name_tag = @device_name_tag
and device_floor_tag = ifnull(@device_floor_tag, device_floor_tag) ", param);
apiResult.Data = d;
apiResult.Code = "0000";
}
@ -721,7 +732,7 @@ namespace FrontendWebApi.ApiControllers
try
{
apiResult.Code = "0001";
if (p != null )
if (p != null)
{
if (p.device_system_tag == "LT" && p.device_name_tag == "L1")
{
@ -792,8 +803,8 @@ namespace FrontendWebApi.ApiControllers
/// <param name="account"></param>
/// <returns></returns>
[HttpPost]
[Route("api/Device/GetForgeNodeName")]
public async Task<ActionResult<List<Variable>>> GetForgeNodeName([FromBody] string forgeNodeKey)
[Route("api/Device/GetForgeNodeIdFromVar")]
public async Task<ActionResult<List<Variable>>> GetForgeNodeIdFromVar([FromBody] string forgeNodeKey)
{
ApiResult<List<Variable>> apiResult = new ApiResult<List<Variable>>();
List<Variable> variable = new List<Variable>();
@ -810,7 +821,7 @@ namespace FrontendWebApi.ApiControllers
apiResult.Data = v;
apiResult.Code = "0000";
}
catch (Exception exception)
{
@ -839,7 +850,7 @@ namespace FrontendWebApi.ApiControllers
apiResult.Msg = "需傳入樓層guid";
return apiResult;
}
try
{
var sqlString = $@" SELECT * FROM floor WHERE

View File

@ -40,45 +40,45 @@ namespace FrontendWebApi.ApiControllers
[Authorize]
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
controllerName = ControllerContext.RouteData.Values["controller"].ToString(); //controller名稱
actionName = ControllerContext.RouteData.Values["action"].ToString(); //action名稱
//controllerName = ControllerContext.RouteData.Values["controller"].ToString(); //controller名稱
//actionName = ControllerContext.RouteData.Values["action"].ToString(); //action名稱
var ctx = filterContext.HttpContext;
ctx.Response.Headers.Add("Access-Control-Allow-Origin", "*");
ctx.Response.Headers.Add("Access-Control-Allow-Headers", "*");
ctx.Response.Headers.Add("Access-Control-Allow-Credentials", "true");
EDFunction edFunction = new EDFunction();
myUser = new JwtGet()
{
account = User.Claims.Where(a => a.Type == "account").Select(e => e.Value).FirstOrDefault(),
email = User.Claims.Where(a => a.Type == "email").Select(e => e.Value).FirstOrDefault(),
full_name = User.Claims.Where(a => a.Type == "full_name").Select(e => e.Value).FirstOrDefault(),
exp = User.Claims.Where(a => a.Type == "exp").Select(e => Convert.ToInt32(e.Value)).FirstOrDefault(),
nbf = User.Claims.Where(a => a.Type == "nbf").Select(e => Convert.ToInt32(e.Value)).FirstOrDefault(),
userinfo_guid = User.Claims.Where(a => a.Type == "userinfo_guid").Select(e => e.Value).FirstOrDefault(),
};
//var ctx = filterContext.HttpContext;
//ctx.Response.Headers.Add("Access-Control-Allow-Origin", "*");
//ctx.Response.Headers.Add("Access-Control-Allow-Headers", "*");
//ctx.Response.Headers.Add("Access-Control-Allow-Credentials", "true");
//EDFunction edFunction = new EDFunction();
//myUser = new JwtGet()
//{
// account = User.Claims.Where(a => a.Type == "account").Select(e => e.Value).FirstOrDefault(),
// email = User.Claims.Where(a => a.Type == "email").Select(e => e.Value).FirstOrDefault(),
// full_name = User.Claims.Where(a => a.Type == "full_name").Select(e => e.Value).FirstOrDefault(),
// exp = User.Claims.Where(a => a.Type == "exp").Select(e => Convert.ToInt32(e.Value)).FirstOrDefault(),
// nbf = User.Claims.Where(a => a.Type == "nbf").Select(e => Convert.ToInt32(e.Value)).FirstOrDefault(),
// userinfo_guid = User.Claims.Where(a => a.Type == "userinfo_guid").Select(e => e.Value).FirstOrDefault(),
//};
if (myUser.exp == 0)
{
jwt_str = "Jwt Token不合法";
jwtlife = false;
filterContext.Result = new JsonResult(new { HttpStatusCode.Unauthorized });
}
else
{
if (myUser.exp <= DateTime.Now.AddHours(-8).AddMinutes(10).Subtract(new DateTime(1970, 1, 1)).TotalSeconds)
{
jwtlife = true;
JwtLogin jwtLoing = new JwtLogin()
{
account = myUser.account,
email = myUser.email,
full_name = myUser.full_name,
userinfo_guid = myUser.userinfo_guid
};
jwt_str = jwt.GenerateToken(jwtLoing).token;
}
}
//if (myUser.exp == 0)
//{
// jwt_str = "Jwt Token不合法";
// jwtlife = false;
// filterContext.Result = new JsonResult(new { HttpStatusCode.Unauthorized });
//}
//else
//{
// if (myUser.exp <= DateTime.Now.AddHours(-8).AddMinutes(10).Subtract(new DateTime(1970, 1, 1)).TotalSeconds)
// {
// jwtlife = true;
// JwtLogin jwtLoing = new JwtLogin()
// {
// account = myUser.account,
// email = myUser.email,
// full_name = myUser.full_name,
// userinfo_guid = myUser.userinfo_guid
// };
// jwt_str = jwt.GenerateToken(jwtLoing).token;
// }
//}
base.OnActionExecuting(filterContext);
}
}

View File

@ -65,6 +65,15 @@ namespace FrontendWebApi.Models
public string device_normal_color { get; set; }
public string device_close_color { get; set; }
public string device_error_color { get; set; }
public string device_normal_point_name { get; set; }
public string device_close_point_name { get; set; }
public string device_error_point_name { get; set; }
public string device_normal_text { get; set; }
public string device_close_text { get; set; }
public string device_error_text { get; set; }
public string device_normal_point_value { get; set; }
public string device_close_point_value { get; set; }
public string device_error_point_value { get; set; }
public string device_item_name { get; set; }
public string device_item_points { get; set; }
public string device_item_unit { get; set; }
@ -126,6 +135,16 @@ namespace FrontendWebApi.Models
public string device_normal_flashing { get; set; }
public string device_close_flashing { get; set; }
public string device_error_flashing { get; set; }
public string device_normal_text { get; set; }
public string device_close_text { get; set; }
public string device_error_text { get; set; }
public string device_normal_point_name { get; set; }
public string device_close_point_name { get; set; }
public string device_error_point_name { get; set; }
public string device_normal_point_value { get; set; }
public string device_close_point_value { get; set; }
public string device_error_point_value { get; set; }
public string auth_code { get; set; }
}
public class History_PostDevice