[Frontend][系統監控] Card 可拖拉並縮放程序建置 | jquery-ui套件引入 | [系統監控] 即時狀態視窗調整 | [電梯系統][系統監控] 載入 3d 採用透明度為0的方式 | [系統監控] 上方燈號串接資料庫資料 | 即時狀態與資料庫串接 | 供水系統染色程序建置 | [FrontendWebApi] GetMainSub 提供 point 類型資料程序建置

This commit is contained in:
dev01 2023-01-05 18:37:12 +08:00
parent 36b081d775
commit 4c527a46c3
11 changed files with 429 additions and 568 deletions

View File

@ -2384,7 +2384,8 @@
let forge3DElev = new Forge3DElevFull(elevOption); let forge3DElev = new Forge3DElevFull(elevOption);
forge3DElev.bajaEndCallback = function () { forge3DElev.bajaEndCallback = function () {
debugger debugger
hideAllObjects(this.getNodeIds()); /*hideAllObjects(this.getNodeIds());*/
setTransparentBuilding(0);
endPageLoading(); endPageLoading();
} }
forge3DElev.bajaChaCallback = function (data) { forge3DElev.bajaChaCallback = function (data) {

View File

@ -36,6 +36,7 @@
<script> <script>
var allDevList = []; //全設備清單 var allDevList = []; //全設備清單
var subDeviceData = [];
var heatMap = null; var heatMap = null;
$(function () { $(function () {
@ -48,7 +49,6 @@
getHotspotPoint(() => { getHotspotPoint(() => {
show3DModel(data.urn_3D); show3DModel(data.urn_3D);
}); });
} }
}); });
}) })
@ -64,18 +64,7 @@
break; break;
case 4: case 4:
strHtml = `<div class="d-flex mb-4" style="gap:15px"> strHtml = `<div class="d-flex mb-4" style="gap:15px">
<div class="row m-0 align-items-center"> ${setTopLight()}
<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>
</div> </div>
<div class="col-12 p-0" id="floDevList"> <div class="col-12 p-0" id="floDevList">
@ -105,13 +94,26 @@
if (!matchDevice) { if (!matchDevice) {
return false; 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 norDevPoiName = matchDevice.device_normal_point_name;
let cloDevPoiName = matchDevice.device_close_point_name; let cloDevPoiName = matchDevice.device_close_point_name;
let errDevPoiName = matchDevice.device_error_point_name; let errDevPoiName = matchDevice.device_error_point_name;
if (data.point_name == "Temp") { if (data.point_name == "Temp") {
console.log(data)
heatMap?.changeTemp(data.device_number_full, !isNaN(parseInt(data.value)) ? parseInt(data.value) : 0); 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); let devIdx = allDevList.findIndex(x => x.device_number == data.device_number_full);
allDevList[devIdx]._temp = !isNaN(parseInt(data.value)) ? parseInt(data.value) : 0; allDevList[devIdx]._temp = !isNaN(parseInt(data.value)) ? parseInt(data.value) : 0;
@ -125,10 +127,13 @@
} else if (data.point_name == errDevPoiName && data.value == matchDevice.device_error_point_value) { } 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"); $(`#${matchDevice.device_number}_status`).attr("data-light-type", "error").data("light-type", "error");
} }
setLightColor(); setLightColor();
setForgeHotSpotColor(matchDevice);
}); });
myBaja.setSubscribeDeviceEndCallBack(function (data) { myBaja.setSubscribeDeviceEndCallBack(function (data) {
endPageLoading(); endPageLoading();
}); });
@ -161,6 +166,40 @@
}) })
} }
// 設置昇位圖上方 燈號
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() { function getFloDevList() {
let url = baseApiUrl + "/api/Device/GetDeviceList"; let url = baseApiUrl + "/api/Device/GetDeviceList";
@ -254,19 +293,24 @@
} }
// Card 即時狀態 // Card 即時狀態
function drawStateTabBlo() { function drawStateTabBlo(devNum) {
let strHtml = `<div style="height:15rem"> let devPath = devNum.replaceAll("_", "/");
<iframe src="/ord?station:%7Cslot:/TPE/B1/EE/E4/R2F/NA/WHT/N1|view:?fullScreen=true" width="100%" height="100%"></iframe> 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>` </div>`
return strHtml; return strHtml;
} }
function iframeResize(obj) {
obj.style.height = obj.contentWindow.document.documentElement.scrollHeight + 'px';
}
function show3DModel(urn) { function show3DModel(urn) {
$(loadEle).Loading("start"); $(loadEle).Loading("start");
launchViewerForHotspot(urn, (viewer, nodeIds) => { launchViewerForHotspot(urn, (viewer, nodeIds) => {
let devDbIds = allDevList.map(x => x.forge_dbid); let devDbIds = allDevList.map(x => x.forge_dbid);
hideAllObjects(devDbIds); /*hideAllObjects(devDbIds);*/
setTransparentBuilding(0, devDbIds);
$(loadEle).Loading("close"); $(loadEle).Loading("close");
let devices = allDevList.map(x => { let devices = allDevList.map(x => {
return { return {
roomDbId: !isNaN(parseInt(x.room_dbid)) ? parseInt(x.room_dbid) : -1, roomDbId: !isNaN(parseInt(x.room_dbid)) ? parseInt(x.room_dbid) : -1,
@ -302,11 +346,42 @@
endPageLoading(); endPageLoading();
} }
forge3DElev.init(); 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"); $(loadEle).Loading("close");
}, "[name=forgeViewer]"); }, "[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) { function getHotspotPoint(callback = null) {
let url = baseApiUrl + "/api/GetDevForCor"; let url = baseApiUrl + "/api/GetDevForCor";
@ -363,10 +438,18 @@
}) })
onEvent("autodesk:complete:sprite", "[name=forgeViewer]", function (e, obj) { onEvent("autodesk:complete:sprite", "[name=forgeViewer]", function (e, obj) {
$("#floDevList a[name=devItem]").each((idx, ele) => { $("#floDevList a[name=devItem]").each((idx, ele) => {
let devNum = $(ele).data("number"); let devNum = $(ele).data("number");
let dbid = obj.myDataList.filter(x => x.device_number == devNum)[0]?._dbId; 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); $(ele).data("dbId", dbid);
}) })
}) })

View File

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

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"> <link rel="mask-icon" href="img/favicon/safari-pinned-tab.svg" color="#5bbad5">
<!-- Font Awesome --> <!-- Font Awesome -->
<link href="lib/fontawesome-free/css/all.min.css" rel="stylesheet" /> <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/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/style.min.css" rel="stylesheet" />
<link href="lib/jstree-master/themes/default-dark/style.min.css" rel="stylesheet" /> <link href="lib/jstree-master/themes/default-dark/style.min.css" rel="stylesheet" />
@ -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/jquery.validate",
"lib/jquery-validation/dist/additional-methods.min", "lib/jquery-validation/dist/additional-methods.min",
"lib/jquery-validation/dist/localization/messages_zh_TW", "lib/jquery-validation/dist/localization/messages_zh_TW",
"lib/jquery-ui/jquery-ui.min",
"lib/chart.js/Chart.min", "lib/chart.js/Chart.min",
"lib/dropzone/dropzone-min", "lib/dropzone/dropzone-min",
"lib/jstree-master/jstree.min", "lib/jstree-master/jstree.min",
@ -1077,7 +1080,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
</div> </div>
</div> </div>
<div class="card-body p-2 tab-content"> <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)} ${drawStateTabBlo(devNum)}
</div> </div>
<div id="info" data-tabname="cardTab" data-tabrole="child"> <div id="info" data-tabname="cardTab" data-tabrole="child">
@ -1095,13 +1098,27 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
onShow: function (tooltipEle, oriEle) { onShow: function (tooltipEle, oriEle) {
var tab = new YT.Tab({ tabName: "cardTab" }) var tab = new YT.Tab({ tabName: "cardTab" })
loadOpeRecTable(devGuid); loadOpeRecTable(devGuid);
//loadErrRecTable2($(oriEle).data("number"));
//loadErrRecTable();
loadErr($(oriEle).data("number")); loadErr($(oriEle).data("number"));
$(tooltipEle).find("#info").html(typeof drawInfoTabBlo != "undefined" ? drawInfoTabBlo(devGuid) : ""); $(tooltipEle).find("#info").html(typeof drawInfoTabBlo != "undefined" ? drawInfoTabBlo(devGuid) : "");
if ($(oriEle).data("dbId")) { if ($(oriEle).data("dbId")) {
controlFocusHotspot($(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")) : "" typeof subDeviceSetTable != "undefined" ? subDeviceSetTable($(oriEle).data("number")) : ""
}, },
onHide: function (tooltipEle, oriEle) { onHide: function (tooltipEle, oriEle) {
@ -1220,7 +1237,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
} }
function controlFocusHotspot(dbId, open = true) { function controlFocusHotspot(dbId, open = true) {
changeColorForHotspot(dbId, open); changeColorForHotspot(dbId, open ? "focus" : null);
changeScaleForHotspot(dbId, open); changeScaleForHotspot(dbId, open);
} }
@ -1467,13 +1484,6 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
}, null, "POST").send(); }, null, "POST").send();
} }
function getLogo() {
url = baseApiUrl + '/api/GetLogo',
ytAjax = new YourTeam.Ajax(url, null, function (res) {
$('[name=webLogo]').attr('src', 'img/' + res.data);
}, null, "POST").send();
}
function getUserInfo() { function getUserInfo() {
let url = baseApiUrl + varApiUrl + "getUserFull"; let url = baseApiUrl + varApiUrl + "getUserFull";

View File

@ -15,7 +15,11 @@ function launchViewer(urn, callback,failCallback, _selector = "#forgeViewer") {
selector = _selector; selector = _selector;
var options = { var options = {
env: 'AutodeskProduction', env: 'AutodeskProduction',
getAccessToken: getForgeToken getAccessToken: getForgeToken,
settings: {
ambientShadows: false,
groundShadows: false
}
}; };
Autodesk.Viewing.Initializer(options, () => { Autodesk.Viewing.Initializer(options, () => {
@ -25,6 +29,7 @@ function launchViewer(urn, callback,failCallback, _selector = "#forgeViewer") {
var documentId = 'urn:' + urn; var documentId = 'urn:' + urn;
Autodesk.Viewing.Document.load(documentId, onDocumentLoadSuccess, onDocumentLoadFailure); Autodesk.Viewing.Document.load(documentId, onDocumentLoadSuccess, onDocumentLoadFailure);
setShadowShow();
$(selector).on("autodesk:loaded", function (e, nodeIds) { $(selector).on("autodesk:loaded", function (e, nodeIds) {
callback ? callback(viewer, nodeIds) : ""; callback ? callback(viewer, nodeIds) : "";
@ -65,7 +70,11 @@ function launchViewerForHotspot(urn, callback, failCallback, _selector = "#forge
var av = Autodesk.Viewing; var av = Autodesk.Viewing;
var options = { var options = {
env: 'AutodeskProduction', env: 'AutodeskProduction',
getAccessToken: getForgeToken getAccessToken: getForgeToken,
settings: {
ambientShadows: false,
groundShadows: false
}
}; };
Autodesk.Viewing.Initializer(options, () => { Autodesk.Viewing.Initializer(options, () => {
@ -78,9 +87,10 @@ function launchViewerForHotspot(urn, callback, failCallback, _selector = "#forge
}); });
Autodesk.Viewing.Document.load(documentId, onDocumentLoadSuccess, onDocumentLoadFailure); Autodesk.Viewing.Document.load(documentId, onDocumentLoadSuccess, onDocumentLoadFailure);
setShadowShow();
$(selector).on("autodesk:loaded", function (e, nodeIds) { $(selector).on("autodesk:loaded", function (e, nodeIds) {
callback ? callback(viewer, nodeIds) : ""; callback ? callback(viewer, nodeIds) : "";
console.log(viewer.get)
}) })
$(selector).on("autodesk:loaded:fail", function (e) { $(selector).on("autodesk:loaded:fail", function (e) {
@ -93,7 +103,11 @@ function launchViewerNoTools(urn, callback, failCallback, _selector = "#forgeVie
selector = _selector; selector = _selector;
var options = { var options = {
env: 'AutodeskProduction', env: 'AutodeskProduction',
getAccessToken: getForgeToken getAccessToken: getForgeToken,
settings: {
ambientShadows: false,
groundShadows: false
}
}; };
Autodesk.Viewing.Initializer(options, () => { Autodesk.Viewing.Initializer(options, () => {
@ -103,7 +117,7 @@ function launchViewerNoTools(urn, callback, failCallback, _selector = "#forgeVie
var documentId = 'urn:' + urn; var documentId = 'urn:' + urn;
Autodesk.Viewing.Document.load(documentId, onDocumentLoadSuccess, onDocumentLoadFailure); Autodesk.Viewing.Document.load(documentId, onDocumentLoadSuccess, onDocumentLoadFailure);
setShadowShow();
$(selector).on("autodesk:loaded", function (e, nodeIds) { $(selector).on("autodesk:loaded", function (e, nodeIds) {
callback ? callback(viewer, nodeIds) : ""; callback ? callback(viewer, nodeIds) : "";
}) })
@ -632,10 +646,14 @@ class ADHeatMaps {
} }
//全部物件 透明度: 輸入0:透明輸入1:不透明 //全部物件 透明度: 輸入0:透明輸入1:不透明
function setTransparentBuilding(transparent) { function setTransparentBuilding(transparent, filDbids = []) {
for (var i = 0; i < allDbIdsStr.length; i++) { for (var i = 0; i < allDbIdsStr.length; i++) {
setTransparency(parseInt(allDbIdsStr[i]), transparent); setTransparency(parseInt(allDbIdsStr[i]), transparent);
} }
for (var i = 0; i < filDbids.length; i++) {
setTransparency(parseInt(filDbids[i]), transparent == 0 ? 1 : 0);
}
} }
//設定模型 透明度 //設定模型 透明度
@ -646,7 +664,11 @@ function setTransparency(nodeId, opacity) {
model.getData().instanceTree.enumNodeFragments( model.getData().instanceTree.enumNodeFragments(
nodeId, (fragId) => { nodeId, (fragId) => {
// 將遍歷到的片段 ID 添加到結果陣列中
fragIds.push(fragId) fragIds.push(fragId)
}, (nodeId) => {
// 如果遍歷到的節點是葉節點,则返回 true表示繼續遍歷該節點的片段
return model.getData().instanceTree.isLeaf(nodeId);
}); });
fragIds.forEach((fragId) => { fragIds.forEach((fragId) => {
@ -666,12 +688,34 @@ function setTransparency(nodeId, opacity) {
viewer.impl.invalidate(true, true, true); 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; 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) { instanceTree.enumNodeChildren(nodeId, function (chiNodeId) {
var color = new THREE.Vector4(0, 1, 0, 1);
viewer.setThemingColor(chiNodeId, color); viewer.setThemingColor(chiNodeId, color);
}, true) }, (chiNodeId) => {
// 如果遍歷到的節點是葉節點,则返回 true表示繼續遍歷該節點的片段
return model.getData().instanceTree.isLeaf(chiNodeId);
})
} }
function hideColor(nodeId) {//顏色改成透明 function hideColor(nodeId) {//顏色改成透明
@ -744,11 +788,11 @@ async function addHotPoint(data) {
function onSpriteClicked(event) { function onSpriteClicked(event) {
event.hasStopped = true; event.hasStopped = true;
if (event != undefined && event != null) { 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}`); console.log(`Sprite clicked: ${event.dbId}`);
openHotspotModal(); openHotspotModal();
for (let i = dbIdStart; i <= dbIdEnd; i++) { for (let i = dbIdStart; i <= myDataList.length + 10; i++) {
changeColorForHotspot(i, false); changeColorForHotspot(i);
changeScaleForHotspot(i, false); changeScaleForHotspot(i, false);
} }
let myData = myDataList.filter(x => x._dbId == event.dbId)[0]; let myData = myDataList.filter(x => x._dbId == event.dbId)[0];
@ -786,11 +830,13 @@ async function addHotPoint(data) {
} }
// 熱點 更換顏色 // 熱點 更換顏色
async function changeColorForHotspot(dbId, type = true) { async function changeColorForHotspot(dbId, type = null) {
const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization"); const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization");
let spriteColorFocus = new THREE.Color(0x00ffe1); let spriteColorFocus = new THREE.Color(0xffffff);
if (!type) { if (type == "focus") {
spriteColorFocus = new THREE.Color(0xffffff); spriteColorFocus = new THREE.Color(0x00ffe1);
} else if (type == "error") {
spriteColorFocus = new THREE.Color(0xff0000);
} }
const viewablesToUpdate = dbId; const viewablesToUpdate = dbId;
dataVizExtn.invalidateViewables(viewablesToUpdate, (viewable) => { dataVizExtn.invalidateViewables(viewablesToUpdate, (viewable) => {
@ -1101,7 +1147,7 @@ function changeColorTransparency(nodeId, color) {//變綠色
viewer.setThemingColor(nodeId, color); viewer.setThemingColor(nodeId, color);
} }
//隱藏全物件 (篩選 dbids 除外) //隱藏全物件
function hideAllObjects(filDbids = []) { function hideAllObjects(filDbids = []) {
//viewer.hide(4);//只針對一個物件(dbid為4)做隱藏 //viewer.hide(4);//只針對一個物件(dbid為4)做隱藏
for (var i = 0; i < allDbIdsStr.length; i++) { for (var i = 0; i < allDbIdsStr.length; i++) {
@ -1136,4 +1182,10 @@ async function toLoadHeatmap(roomArr) {
const model = viewer.model; const model = viewer.model;
loadHeatmaps(model, roomArr); loadHeatmaps(model, roomArr);
} }
function setShadowShow(type = false) {
viewer.setGroundShadow(type);
viewer.impl.sceneUpdated(true);
}
//============================= end =================================== //============================= end ===================================

View File

@ -83,7 +83,7 @@ class YourTeamNavbar {
} }
initClose = function () { initClose = function () {
debugger
let width = $(this.element)[0].offsetWidth; let width = $(this.element)[0].offsetWidth;
if (this.type == "left") { if (this.type == "left") {
$(this.element).css("left", 0 - width); $(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>( 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, @$"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.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 -- 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 from role_auth a
@ -100,6 +102,15 @@ namespace FrontendWebApi.ApiControllers
history_Sub_System.device_normal_flashing = sub.device_normal_flashing; history_Sub_System.device_normal_flashing = sub.device_normal_flashing;
history_Sub_System.device_close_flashing = sub.device_close_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_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); history_Main_System.History_Sub_systems.Add(history_Sub_System);
} }
@ -792,8 +803,8 @@ namespace FrontendWebApi.ApiControllers
/// <param name="account"></param> /// <param name="account"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
[Route("api/Device/GetForgeNodeName")] [Route("api/Device/GetForgeNodeIdFromVar")]
public async Task<ActionResult<List<Variable>>> GetForgeNodeName([FromBody] string forgeNodeKey) public async Task<ActionResult<List<Variable>>> GetForgeNodeIdFromVar([FromBody] string forgeNodeKey)
{ {
ApiResult<List<Variable>> apiResult = new ApiResult<List<Variable>>(); ApiResult<List<Variable>> apiResult = new ApiResult<List<Variable>>();
List<Variable> variable = new List<Variable>(); List<Variable> variable = new List<Variable>();

View File

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

View File

@ -65,6 +65,15 @@ namespace FrontendWebApi.Models
public string device_normal_color { get; set; } public string device_normal_color { get; set; }
public string device_close_color { get; set; } public string device_close_color { get; set; }
public string device_error_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_name { get; set; }
public string device_item_points { get; set; } public string device_item_points { get; set; }
public string device_item_unit { 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_normal_flashing { get; set; }
public string device_close_flashing { get; set; } public string device_close_flashing { get; set; }
public string device_error_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 string auth_code { get; set; }
} }
public class History_PostDevice public class History_PostDevice