[前台] 系統監控-照明系統 取消溫度顯示 | 能源管理介面更新 | 首頁 系統類別 icon 修正 | 告警頁面 時間顯示修正 | 帳號管理 文字修正 | forgemodel 電梯移動速度加快
@ -252,8 +252,10 @@
|
||||
/* launchViewer("dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dGEzaHFzZmZ6cWJub3V4a3BsZGt1a3NldzRzajIxdzUtYmltc19tb2RlbHMvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDJUU5JTlCJTk5JUU2JUE4JUExJUU1JUJDJThGK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8wMTE2Lm53ZA")*/
|
||||
|
||||
/*新增軌道燈軌道*/
|
||||
launchViewer("dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dGEzaHFzZmZ6cWJub3V4a3BsZGt1a3NldzRzajIxdzUtYmltc19tb2RlbHMvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDJUU5JTlCJTk5JUU2JUE4JUExJUU1JUJDJThGK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8wMTE5Lm53ZA")
|
||||
/*launchViewer("dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dGEzaHFzZmZ6cWJub3V4a3BsZGt1a3NldzRzajIxdzUtYmltc19tb2RlbHMvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDJUU5JTlCJTk5JUU2JUE4JUExJUU1JUJDJThGK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8wMTE5Lm53ZA")*/
|
||||
|
||||
/* 0201 更換好電梯順序 */
|
||||
launchViewer("dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dGEzaHFzZmZ6cWJub3V4a3BsZGt1a3NldzRzajIxdzUtYmltc19tb2RlbHMvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDJUU5JTlCJTk5JUU2JUE4JUExJUU1JUJDJThGK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8wMjAxLm53ZA")
|
||||
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlFX2ZvcmdlX3Rlc3QvJUUzJFTgwJTkwQVJDJUUzJTgwJTkxXzIwMjJfMTJfMTMubndk');//new ARC
|
||||
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwTUVQJUUzJTgwJTkxXzIwMjJfMTJfMTMubndj');//new MEP
|
||||
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwQVJDJUUzJTgwJTkxJUU1JTg1JUE4JUU2JUEzJTlGXzIwMjJfMTJfMTMubndj');//全棟 ARC
|
||||
|
1
Frontend/SVG/air-flow_white.svg
Normal file
After Width: | Height: | Size: 28 KiB |
1
Frontend/SVG/control-panel_white.svg
Normal file
After Width: | Height: | Size: 24 KiB |
1
Frontend/SVG/creative_white.svg
Normal file
After Width: | Height: | Size: 20 KiB |
1
Frontend/SVG/electric-meter_white.svg
Normal file
After Width: | Height: | Size: 42 KiB |
1
Frontend/SVG/electricity_white.svg
Normal file
After Width: | Height: | Size: 13 KiB |
1
Frontend/SVG/fire-hydrant_white.svg
Normal file
After Width: | Height: | Size: 12 KiB |
1
Frontend/SVG/fuse-box_white.svg
Normal file
After Width: | Height: | Size: 18 KiB |
1
Frontend/SVG/gear_white.svg
Normal file
After Width: | Height: | Size: 49 KiB |
1
Frontend/SVG/generator_white.svg
Normal file
After Width: | Height: | Size: 22 KiB |
1
Frontend/SVG/ice-crystal_white.svg
Normal file
After Width: | Height: | Size: 29 KiB |
1
Frontend/SVG/key-card_white.svg
Normal file
After Width: | Height: | Size: 19 KiB |
1
Frontend/SVG/lamp_white.svg
Normal file
After Width: | Height: | Size: 15 KiB |
1
Frontend/SVG/leaf_white.svg
Normal file
After Width: | Height: | Size: 22 KiB |
1
Frontend/SVG/lift-sign_white.svg
Normal file
After Width: | Height: | Size: 23 KiB |
1
Frontend/SVG/parking_gray.svg
Normal file
After Width: | Height: | Size: 18 KiB |
1
Frontend/SVG/parking_white.svg
Normal file
After Width: | Height: | Size: 18 KiB |
1
Frontend/SVG/power-meter_white.svg
Normal file
After Width: | Height: | Size: 34 KiB |
1
Frontend/SVG/security-camera_white.svg
Normal file
After Width: | Height: | Size: 30 KiB |
1
Frontend/SVG/solar-panel_white.svg
Normal file
After Width: | Height: | Size: 31 KiB |
1
Frontend/SVG/sos_white.svg
Normal file
After Width: | Height: | Size: 40 KiB |
1
Frontend/SVG/water-pollution_white.svg
Normal file
After Width: | Height: | Size: 28 KiB |
@ -10,11 +10,11 @@
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#tab_borders_icons-2"
|
||||
role="tab"><i class="fal fa-users mr-1"></i> 群組管理</a>
|
||||
role="tab"><i class="fal fa-users mr-1"></i> 角色管理</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#tab_borders_icons-3"
|
||||
role="tab"><i class="fal fa-cog mr-1"></i> 群組權限</a>
|
||||
role="tab"><i class="fal fa-cog mr-1"></i> 角色權限</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content border border-top-0 p-3 w-100">
|
||||
|
@ -631,7 +631,7 @@
|
||||
}
|
||||
|
||||
function callBackFromOneDeviceAlert(res) {
|
||||
res = JSON.parse(res);
|
||||
//res = JSON.parse(res);
|
||||
refTable(res.data);
|
||||
if (historyTable != null) {
|
||||
let t = $('#alertTable').dataTable();
|
||||
@ -673,7 +673,7 @@
|
||||
"title": "發生時間",
|
||||
"data": "timestamp",
|
||||
"render": function (data) {
|
||||
return displayDate(data, "datetime");
|
||||
return new Date(data).toLocaleString('zh-tw', { year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit" }), displayDate(data, "datetime");
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -227,42 +227,54 @@
|
||||
var chartDataCnt = { alarmCnt: 0, recCnt: 0, chkedErrCnt: 0, unChkedErrCnt: 0 };
|
||||
|
||||
var sysIconList = [
|
||||
{ mainSys: "EE", subSys: "E1", iconClass: "fal fa-grip-vertical" },
|
||||
{ mainSys: "EE", subSys: "E2", iconClass: "fal fa-grip-horizontal" },
|
||||
{ mainSys: "EE", subSys: "E3", iconClass: "fal fa-bolt" },
|
||||
{ mainSys: "EE", subSys: "E4", iconClass: "fal fa-car-battery" },
|
||||
{ mainSys: "LT", subSys: "L1", iconClass: "fal fa-lightbulb-on" },
|
||||
{ mainSys: "ME", subSys: "M10", iconClass: "fal fa-wind" },
|
||||
{ mainSys: "ME", subSys: "M12", iconClass: "fal fa-snowflake" },
|
||||
{ mainSys: "ELEV", subSys: "EL", iconClass: "fal fa-door-open" },
|
||||
{ mainSys: "FE", subSys: "F1", iconClass: "fal fa-fire-extinguisher" },
|
||||
{ mainSys: "FE", subSys: "F2", iconClass: "fal fa-smog" },
|
||||
{ mainSys: "WP", subSys: "W1", iconClass: "fal fa-stopwatch" },
|
||||
{ mainSys: "S", subSys: "R", iconClass: "fal fa-user-shield" },
|
||||
{ mainSys: "LT", subSys: "L2", iconClass: "fal fa-sun"},
|
||||
{ mainSys: "ME", subSys: "M1", iconClass: "fal fa-icicles"},
|
||||
{ mainSys: "ME", subSys: "M8", iconClass: "fal fa-bong"},
|
||||
{ mainSys: "W3", subSys: "W1", iconClass: "fal fa-tint"},
|
||||
{ mainSys: "EE", subSys: "E1", iconClass: "SVG/fuse-box_white.svg" },
|
||||
{ mainSys: "EE", subSys: "E2", iconClass: "SVG/electricity_white.svg" },
|
||||
{ mainSys: "EE", subSys: "E3", iconClass: "SVG/generator_white.svg" },
|
||||
{ mainSys: "EE", subSys: "E4", iconClass: "SVG/electric-meter_white.svg" }, // 電表
|
||||
{ mainSys: "LT", subSys: "L1", iconClass: "SVG/creative_white.svg" },
|
||||
{ mainSys: "ME", subSys: "M5", iconClass: "SVG/air-flow_white.svg" }, // 送排風
|
||||
{ mainSys: "ME", subSys: "M10", iconClass: "SVG/ice-crystal_white.svg" },
|
||||
{ mainSys: "ME", subSys: "M12", iconClass: "SVG/leaf_white.svg" },
|
||||
{ mainSys: "ELEV", subSys: "EL", iconClass: "SVG/lift-sign_white.svg" },
|
||||
{ mainSys: "FE", subSys: "F1", iconClass: "SVG/fire-hydrant_white.svg" },
|
||||
{ mainSys: "FE", subSys: "F2", iconClass: "SVG/lamp_white.svg" },// 排煙 0131目前沒有
|
||||
{ mainSys: "WP", subSys: "W1", iconClass: "SVG/lamp_white.svg" },// 電子水表0131目前沒有
|
||||
{ mainSys: "WP", subSys: "W2", iconClass: "SVG/gear_white.svg" },
|
||||
{ mainSys: "WP", subSys: "P1", iconClass: "SVG/water-pollution_white.svg" },
|
||||
{ mainSys: "S", subSys: "C", iconClass: "SVG/security-camera_white.svg" }, // CCTV
|
||||
{ mainSys: "S", subSys: "P", iconClass: "SVG/sos_white.svg" }, // 緊急求救
|
||||
{ mainSys: "S", subSys: "R", iconClass: "SVG/key-card_white.svg" }, // 門禁
|
||||
{ mainSys: "P", subSys: "PSC", iconClass: "SVG/parking_white.svg" }, // 停管
|
||||
{ mainSys: "LT", subSys: "L2", iconClass: "SVG/lamp_white.svg" },// 景觀照明 0131目前沒有
|
||||
{ mainSys: "ME", subSys: "M1", iconClass: "SVG/lamp_white.svg" },// 儲冰 0131目前沒有
|
||||
{ mainSys: "ME", subSys: "M8", iconClass: "SVG/lamp_white.svg" },// 排油煙0131目前沒有
|
||||
{ mainSys: "W3", subSys: "W1", iconClass: "SVG/lamp_white.svg" },// 0131目前沒有
|
||||
|
||||
];
|
||||
|
||||
var tempSysSubText = [
|
||||
{ text: "高壓配電盤", mainSys: "EE", subSys: "E1", },
|
||||
{ text: "低壓配電盤", mainSys: "EE", subSys: "E2", },
|
||||
{ text: "緊急發電機", mainSys: "EE", subSys: "E3", },
|
||||
{ text: "電錶系統", mainSys: "EE", subSys: "E4", },
|
||||
{ text: "二線式照明系統", mainSys: "LT", subSys: "L1", },
|
||||
{ text: "景觀照明系統", mainSys: "LT", subSys: "L2", },
|
||||
{ text: "儲冰系統", mainSys: "ME", subSys: "M1", },
|
||||
{ text: "小型送風機", mainSys: "ME", subSys: "M10", },
|
||||
{ text: "排油煙設備", mainSys: "ME", subSys: "M8", },
|
||||
{ text: "環境感測設備", mainSys: "ME", subSys: "M12", },
|
||||
{ text: "電梯設備", mainSys: "ELEV", subSys: "EL", },
|
||||
{ text: "消防設備", mainSys: "FE", subSys: "F1", },
|
||||
{ text: "排煙系統", mainSys: "FE", subSys: "F2", },
|
||||
{ text: "電子水錶", mainSys: "WP", subSys: "W1", },
|
||||
{ text: "熱水系統", mainSys: "W3", subSys: "W1", },
|
||||
{ text: "門禁安全系統", mainSys: "S", subSys: "R", }
|
||||
{ text: "電梯系統", mainSys: "ELEV", subSys: "EL", }, // 1
|
||||
{ text: "空調系統", mainSys: "ME", subSys: "M10", }, // 2
|
||||
{ text: "照明系統", mainSys: "LT", subSys: "L1", }, // 3
|
||||
{ text: "環境感測設備", mainSys: "ME", subSys: "M12", }, // 4
|
||||
{ text: "電錶系統", mainSys: "EE", subSys: "E4", }, // 5
|
||||
{ text: "供水系統", mainSys: "WP", subSys: "W2", }, // 6
|
||||
{ text: "高壓配電盤", mainSys: "EE", subSys: "E1", }, // 7
|
||||
{ text: "汙廢水設備", mainSys: "WP", subSys: "P1", }, // 8
|
||||
{ text: "低壓配電盤", mainSys: "EE", subSys: "E2", }, //9
|
||||
{ text: "緊急發電機", mainSys: "EE", subSys: "E3", },//10
|
||||
{ text: "消防設備", mainSys: "FE", subSys: "F1", }, //11
|
||||
{ text: "CCTV系統", mainSys: "S", subSys: "C", }, //12
|
||||
{ text: "緊急求救系統", mainSys: "S", subSys: "P", }, //13
|
||||
{ text: "門禁系統", mainSys: "S", subSys: "R", }, //14
|
||||
{ text: "停管系統", mainSys: "P", subSys: "PSC", }, //15
|
||||
{ text: "送排風系統", mainSys: "ME", subSys: "M5", }, // 2 //16
|
||||
//{ text: "景觀照明系統", mainSys: "LT", subSys: "L2", },
|
||||
//{ text: "儲冰系統", mainSys: "ME", subSys: "M1", },
|
||||
//{ text: "排油煙設備", mainSys: "ME", subSys: "M8", },
|
||||
//{ text: "排煙系統", mainSys: "FE", subSys: "F2", },
|
||||
//{ text: "電子水錶", mainSys: "WP", subSys: "W1", },
|
||||
//{ text: "熱水系統", mainSys: "W3", subSys: "W1", },
|
||||
];
|
||||
|
||||
$(document).ready(function () {
|
||||
@ -282,7 +294,7 @@
|
||||
if (isExiNames.indexOf(obj.text) == -1 && $("#sysSubBtnList .dev-group").length < 16) {
|
||||
let iconObj = sysIconList.filter(x => x.mainSys == obj.mainSys && x.subSys == obj.subSys)[0];
|
||||
strHtml = `<div class="btn-group btn-group-lg col-lg-3 mb-4 dev-group">
|
||||
<button name="topFunBtn" data-page="alert" type="button" class="btn btn-secondary col-4"><i class="${iconObj.iconClass || "fal fa-hdd"} fa-2x py-2"></i></button>
|
||||
<button name="topFunBtn" data-page="alert" type="button" class="btn btn-secondary col-4"><img src="${iconObj.iconClass}" class="w-100"></img></button>
|
||||
<button id="sysSubCardBtn${obj.subSys}" type="button" class="btn btn-secondary" data-id="${obj.subSys}">${obj.text}</button>
|
||||
</div>`;
|
||||
$("#sysSubBtnList").append(strHtml);
|
||||
@ -311,7 +323,7 @@
|
||||
}
|
||||
let iconClass = sysIconList.filter(x => x.mainSys == mainSysObj.main_system_tag && x.subSys == subSysObj.sub_system_tag)[0]?.iconClass;
|
||||
strHtml += `<div class="btn-group btn-group-lg col-lg-3 mb-4 dev-group" data-id="/${pageAct.AreaTag}/${pageAct.buiTag}/${mainSysObj.main_system_tag}/${subSysObj.sub_system_tag}">
|
||||
<button name="topFunBtn" data-page="alert" type="button" class="btn btn-secondary col-4"><i class="${iconClass || "fal fa-hdd"} fa-2x py-2"></i></button>
|
||||
<button name="topFunBtn" data-page="alert" type="button" class="btn btn-secondary col-4"><img src="${iconClass}" class="w-100"></img></button>
|
||||
<button id="sysSubCardBtn${subSysObj.sub_system_tag}" type="button" class="btn btn-secondary" data-id="${subSysObj.sub_system_tag}">${subSysObj.full_name}</button>
|
||||
</div>`;
|
||||
})
|
||||
@ -438,7 +450,6 @@
|
||||
|
||||
// 圖表 - 今天與昨天用電量 (長條圖)
|
||||
function chartEveDaysElec(todayData, yesData) {
|
||||
|
||||
let eveDayElecChartCanvas = $('#eveDayElecChart').get(0).getContext('2d');
|
||||
let curHour = (new Date()).getHours();
|
||||
todayData.data = todayData.filter(x => x.timestamp.$time.$hour < curHour);
|
||||
@ -525,7 +536,6 @@
|
||||
|
||||
// 圖表 - 這週與上週用電量 (長條圖)
|
||||
function chartEveWeeksElec(curWeekData, prevWeekData) {
|
||||
|
||||
let eveWeekElecChartCanvas = $('#eveWeekElecChart').get(0).getContext('2d');
|
||||
let eveWeekElecChartData = {
|
||||
labels: curWeekData.map(x => dayToChiDay(strToDate(x.timestamp.$cEncStr, "day"))),
|
||||
@ -556,7 +566,7 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
console.log(eveWeekElecChartData)
|
||||
let eveWeekElecChartOptions = {
|
||||
maintainAspectRatio: false,
|
||||
responsive: true,
|
||||
@ -582,13 +592,12 @@
|
||||
return isTodayOrYes + "用電量 : " + tooltipItem.value + " kWH";
|
||||
},
|
||||
title: function (tooltipItem) {
|
||||
let result = tooltipItem[0].xLabel.toString();
|
||||
let result = tooltipItem[0]?.xLabel.toString();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
console.log(eveWeekElecChartData)
|
||||
if (eveWeekElecChart == null) {
|
||||
eveWeekElecChart = new Chart(eveWeekElecChartCanvas, {
|
||||
data: eveWeekElecChartData,
|
||||
@ -739,8 +748,8 @@
|
||||
|
||||
// 圖表 - 工單已完成與工單未完成 (圓環圖)
|
||||
function chartWorOrdFin(labels, datas) {
|
||||
labels = ["工單已完成","工單未完成"]
|
||||
datas = [5,9]
|
||||
labels = ["工單已完成", "工單未完成"]
|
||||
datas = [5, 9]
|
||||
let worOrdFinChartCanvas = ctx = $('#worOrdFinChart').get(0).getContext('2d');
|
||||
|
||||
let worOrdFinChartData = {
|
||||
|
@ -48,31 +48,32 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="elecAutoReq" class="row flex-column col-xl-6 m-0 p-0">
|
||||
<div id="elecAutoDem" class="row flex-column col-xl-6 m-0 p-0">
|
||||
<div class="col-auto mb-2">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<h4 class="mb-0"><i class="fal fa-server"></i> 自動需量管理</h4>
|
||||
<a href="#" class="btn btn-success"><i class="fal fa-pencil"></i> Edit</a>
|
||||
|
||||
<button id="ediAutDemBtn" class="btn btn-success"><i class="fal fa-pencil"></i> 編輯</button>
|
||||
</div>
|
||||
<div class="row align-items-center">
|
||||
<div class="col-sm-12 col-lg-5">
|
||||
<p class="card-text color-white pl-5 pr-3 d-flex justify-content-between">
|
||||
<span>契約容量</span>
|
||||
<span>1000 kW</span>
|
||||
<span><span data-id="contract_capacity"></span> kW</span>
|
||||
</p>
|
||||
<p class="card-text color-white pl-5 pr-3 d-flex justify-content-between">
|
||||
<span>警戒容量</span>
|
||||
<span>800 kW</span>
|
||||
<span><span data-id="warning_capacity"></span> kW</span>
|
||||
</p>
|
||||
<p class="card-text color-white pl-5 pr-3 d-flex justify-content-between">
|
||||
<span>復歸值</span>
|
||||
<span>600 kW</span>
|
||||
<span><span data-id="resetting_value"></span> kW</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-sm-12 col-lg-7">
|
||||
<img src="img/clouds.png" class="img-fluid" style="min-height: 220px;">
|
||||
<div class="col-sm-12 col-lg-7" style=" min-height:250px;">
|
||||
<canvas class="chart" id="autDemChart"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -192,7 +193,50 @@
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Modal center Add -->
|
||||
<div class="modal fade" id="autDemModal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">
|
||||
編輯自動需量
|
||||
</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true"><i class="fal fa-times"></i></span>
|
||||
</button>
|
||||
</div>
|
||||
<form id="autDemForm">
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group mb-2">
|
||||
<label class="form-label" for="txtConCap">契約容量</label>
|
||||
<input type="text" id="txtConCap" name="txtConCap" class="form-control" data-id="contract_capacity">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="form-group mb-2">
|
||||
<label class="form-label" for="txtWarCap">警戒容量</label>
|
||||
<input type="text" id="txtWarCap" name="txtWarCap" class="form-control" data-id="warning_capacity">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="form-group mb-2">
|
||||
<label class="form-label" for="txtResCap">復歸值</label>
|
||||
<input type="text" id="txtResCap" name="txtResCap" class="form-control" data-id="resetting_value">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">關閉</button>
|
||||
<button type="button" class="btn btn-primary" id="autDemSavBtn">儲存</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@ -201,13 +245,16 @@
|
||||
<script>
|
||||
var subSysList = [];
|
||||
var subSysElecList = [];
|
||||
var powerTimeVals = [];
|
||||
var todayElecChart = null;
|
||||
var elecCompChart = null;
|
||||
var elecCardConText = [{ text1: "即時功耗 kW", text2:"佔比 %"},{ text1: "即時功耗 kW", text2:"佔比 %"},{ text1: "即時功耗 kW", text2:"佔比 %"},{ text1: "即時發電功率 kW", text2:"供電佔比 %"}]
|
||||
|
||||
var autDemChart = null;
|
||||
var elecCardConText = [{ text1: "即時功耗 kW", text2: "佔比 %" }, { text1: "即時功耗 kW", text2: "佔比 %" }, { text1: "即時功耗 kW", text2: "佔比 %" }, { text1: "即時發電功率 kW", text2: "供電佔比 %" }]
|
||||
var filNotShowSysSub = ["E1", "E4"];
|
||||
$(function () {
|
||||
getSubSysList();
|
||||
getElecBySubSysTag();
|
||||
getAutDemVal();
|
||||
})
|
||||
|
||||
// 左上方 系統小類卡片區塊
|
||||
@ -226,7 +273,7 @@
|
||||
$.each(res.data.history_Main_Systems, (index, mainSysObj) => {
|
||||
$.each(mainSysObj.history_Sub_systems, (index2, subSysObj) => {
|
||||
subSysList.push(subSysObj);
|
||||
if (type == 0 || (type == 3 && mainSysObj.main_system_tag == "ELEV")) {
|
||||
if ((type == 0 || (type == 3 && mainSysObj.main_system_tag == "ELEV")) && filNotShowSysSub.indexOf(subSysObj.sub_system_tag) == -1) {
|
||||
strHtml += `<div class="col-sm-12 col-xl-4 mb-2">
|
||||
<div class="card elecCard cur-poi" data-id="${mainSysObj.main_system_tag}_${subSysObj.sub_system_tag}" data-name="${subSysObj.full_name}">
|
||||
<div class="card-body">
|
||||
@ -262,6 +309,7 @@
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
console.log(strHtml)
|
||||
$("#eneSubSysList").html(strHtml);
|
||||
}
|
||||
}, null, "POST").send();
|
||||
@ -269,7 +317,7 @@
|
||||
}
|
||||
|
||||
// 取得 對應系統小類的總電錶
|
||||
function getElecBySubSysTag() {
|
||||
function getElecBySubSysTag(type = 0) {
|
||||
let url = baseApiUrl + "/api/Energe/GetElecBySubSysTag";
|
||||
|
||||
ytAjax = new YourTeam.Ajax(url, null, function (res) {
|
||||
@ -277,13 +325,78 @@
|
||||
|
||||
} else {
|
||||
subSysElecList = res.data;
|
||||
getBajaData();
|
||||
tarElePath = subSysElecList.filter(x => x.mainSubTag == "total")[0]?.system_device_tag ?? "";
|
||||
getBajaData(type);
|
||||
getSubBaja();
|
||||
}
|
||||
}, null, "POST").send();
|
||||
}
|
||||
|
||||
function getSubBaja() {
|
||||
let devPath = tarElePath.split("_").slice(0, 8).join("/");
|
||||
let tempOrdPath = { devicePath: devPath }
|
||||
let myBaja = new subscriptionElectricmeter();
|
||||
myBaja.setSubscribeElectricmeterByBql(tempOrdPath);
|
||||
myBaja.setSubscribeElectricmeterCallBack(function (data) {
|
||||
if (data.point_name == "P") {
|
||||
let value = parseFloat(data.value).roundDecimal(2);
|
||||
let time = new Date();
|
||||
if (!autDemChart) {
|
||||
return;
|
||||
}
|
||||
|
||||
let conCapVal = autDemChart.data.datasets[0].data[0];
|
||||
let warCapVal = autDemChart.data.datasets[1].data[0];
|
||||
let resCapVal = autDemChart.data.datasets[2].data[0];
|
||||
|
||||
if (autDemChart.data.labels.length > 0) {
|
||||
// 當 label 還未補齊,則直接替換 array 裡的值,已補齊之後就從後面補值
|
||||
if (autDemChart.data.labels.filter(x => x != "").length > 10) {
|
||||
autDemChart.data.labels.push(displayDate(time, "Hms"));
|
||||
} else {
|
||||
let cnt = autDemChart.data.labels.filter(x => x != "").length;
|
||||
autDemChart.data.labels[cnt] = displayDate(time, "Hms");
|
||||
}
|
||||
autDemChart.data.datasets[0].data.push(parseInt(conCapVal));
|
||||
autDemChart.data.datasets[1].data.push(parseInt(warCapVal));
|
||||
autDemChart.data.datasets[2].data.push(resCapVal);
|
||||
autDemChart.data.datasets[3].data.push(value);
|
||||
}
|
||||
|
||||
if (autDemChart.data.labels.filter(x => x != "").length > 10) {
|
||||
autDemChart.data.labels.shift();
|
||||
autDemChart.data.datasets[0].data.shift();
|
||||
autDemChart.data.datasets[1].data.shift();
|
||||
autDemChart.data.datasets[2].data.shift();
|
||||
autDemChart.data.datasets[3].data.shift();
|
||||
}
|
||||
autDemChart.update();
|
||||
/*autDemChart.update();*/
|
||||
|
||||
}
|
||||
})
|
||||
myBaja.setSubscribeElectricmeterEndCallBack(function (data) {
|
||||
let time = new Date();
|
||||
|
||||
for (let d of data) {
|
||||
if (d.point_name == "P") {
|
||||
if (autDemChart) {
|
||||
autDemChart.data.labels.push(displayDate(time, "Hms"));
|
||||
autDemChart.data.datasets[3].data.push(d.value);
|
||||
// 補齊空缺 最多10個
|
||||
for (let i = autDemChart.data.labels.length; i < 10; i++) {
|
||||
autDemChart.data.labels.push("");
|
||||
}
|
||||
|
||||
autDemChart.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 取得 baja 即時資料
|
||||
function getBajaData() {
|
||||
function getBajaData(type = 0) {
|
||||
startPageLoading();
|
||||
let yesterday = displayDate(getTimeByType(null, -1), "date").replaceAll("/", "-") + "T00:00:00";
|
||||
let tomorrow = displayDate(getTimeByType(null, 1), "date").replaceAll("/", "-") + "T00:00:00";
|
||||
@ -305,13 +418,25 @@
|
||||
}
|
||||
// 每個系統小類 即時功率
|
||||
$.each(subSysElecList, (idx, elecObj) => {
|
||||
let devPath = elecObj.system_device_tag?.split("_").slice(0, 8).join("/");
|
||||
let devPath
|
||||
devPath = elecObj.system_device_tag?.split("_").slice(0, 8).join("/");
|
||||
console.log(424, devPath)
|
||||
getElectricMeterNoweDataByBaja(devPath, (data) => {
|
||||
data = data.data;
|
||||
let result = data.filter(x => x.name == "P")[0]?.value;
|
||||
result = result ? result.roundDecimal(2) : 0;
|
||||
let result = 0;
|
||||
if (type == "3") {
|
||||
result = data.filter(x => x.name == "P_rec")[0]?.value?.roundDecimal(2);
|
||||
$(`#insPow${elecObj.mainSubTag}`).text(result);
|
||||
result = data.filter(x => x.name == "KWH_rec")[0]?.value?.roundDecimal(2);
|
||||
console.log(429, data, result)
|
||||
$(`#insPowPer${elecObj.mainSubTag}`).text((result / totalPow * 100).roundDecimal(2) + " %");
|
||||
} else {
|
||||
/* result = result ? result.roundDecimal(2) : 0;*/
|
||||
result = data.filter(x => x.name == "P")[0]?.value?.roundDecimal(2);
|
||||
$(`#insPow${elecObj.mainSubTag}`).text(result);
|
||||
$(`#insPowPer${elecObj.mainSubTag}`).text((result / totalPow * 100).roundDecimal(2) + " %");
|
||||
}
|
||||
|
||||
clearTimeout(lastTimeout);
|
||||
lastTimeout = setTimeout(() => {
|
||||
chkBajaLoaded();
|
||||
@ -330,7 +455,7 @@
|
||||
}
|
||||
})
|
||||
|
||||
onEvent("click", ".elecCard", function() {
|
||||
onEvent("click", ".elecCard", function () {
|
||||
let tarMainSubTag = $(this).data("id");
|
||||
|
||||
$("#actSubSysText").text($(this).data("name"));
|
||||
@ -347,14 +472,14 @@
|
||||
return;
|
||||
}
|
||||
|
||||
getElectricMeterHourDataByBaja(tarDevNum + "_KWH", "Mitsubishi_Sup", yesterday, tomorrow, (data) => {
|
||||
getElectricMeterHourDataByBaja(tarDevNum + "_KWH", n4Sup, yesterday, tomorrow, (data) => {
|
||||
let todayData = data.data.filter(x => x.timestamp.$date.$year == getTimeByType("year") && x.timestamp.$date.$month == getTimeByType("month") && x.timestamp.$date.$day == getTimeByType("date"));
|
||||
chartTodaysElec(todayData);
|
||||
chkBajaLoaded();
|
||||
})
|
||||
|
||||
// 空調系統 今日與30日內平均用電比較
|
||||
getElectricMeterDayDataByBaja(tarDevNum + "_KWH", "Mitsubishi_Sup", prevThirtyDay, tomorrow, (data) => {
|
||||
getElectricMeterDayDataByBaja(tarDevNum + "_KWH", n4Sup, prevThirtyDay, tomorrow, (data) => {
|
||||
let curDay = (new Date()).getDay() == 0 ? 7 : (new Date()).getDay();
|
||||
let eveWeek = [];
|
||||
let curWeekData = data.data.filter(x => strToDate(displayDate(new Date(), "date"), null, 0 - (curDay - 1)) <= strToDate(x.timestamp.$cEncStr));
|
||||
@ -381,6 +506,50 @@
|
||||
}
|
||||
}
|
||||
|
||||
// 取得 自動須量
|
||||
function getAutDemVal() {
|
||||
let url = baseApiUrl + "/api/Energe/GetAutDemVal";
|
||||
let sendData = {
|
||||
building_tag: pageAct.buiTag,
|
||||
};
|
||||
objSendData.Data = sendData;
|
||||
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
|
||||
if (!res || res.code != "0000" || !res.data) {
|
||||
|
||||
} else {
|
||||
let setKeyValue = {};
|
||||
$.each(res.data || [], (idx, data) => {
|
||||
$("#elecAutoDem").find(`[data-id=${data.system_key}]`).text(data.system_value || 0);
|
||||
setKeyValue[data.system_key] = data.system_value || 0;
|
||||
})
|
||||
|
||||
chartAutDem(setKeyValue["contract_capacity"], setKeyValue["warning_capacity"], setKeyValue["resetting_value"])
|
||||
}
|
||||
}, null, "POST").send();
|
||||
}
|
||||
|
||||
// 編輯 自動須量
|
||||
function ediAutDemVal(sucFn = null, errFn = null) {
|
||||
let url = baseApiUrl + "/api/Energe/EdiAutDemVal";
|
||||
let sendData = [];
|
||||
$("#autDemForm input").each((idx, inp) => {
|
||||
let main = {};
|
||||
main.system_key = $(inp).data("id");
|
||||
main.system_value = $(inp).val();
|
||||
sendData.push(main);
|
||||
})
|
||||
objSendData.Data = sendData;
|
||||
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
|
||||
if (!res || res.code != "0000") {
|
||||
toast_error(res.msg || common.SysErr);
|
||||
errFn ? errFn(res) : "";
|
||||
} else {
|
||||
toast_ok("編輯成功");
|
||||
sucFn ? sucFn(res) : "";
|
||||
}
|
||||
}, null, "POST").send();
|
||||
}
|
||||
|
||||
// 圖表 - 今天用電量 (折線圖)
|
||||
function chartTodaysElec(todayData) {
|
||||
let todayElecChartCanvas = $('#todayElecChart').get(0).getContext('2d');
|
||||
@ -397,7 +566,6 @@
|
||||
borderColor: color.success._500,
|
||||
backgroundColor: color.success._500,
|
||||
pointBackgroundColor: color.success._500,
|
||||
|
||||
order: 1,
|
||||
borderWidth: 3,
|
||||
}
|
||||
@ -411,22 +579,22 @@
|
||||
display: true,
|
||||
},
|
||||
scales: {
|
||||
xAxes: [{
|
||||
x: {
|
||||
offset: true,
|
||||
gridLines: { color: color.fusion._500 },
|
||||
/*grid: { color: color.fusion._100 },*/
|
||||
ticks: {
|
||||
callback: function (value, index, ticks) {
|
||||
return value
|
||||
}
|
||||
},
|
||||
}],
|
||||
yAxes: [{
|
||||
|
||||
},
|
||||
y: {
|
||||
grid: { color: color.fusion._500 },
|
||||
beginAtZero: true,
|
||||
ticks: {
|
||||
min: 0,
|
||||
beginAtZero: true
|
||||
},
|
||||
}]
|
||||
}
|
||||
},
|
||||
tooltips: {
|
||||
callbacks: {
|
||||
@ -489,22 +657,22 @@
|
||||
display: true,
|
||||
},
|
||||
scales: {
|
||||
xAxes: [{
|
||||
x: {
|
||||
offset: true,
|
||||
gridLines: { color: color.fusion._500 },
|
||||
grid: { color: color.fusion._500 },
|
||||
ticks: {
|
||||
callback: function (value, index, ticks) {
|
||||
return value
|
||||
}
|
||||
},
|
||||
}],
|
||||
yAxes: [{
|
||||
},
|
||||
y: {
|
||||
|
||||
ticks: {
|
||||
min: 0,
|
||||
beginAtZero: true
|
||||
},
|
||||
}]
|
||||
}
|
||||
},
|
||||
tooltips: {
|
||||
callbacks: {
|
||||
@ -527,19 +695,205 @@
|
||||
})
|
||||
}
|
||||
|
||||
// 圖表 - 自動需量 (折線圖)
|
||||
function chartAutDem(conCapVal = 0, warCapVal = 0, resCapVal = 0) {
|
||||
|
||||
let autDemChartCanvas = $('#autDemChart').get(0).getContext('2d');
|
||||
let conCapData = [], warCapData = [], resCapData = [];
|
||||
|
||||
if (autDemChart == null) {
|
||||
labels = [];
|
||||
conCapData = [parseInt(conCapVal)];
|
||||
warCapData = [parseInt(warCapVal)];
|
||||
resCapData = [resCapVal];
|
||||
|
||||
let autDemChartData = {
|
||||
labels: labels,
|
||||
datasets: [
|
||||
{
|
||||
id: "conCap",
|
||||
type: "line",
|
||||
label: '契約容量',
|
||||
fill: false,
|
||||
backgroundColor: color.danger._500,
|
||||
borderColor: color.danger._500,
|
||||
pointColor: color.danger._500,
|
||||
pointBackgroundColor: color.danger._500,
|
||||
data: conCapData,
|
||||
order: 1,
|
||||
spanGaps: true
|
||||
},
|
||||
{
|
||||
id: "warCap",
|
||||
type: "line",
|
||||
label: '警戒容量',
|
||||
fill: false,
|
||||
borderDash: [5, 5],
|
||||
backgroundColor: color.danger._500,
|
||||
borderColor: color.danger._500,
|
||||
pointColor: color.danger._500,
|
||||
pointBackgroundColor: color.danger._500,
|
||||
data: warCapData,
|
||||
order: 2,
|
||||
spanGaps: true
|
||||
},
|
||||
{
|
||||
id: "resCap",
|
||||
type: "line",
|
||||
label: '復歸值',
|
||||
fill: false,
|
||||
backgroundColor: color.info._500,
|
||||
borderColor: color.info._500,
|
||||
pointColor: color.info._500,
|
||||
pointBackgroundColor: color.info._500,
|
||||
data: resCapData,
|
||||
order: 3,
|
||||
spanGaps: true
|
||||
},
|
||||
{
|
||||
id: "kWH",
|
||||
type: "line",
|
||||
label: '即時功率',
|
||||
fill: false,
|
||||
backgroundColor: color.success._100,
|
||||
borderColor: color.success._100,
|
||||
pointColor: color.success._100,
|
||||
pointBackgroundColor: color.success._100,
|
||||
data: [],
|
||||
order: 4,
|
||||
spanGaps: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
let autDemChartOptions = {
|
||||
maintainAspectRatio: false,
|
||||
responsive: true,
|
||||
animation: {
|
||||
y: { duration: 0 },
|
||||
x: { duration: 200 },
|
||||
},
|
||||
plugins: {
|
||||
legend: {
|
||||
display: true,
|
||||
fullSize: true,
|
||||
labels: {
|
||||
usePointStyle: true,
|
||||
generateLabels: (chart) => {
|
||||
if (!chart.data) return [];
|
||||
return chart.data.datasets.map(
|
||||
(dataset, index) => ({
|
||||
datasetIndex: index,
|
||||
text: dataset.label,
|
||||
fontColor: color.fusion._100,
|
||||
lineDash: dataset.borderDash ? [5, 5] : [],
|
||||
fillStyle: dataset.backgroundColor,
|
||||
strokeStyle: dataset.borderColor,
|
||||
pointStyle: "line",
|
||||
hidden: !chart.getDatasetMeta(index).visible,
|
||||
})
|
||||
)
|
||||
},
|
||||
|
||||
},
|
||||
},
|
||||
},
|
||||
scales: {
|
||||
x: {
|
||||
offset: true,
|
||||
grid: { color: color.fusion._500 },
|
||||
ticks: {
|
||||
//maxTicksLimit: 10,
|
||||
//count: 10,
|
||||
//callback: function (value, index, ticks) {
|
||||
// return value
|
||||
//}
|
||||
},
|
||||
},
|
||||
y: {
|
||||
ticks: {
|
||||
min: 0,
|
||||
beginAtZero: true
|
||||
},
|
||||
}
|
||||
},
|
||||
//tooltips: {
|
||||
// callbacks: {
|
||||
// label: function (tooltipItem) {
|
||||
// let isTodayOrYes = tooltipItem.datasetIndex == 1 ? "上週" : "本週";
|
||||
// return isTodayOrYes + "用電量 : " + tooltipItem.value + " kWH";
|
||||
// },
|
||||
// title: function (tooltipItem) {
|
||||
// let result = tooltipItem[0].xLabel.toString();
|
||||
// return result;
|
||||
// }
|
||||
// }
|
||||
//},
|
||||
}
|
||||
|
||||
autDemChart = new Chart(autDemChartCanvas, {
|
||||
data: autDemChartData,
|
||||
options: autDemChartOptions
|
||||
})
|
||||
} else {
|
||||
autDemChart.data.datasets[0].data.forEach((x, i) => autDemChart.data.datasets[0].data[i] = conCapVal);
|
||||
autDemChart.data.datasets[1].data.forEach((x, i) => autDemChart.data.datasets[1].data[i] = warCapVal);
|
||||
autDemChart.data.datasets[2].data.forEach((x, i) => autDemChart.data.datasets[2].data[i] = resCapVal);
|
||||
autDemChart.update();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
onEvent("yt:tab:change", "[data-tabname=energyTab]", function () {
|
||||
$("#eneSubSysList").parent("div").show();
|
||||
let type = $(this).data("id");
|
||||
getSubSysList(type);
|
||||
getElecBySubSysTag();
|
||||
getElecBySubSysTag(type);
|
||||
if (type == "1" || type == "2") {
|
||||
$("#eneSubSysList").parent("div").hide();
|
||||
}
|
||||
// 自動需量
|
||||
if (type != "0") {
|
||||
$("#elecAutoReq").hide();
|
||||
$("#elecAutoDem").hide();
|
||||
} else {
|
||||
$("#elecAutoReq").show();
|
||||
$("#elecAutoDem").show();
|
||||
}
|
||||
})
|
||||
|
||||
onEvent("click", "#ediAutDemBtn", function () {
|
||||
$("#txtConCap").val($("[data-id=contract_capacity]").text());
|
||||
$("#txtWarCap").val($("[data-id=warning_capacity]").text());
|
||||
$("#txtResCap").val($("[data-id=resetting_value]").text());
|
||||
$("#autDemModal").modal("show");
|
||||
})
|
||||
|
||||
onEvent("click", "#autDemSavBtn", function () {
|
||||
formValidate(() => {
|
||||
ediAutDemVal(() => {
|
||||
$("#autDemModal").modal("hide");
|
||||
getAutDemVal();
|
||||
});
|
||||
});
|
||||
})
|
||||
|
||||
function formValidate(validFn = null) {
|
||||
$("#autDemForm").validate({
|
||||
rules: {
|
||||
txtConCap: { number: true },
|
||||
txtWarCap: { number: true },
|
||||
txtResCap: { number: true },
|
||||
},
|
||||
message: {
|
||||
txtConCap: { number: "請輸入數字" },
|
||||
txtWarCap: { number: "請輸入數字" },
|
||||
txtResCap: { number: "請輸入數字" },
|
||||
}
|
||||
})
|
||||
|
||||
if ($("#autDemForm").valid()) {
|
||||
validFn ? validFn() : "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
@ -400,12 +400,14 @@
|
||||
devices: devices,
|
||||
}
|
||||
|
||||
if (pageAct.sysMainTag !== "LT") {
|
||||
heatMap = new ADHeatMaps(option);
|
||||
heatMap.onComplete = () => {
|
||||
$.each(allDevList, (idx, dev) => {
|
||||
heatMap.changeTemp(dev.device_number, dev._temp || 0);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
let elevOption = {
|
||||
selector: "[name=forgeViewer]",
|
||||
|
@ -160,7 +160,7 @@ class elevator3D {
|
||||
this.ele = option.element;
|
||||
this.viewer = option.viewer;
|
||||
this.nodeId = option.nodeId;
|
||||
this.speed = option.speed ?? 0.03;
|
||||
this.speed = option.speed ?? 0.07;
|
||||
this.tagValue = option.tagValue ?? "";
|
||||
this.fragProxys = [];
|
||||
this.fragProxy = null;
|
||||
|
@ -1,6 +1,18 @@
|
||||
var ytAjax = typeof YourTeam !== "undefined" ? new YourTeam.Ajax() : null; //公用AJAX初始化
|
||||
var baseApiUrl = "http://localhost:3604";
|
||||
var baseImgUrl = "https://localhost:44376";
|
||||
var baseApiUrl = "http://localhost:3604"; // 本地開發用
|
||||
var baseImgUrl = "https://localhost:44376"; // 本地開發用
|
||||
|
||||
// Mitsubishi
|
||||
//var baseApiUrl = "http://220.132.206.5"; // production 用
|
||||
//var baseImgUrl = "http://220.132.206.5:8848"; // production 用
|
||||
|
||||
// WSP
|
||||
//var baseApiUrl = "http://220.132.206.5"; // production 用
|
||||
//var baseImgUrl = "http://220.132.206.5:8849"; // production 用
|
||||
|
||||
//var baseApiUrl = "http://localhost";
|
||||
//var baseImgUrl = "http://localhost:8848";
|
||||
|
||||
var varRegApiUrl = "/reg/api/"; //註冊API路徑
|
||||
var varApiUrl = "/api/"; //API路徑
|
||||
var varPathDevIcon = "/upload/device_icon/";
|
||||
@ -18,8 +30,12 @@ var common = {
|
||||
SysErr: "系統內部發生錯誤,請聯繫系統管理員"
|
||||
}
|
||||
var objSendData = { Data: null };
|
||||
// Mitsubishi
|
||||
var initAreaTag = "TPE";
|
||||
var n4Sup = "Mitsubishi_Sup";
|
||||
// WSP
|
||||
//var initAreaTag = "NTPC";
|
||||
//var n4Sup = "Banqiao";
|
||||
var forgeTokenBase = {
|
||||
url: baseApiUrl + '/api/forge/oauth/token',
|
||||
res_access_token: ["dictionary", "access_token"],
|
||||
|
@ -87,13 +87,13 @@ function addzero(num) {
|
||||
function getAlarmByBaja(startDate_millisecond, endDate_millisecond, isRecover, isAck, alarmClass, callback) {
|
||||
let _sourceTmp;
|
||||
var _result = "";
|
||||
var _ss = "";
|
||||
var _ss = [];
|
||||
var _bfName = "";
|
||||
var _sourceName = "";
|
||||
var _index = 0;
|
||||
var _recoverState = isRecover ? "!= null" : "= null";
|
||||
var _ackState = isAck ? "= 'acked'" : "= 'unacked'";
|
||||
console.log("local:|foxs:|alarm:|bql:select timestamp, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where alarmClass = '" + alarmClass + "' and timestamp.millis > " + startDate_millisecond + " and timestamp.millis < " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp asc")
|
||||
/*console.log("local:|foxs:|alarm:|bql:select timestamp, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where alarmClass = '" + alarmClass + "' and timestamp.millis > " + startDate_millisecond + " and timestamp.millis < " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp asc")*/
|
||||
require(['baja!'], function (baja) {
|
||||
baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackTime, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where alarmClass = '" + alarmClass + "' and timestamp.millis > " + startDate_millisecond + " and timestamp.millis < " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp asc").get()
|
||||
.then(function (table) {
|
||||
@ -102,19 +102,11 @@ function getAlarmByBaja(startDate_millisecond, endDate_millisecond, isRecover, i
|
||||
_sourceTmp = (record.get('alarmData').get('sourceName')).toString().split('_');
|
||||
_bfName = _sourceTmp[1] + "-" + _sourceTmp[4];
|
||||
_sourceName = _sourceTmp[7] + "-" + _sourceTmp[8];
|
||||
|
||||
if (_index == 0)
|
||||
_ss += '{"buildingFloorName_zh":"' + _bfName + '", "uuid":"' + record.get('uuid') + '", "timestamp":"' + record.get('timestamp') + '", "alarmClass":"' + record.get('alarmClass') + '", "sourceName_zh":"' + _sourceName + '", "msgText":"' + record.get('alarmData').get('msgText') + '", "ackState":"' + record.get('ackState') + '", "normalTime":"' + record.get('normalTime') + '","ackedTime":"' + record.get('ackTime').$cEncStr
|
||||
+ '"}';
|
||||
else
|
||||
_ss += '{"buildingFloorName_zh":"' + _bfName + '", "uuid":"' + record.get('uuid') + '", "timestamp":"' + record.get('timestamp') + '", "alarmClass":"' + record.get('alarmClass') + '", "sourceName_zh":"' + _sourceName + '", "msgText":"' + record.get('alarmData').get('msgText') + '", "ackState":"' + record.get('ackState') + '", "normalTime":"' + record.get('normalTime') + '","ackedTime":"' + record.get('ackTime').$cEncStr
|
||||
+ '"}';
|
||||
_index++;
|
||||
_ss.push({ buildingFloorName_zh: _bfName, uuid: record.get('uuid'), timestamp: record.get('timestamp').$cEncStr, alarmClass: record.get('alarmClass'), sourceName_zh: _sourceName, msgText: record.get('alarmData').get('msgText'), ackState: record.get('ackState'), normalTime: record.get('normalTime'), ackedTime: record.get('ackTime').$cEncStr })
|
||||
_index++
|
||||
},
|
||||
after: function () {
|
||||
_result += '{' + '"count": ' + _index + ', "data":[';
|
||||
_result += _ss;
|
||||
_result += ']}';
|
||||
_result = { count: _index, data: _ss }
|
||||
if (typeof callback === 'function') {
|
||||
callback(_result);
|
||||
}
|
||||
@ -527,10 +519,10 @@ function getSystemAlarmByBaja(callback) {
|
||||
* @param {any} devicePath
|
||||
* @param {any} callback
|
||||
*/
|
||||
function getOneDeviceAlarmByBaja(devicePath, callback) {
|
||||
function getOneDeviceAlarmByBaja(devicePath, callback) {
|
||||
let _sourceTmp;
|
||||
var _result = "";
|
||||
var _ss = "";
|
||||
var _ss = [];
|
||||
var _bfName = "";
|
||||
var _sourceName = "";
|
||||
var _index = 0;
|
||||
@ -544,16 +536,14 @@ function getSystemAlarmByBaja(callback) {
|
||||
_sourceTmp = (record.get('alarmData').get('sourceName')).toString().split('_');
|
||||
_bfName = _sourceTmp[1] + "-" + _sourceTmp[4];
|
||||
_sourceName = _sourceTmp[7] + "-" + _sourceTmp[8];
|
||||
if (_index == 0)
|
||||
_ss += '{"buildingFloorName_zh":"' + _bfName + '", "uuid":"' + record.get('uuid') + '", "timestamp":"' + record.get('timestamp') + '", "alarmClass":"' + record.get('alarmClass') + '", "sourceName_zh":"' + _sourceName + '", "msgText":"' + record.get('alarmData').get('msgText') + '", "ackState":"' + record.get('ackState') + '", "normalTime":"' + record.get('normalTime') + '"}';
|
||||
else
|
||||
_ss += ',{"buildingFloorName_zh":"' + _bfName + '", "uuid":"' + record.get('uuid') + '", "timestamp":"' + record.get('timestamp') + '", "alarmClass":"' + record.get('alarmClass') + '", "sourceName_zh":"' + _sourceName + '", "msgText":"' + record.get('alarmData').get('msgText') + '", "ackState":"' + record.get('ackState') + '", "normalTime":"' + record.get('normalTime') + '"}';
|
||||
_index++;
|
||||
_ss.push({ buildingFloorName_zh: _bfName, uuid: record.get('uuid'), timestamp: record.get('timestamp'), alarmClass: record.get('alarmClass'), sourceName_zh: _sourceName, msgText: record.get('alarmData').get('msgText'), ackState: record.get('ackState'), normalTime: record.get('normalTime') })
|
||||
_index++
|
||||
},
|
||||
after: function () {
|
||||
_result += '{' + '"count": ' + _index + ', "data":[';
|
||||
_result += _ss + ']';
|
||||
_result += '}';
|
||||
_result = { count: _index, data: _ss }
|
||||
|
||||
console.log(552, _result);
|
||||
|
||||
if (typeof callback === 'function') {
|
||||
callback(_result);
|
||||
}
|
||||
@ -571,6 +561,60 @@ function getAllDeviceAlarmByBaja(startDate_millisecond, endDate_millisecond, isR
|
||||
var _recoverState = isRecover ? "!= null" : "= null";
|
||||
var _ackState = isAck ? "= 'acked'" : "= 'unacked'";
|
||||
|
||||
require(['baja!'], function (baja) {
|
||||
let startUrl = "";
|
||||
if (startDate_millisecond) {
|
||||
startUrl = "timestamp.millis >= " + startDate_millisecond + " and ";
|
||||
}
|
||||
// console.log("local:|foxs:|alarm:|bql:select timestamp, ackTime, priority ,ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where " + startUrl + "timestamp.millis <= " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp desc");
|
||||
|
||||
baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackTime, priority ,ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where " + startUrl + "timestamp.millis <= " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp desc").get()
|
||||
.then(function (table) {
|
||||
return table.cursor({
|
||||
each: function (record) {
|
||||
// console.log(record,record.get('alarmData').get('sourceName').split(':'))
|
||||
let main = {};
|
||||
console.log(record.get('alarmData').get('sourceName'), record.get('timestamp').$cEncStr)
|
||||
_sourcePoint = (record.get('alarmData').get('sourceName')).toString().split(':')[0];
|
||||
_sourceTmp = _sourcePoint.split("_");
|
||||
|
||||
let _bfName = _sourceTmp[1] + "-" + _sourceTmp[4];
|
||||
let _sourceName = _sourceTmp[7] + "-" + _sourceTmp[8];
|
||||
main.buildingFloorName_zh = _bfName;
|
||||
main.sourceName_zh = _sourceName;
|
||||
main.uuid = record.get('uuid').$val;
|
||||
main.timestamp = record.get('timestamp').$cEncStr;
|
||||
main.alarmClass = record.get('alarmClass');
|
||||
main.point = _sourcePoint;
|
||||
main.devicePath = _sourceTmp.slice(0, 8).join("_");;
|
||||
main.msgText = record.get('alarmData').get('msgText');
|
||||
main.normalTime = record.get('normalTime');
|
||||
main.priority = record.get('priority');
|
||||
main.ackedTime = record.get('ackTime').$cEncStr;
|
||||
_result.data.push(main);
|
||||
_index++;
|
||||
},
|
||||
after: function () {
|
||||
_result.count = _index;
|
||||
if (typeof callback === 'function') {
|
||||
console.log(_result)
|
||||
callback(_result);
|
||||
}
|
||||
},
|
||||
limit: -1,
|
||||
offset: 0
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function getDeviceAlarmCardByBaja(startDate_millisecond, endDate_millisecond, isRecover, isAck, callback) {
|
||||
var _result = { count: 0, data: [] };
|
||||
var _index = 0;
|
||||
var _recoverState = isRecover ? "!= null" : "= null";
|
||||
var _ackState = isAck ? "= 'acked'" : "= 'unacked'";
|
||||
|
||||
require(['baja!'], function (baja) {
|
||||
let startUrl = "";
|
||||
if (startDate_millisecond) {
|
||||
@ -621,7 +665,7 @@ function getAllDeviceAlarmByBaja(startDate_millisecond, endDate_millisecond, isR
|
||||
* [首頁] 圓餅圖資料 - 全部的異常
|
||||
* @param {any} callback
|
||||
*/
|
||||
function getAlarmForChartDataByBaja(callback) {
|
||||
function getAlarmForChartDataByBaja(callback) {
|
||||
var _result = "";
|
||||
var _ss = "";
|
||||
var _index = 0;
|
||||
|
@ -484,9 +484,14 @@ class Forge3DElevFull {
|
||||
this.selector = option.selector ?? "#forgeViewer";
|
||||
this.bajaChaCallback = option.bajaChaCallback ?? null;
|
||||
this.bajaEndCallback = option.bajaEndCallback ?? null;
|
||||
this.sensorObj = null
|
||||
}
|
||||
|
||||
init = function () {
|
||||
this.sensorObj = new Forge3DSensor({
|
||||
viewer: this.viewer,
|
||||
ordPath: { ...this.ordPath },
|
||||
})
|
||||
// 系統大類、小類固定
|
||||
this.ordPath.system_tag = this.sysMainTag;
|
||||
this.ordPath.name_tag = this.sysSubTag;
|
||||
@ -671,3 +676,230 @@ class Forge3DElevFull {
|
||||
return this.elev3DObj.map(x => x.nodeId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 取得資料庫溫度感測器
|
||||
* 1. baja 取得溫度感測器改變顏色
|
||||
* 2. 參數取得要移動到的電梯位置
|
||||
* */
|
||||
class Forge3DSensor {
|
||||
constructor(option = {}) {
|
||||
this.allSensorDevList = []; //溫度調節器設備清單
|
||||
this.subDeviceData = []; //每個設備訂閱點位值
|
||||
this.viewer = option.viewer ?? null;
|
||||
this.ordPath = option.ordPath; // TPE_B1
|
||||
this.sysMainTag = "ME";
|
||||
this.sysSubTag = "M12";
|
||||
this.selector = "#forgeViewer";
|
||||
this.heatMap = null;
|
||||
this.bajaChaCallback = option.bajaChaCallback ?? null;
|
||||
this.bajaEndCallback = option.bajaEndCallback ?? null;
|
||||
this.floorHeight = 0;
|
||||
this.dataVizExtn = null;
|
||||
this.#init();
|
||||
}
|
||||
|
||||
#init = async function () {
|
||||
// 系統大類、小類固定
|
||||
this.ordPath.system_tag = this.sysMainTag;
|
||||
this.ordPath.name_tag = this.sysSubTag;
|
||||
this.dataVizExtn = await this.viewer.loadExtension("Autodesk.DataVisualization");
|
||||
//this.getSensorDevList();
|
||||
}
|
||||
// 取得Sensor設備列表
|
||||
getSensorDevList = function () {
|
||||
let url = baseApiUrl + "/api/Device/GetDeviceList";
|
||||
let sendData = {
|
||||
sub_system_tag: this.ordPath.name_tag, // M12
|
||||
building_tag: this.ordPath.building_tag, //B1
|
||||
};
|
||||
objSendData.Data = sendData;
|
||||
ytAjax = new YourTeam.Ajax(url, objSendData, (res) => {
|
||||
if (!res || res.code != "0000" || !res.data) {
|
||||
|
||||
} else {
|
||||
$.each(res.data, (index, floObj) => {
|
||||
$.each(floObj.device_list, (index2, devObj) => {
|
||||
this.allSensorDevList.push(devObj);
|
||||
})
|
||||
})
|
||||
let devices = this.allSensorDevList.map((x) => {
|
||||
if (x.device_number.includes("ME_M12")) {
|
||||
return {
|
||||
roomDbId: 12879, // Bank2 電梯
|
||||
id: x.device_number,
|
||||
position: isJSON(x.device_coordinate_3d)
|
||||
? JSON.parse(x.device_coordinate_3d)
|
||||
: {}, // x: 0, y: 25, z: -2.5 (3.35, -4.81, 12.88
|
||||
sensorTypes: ["temperature", "humidity"],
|
||||
};
|
||||
}
|
||||
});
|
||||
//this.heatMap = new ADHeatMaps({
|
||||
// devices
|
||||
//});
|
||||
//this.subSensorDevice();
|
||||
}
|
||||
}, null, "POST").send();
|
||||
}
|
||||
|
||||
// 訂閱sensor設備
|
||||
subSensorDevice = function () {
|
||||
let myBaja = new subscriptionDevices();
|
||||
let ordPath = this.ordPath;
|
||||
|
||||
myBaja.setSubscribeDevicesByBql(ordPath);
|
||||
myBaja.setSubscribeDevicesCallBack((data) => {
|
||||
this.bajaChaCallback ? this.bajaChaCallback(data) : "";
|
||||
if (this.allSensorDevList.length == 0) {
|
||||
return false;
|
||||
}
|
||||
data.device_number = data.device_number_full; // "TPE_B1_ME_M12_U1F_NA_TH_N1" (forge TPE_B1_ME_M12_R2F_NA_TH_N1)
|
||||
|
||||
let matchDevice = this.allSensorDevList.find(
|
||||
(x) =>
|
||||
x.device_number == data.device_number ||
|
||||
x.device_number == "TPE_B1_ME_M12_R2F_NA_TH_N1",
|
||||
);
|
||||
|
||||
if (!matchDevice) {
|
||||
return;
|
||||
}
|
||||
//將訂閱值塞入 subDeviceData
|
||||
if (
|
||||
this.subDeviceData.findIndex(d => d.device_number == matchDevice.device_number) == -1
|
||||
) {
|
||||
let obj = {};
|
||||
obj.device_number = matchDevice.device_number;
|
||||
obj.dbid = matchDevice.forge_dbid;
|
||||
this.subDeviceData.push(obj);
|
||||
}
|
||||
let subData = this.subDeviceData.find(
|
||||
(x) => x.device_number == matchDevice.device_number || x.device_number == "TPE_B1_ME_M12_R2F_NA_TH_N1"
|
||||
);
|
||||
|
||||
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" || data.point_name == "TEMP") {
|
||||
this.heatMap?.changeTemp(
|
||||
matchDevice.device_number,
|
||||
!isNaN(parseInt(data.value)) ? parseInt(data.value) : 0,
|
||||
);
|
||||
let devIdx = this.allSensorDevList.findIndex(
|
||||
(x) =>
|
||||
x.device_number == data.device_number_full ||
|
||||
x.device_number == "TPE_B1_ME_M12_R2F_NA_TH_N1",
|
||||
);
|
||||
this.allSensorDevList[devIdx]._temp = !isNaN(parseInt(data.value))
|
||||
? parseInt(data.value)
|
||||
: 0;
|
||||
}
|
||||
});
|
||||
|
||||
//myBaja.setSubscribeDeviceEndCallBack((data) => {
|
||||
// if (data.findIndex((x) => x.point_name == "Temp" || x.point_name == "TEMP") != -1) {
|
||||
// // 顯示溫度條
|
||||
// console.log(showHeat)
|
||||
// showHeat("[name=forgeHeatBar]");
|
||||
// }
|
||||
//});
|
||||
}
|
||||
|
||||
// 位置呈現
|
||||
changeSensorPos = async function () {
|
||||
this.dataVizExtn.removeAllViewables();
|
||||
const DataVizCore = Autodesk.DataVisualization.Core;
|
||||
const viewableType = DataVizCore.ViewableType.SPRITE;
|
||||
const spriteColor = new THREE.Color(0x000000);
|
||||
let spriteIcon = "/file/img/forge/hotspot.svg";
|
||||
if (location.href.indexOf("localhost:5966") != -1) {
|
||||
spriteIcon = "/img/forge/hotspot.svg";
|
||||
} const style = new DataVizCore.ViewableStyle(viewableType, spriteColor, spriteIcon);
|
||||
const viewableData = new DataVizCore.ViewableData();
|
||||
viewableData.spriteSize = 30
|
||||
|
||||
// test 1
|
||||
// const myDataList = [{ position: { x: 0, y: 0, z: this.floorHeight } }];
|
||||
// myDataList.forEach((myData, index) => {
|
||||
// const position = myData.position;
|
||||
// const viewable = new DataVizCore.SpriteViewable(position, style, 12982);
|
||||
// console.log(viewable)
|
||||
// viewableData.addViewable(viewable);
|
||||
// });
|
||||
// await viewableData.finish();
|
||||
// this.dataVizExtn.addViewables(viewableData);
|
||||
// console.log(this.floorHeight,this.dataVizExtn)
|
||||
|
||||
// test 2
|
||||
const myDataList = [{ position: { x: 0, y: 0, z: 0 } }];
|
||||
myDataList.forEach((myData, index) => {
|
||||
const position = myData.position;
|
||||
const viewable = new DataVizCore.SpriteViewable(position, style, 12982);
|
||||
viewableData.addViewable(viewable);
|
||||
});
|
||||
await viewableData.finish();
|
||||
this.dataVizExtn.addViewables(viewableData);
|
||||
let spritesToUpdate = this.dataVizExtn.viewableData.viewables.map((v) => v.dbId);
|
||||
this.dataVizExtn.invalidateViewables(spritesToUpdate, (viewable) => {
|
||||
return {
|
||||
// Move the viewable to a new location.
|
||||
position: { x: 0, y: 0, z: 100 },
|
||||
|
||||
};
|
||||
});
|
||||
console.log(this.floorHeight, this.dataVizExtn)
|
||||
console.log("site")
|
||||
//let nodeIds = this.allSensorDevList
|
||||
// .filter((x) => !isNaN(parseInt(x.forge_dbid)))
|
||||
// .map((x) => {
|
||||
// return { devNum: x.device_number, nodeId: parseInt(x.forge_dbid) };
|
||||
// });
|
||||
//console.log("sensor", nodeIds)
|
||||
//$.each(nodeIds, (idx, node) => {
|
||||
// let options = {
|
||||
// element: $(this.selector),
|
||||
// viewer: this.viewer,
|
||||
// nodeId: node,
|
||||
// floorHeight: this.floorHeight ?? [],
|
||||
// inited: function () {
|
||||
|
||||
// }
|
||||
// }
|
||||
// let elevator3DObj = new elevator3D(options);
|
||||
// elevator3DObj.init(() => {
|
||||
|
||||
// const frags = this.viewer.model.getFragmentList();
|
||||
// let scale = new THREE.Vector3();
|
||||
// let rotation = new THREE.Quaternion();
|
||||
// let translation = new THREE.Vector3();
|
||||
// frags.getAnimTransform(node.nodeId, scale, rotation, translation);
|
||||
// console.log(frags.getAnimTransform(node.nodeId, scale, rotation, translation))
|
||||
// translation.z = this.floorHeight;
|
||||
// frags.updateAnimTransform(node.nodeId, scale, rotation, translation);
|
||||
// console.log(frags, frags.getAnimTransform(node.nodeId, scale, rotation, translation))
|
||||
// // let frags = elevator3DObj.fragProxys.filter(x => x.nodeId == node);
|
||||
// // console.log("sensor",elevator3DObj, frags)
|
||||
|
||||
// // let fragProxy = this.viewer.impl.getFragmentProxy(this.viewer.model, node.nodeId)
|
||||
// // fragProxy.position = new THREE.Vector3(0, 0, 0)
|
||||
// // console.log(node,fragProxy)
|
||||
// // fragProxy.position.z = this.floorHeight
|
||||
// // fragProxy.updateAnimTransform()
|
||||
|
||||
// // frags.forEach((fragProxy) => {
|
||||
// // console.log("sensor", this)
|
||||
// // console.log("elev2")
|
||||
// // fragProxy.frag.position.z = this.floorHeight
|
||||
// // console.log("sensor", fragProxy, fragProxy.frag)
|
||||
// // fragProxy.frag.updateAnimTransform()
|
||||
// // })
|
||||
|
||||
// this.viewer.impl.sceneUpdated(true)
|
||||
// })
|
||||
//})
|
||||
}
|
||||
}
|