diff --git a/Frontend/_dashboard.html b/Frontend/_dashboard.html
index 1f9a945..fb0460e 100644
--- a/Frontend/_dashboard.html
+++ b/Frontend/_dashboard.html
@@ -208,11 +208,7 @@
-
-
-
\ No newline at end of file
diff --git a/Frontend/_sysMonAll.html b/Frontend/_sysMonAll.html
index bdf581f..e30f7d3 100644
--- a/Frontend/_sysMonAll.html
+++ b/Frontend/_sysMonAll.html
@@ -376,13 +376,17 @@
function show3DModel(urn) {
$(loadEle).Loading("start");
launchViewerForHotspot(urn, (viewer, nodeIds) => {
- let devDbIds = allDevList.map(x => x.forge_dbid);
-
+ let devDbIds = allDevList.map(x => x.forge_dbid); // 大類
+ console.log(allDevList);
+ let subDevDbId = [];
+ allDevList.forEach(({ device_nodes }) => {
+ subDevDbId = [...subDevDbId, ...device_nodes.map(n => n.forge_dbid)]
+ })
// 從資料庫設定不可視模型的類型,若沒有取道該小類不可視類型,則套用資料庫設定預設類型
if (forgeInvType) {
- setInviForge(forgeInvType, devDbIds);
+ setInviForge(forgeInvType, [...devDbIds, ...subDevDbId]);
} else {
- setInviForge(forgeInvTypeDef, devDbIds);
+ setInviForge(forgeInvTypeDef, [...devDbIds, ...subDevDbId]);
}
$(loadEle).Loading("close");
@@ -434,9 +438,11 @@
setForgeHotSpotColor(matchDevice);
}
}
- }
-
+ }
+ if (pageAct.sub_system_tag == "W2") {
getWaterNodeId();
+ }
+
}, () => {
$(loadEle).Loading("close");
}, "[name=forgeViewer]");
@@ -444,20 +450,24 @@
// 供水系統 - 取得欲染色 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) {
+ //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();
+ // } else {
+ // if (!isNaN(parseInt(res.data[0]?.system_value))) {
+ // changeColor(parseInt(res.data[0]?.system_value))
+ // }
+ // console.log(res.data)
+ // }
+ //}, null, "POST").send();
+ viewer.model.search("給水", (nodeIds) => {
+ console.log(nodeIds)
+ viewer.show(nodeIds)
+ }, (e) => { console.log(e) })
}
function getHotspotPoint(callback = null) {
diff --git a/Frontend/js/n4js/historybaja.js b/Frontend/js/n4js/historybaja.js
index 5bf45a8..59c7c17 100644
--- a/Frontend/js/n4js/historybaja.js
+++ b/Frontend/js/n4js/historybaja.js
@@ -35,69 +35,83 @@
// }
function getHistoryDataByBaja(devicePath, startDate_millisecond, endDate_millisecond, deviceName, company, callback) {
- var _result = "";
- var _ss = "";
- var _index = 0;
+ var _result = {};
+ var _ss = [];
+ var _index = 0;
- require(['baja!'], function (baja) {
- console.log('local:|foxs:|history:/' + company + '/' + devicePath + '|bql:select * from control:ControlPoint where timestamp.millis > ' + startDate_millisecond + ' and timestamp.millis < ' + endDate_millisecond);
- baja.Ord.make('local:|foxs:|history:/' + company + '/' + devicePath + '|bql:select * from control:ControlPoint where timestamp.millis > ' + startDate_millisecond + ' and timestamp.millis < ' + endDate_millisecond).get()
- .then(function (table) {
- return table.cursor({
- each: function (record) {
- if (_index == 0)
- _ss += '{"deviceName":"' + deviceName + '", "value":' + record.get('value') + ', "timestamp":"' + record.get('timestamp') + '"}';
- else
- _ss += ',{"deviceName":"' + deviceName + '", "value":' + record.get('value') + ', "timestamp":"' + record.get('timestamp') + '"}';
- _index++;
- },
- after: function () {
- _result += '{' + '"count": ' + _index + ', "data":[';
- _result += _ss;
- _result += ']}';
- if (typeof callback === 'function') {
- callback(_result);
- }
- },
- limit: -1,
- offset: 0
- });
- });
- });
+ require(['baja!'], function (baja) {
+ console.log('local:|foxs:|history:/' + company + '/' + devicePath + '|bql:select * from control:ControlPoint where timestamp.millis > ' + startDate_millisecond + ' and timestamp.millis < ' + endDate_millisecond);
+ baja.Ord.make('local:|foxs:|history:/' + company + '/' + devicePath + '|bql:select * from control:ControlPoint where timestamp.millis > ' + startDate_millisecond + ' and timestamp.millis < ' + endDate_millisecond).get()
+ .then(function (table) {
+ return table.cursor({
+ each: function (record) {
+ console.log(record.get('timestamp'))
+ // if (_index == 0)
+ // _ss += '{"deviceName":"' + deviceName + '", "value":' + record.get('value') + ', "timestamp":"' + record.get('timestamp').$cEncStr
+ // + '"}';
+ // else
+ // _ss += ',{"deviceName":"' + deviceName + '", "value":' + record.get('value') + ', "timestamp":"' + record.get('timestamp').$cEncStr
+ // + '"}';
+ _ss.push({
+ deviceName: deviceName, value: record.get('value'), timestamp: record.get('timestamp').$cEncStr
+ });
+ _index++;
+ },
+ after: function () {
+ _result = { count: _index, data: _ss }
+ // _result += '{' + '"count": ' + _index + ', "data":[';
+ // _result += _ss;
+ // _result += ']}';
+ if (typeof callback === 'function') {
+ // console.log(_result)
+ _result = JSON.stringify(_result)
+ callback(_result);
+ }
+ },
+ limit: -1,
+ offset: 0
+ });
+ })
+ .catch(() => {
+ console.log("error");
+ // const res = JSON.stringify({count:0, data:[]})
+ callback()
+ });
+ });
}
function test3000p(devicePath, startDate_millisecond, endDate_millisecond, deviceName, company, callback) {
- var _result = "";
- var _ss = "";
- var _index = 0;
- require(['baja!'], function (baja) {
- "use strict";
- baja.Ord.make('local:|foxs:|history:/' + company + '/' + devicePath + '|bql:select * from control:ControlPoint where timestamp.millis > ' + startDate_millisecond + ' and timestamp.millis < ' + endDate_millisecond)
- .get(
- function (table) {
-
- table.cursor({
- each: function (item) {
- console.log("item: " + item);
- if (_index == 0)
- _ss += '{"deviceName":"' + deviceName + '", "value":' + item.$map.$map.value.$display + ', "timestamp":"' + item.$map.$map.timestamp.$val.$cEncStr + '"}';
- else
- _ss += ',{"deviceName":"' + deviceName + '", "value":' + item.$map.$map.value.$display + ', "timestamp":"' + item.$map.$map.timestamp.$val.$cEncStr + '"}';
- _index++;
- },
- after: function () {
- _result += '{' + '"count": ' + _index + ', "data":[';
- _result += _ss;
- _result += ']}';
- if (typeof callback === 'function') {
- callback(_result);
- }
- },
- limit: -1,
- offset: 0
- });
- })
- });
+ var _result = "";
+ var _ss = "";
+ var _index = 0;
+ require(['baja!'], function (baja) {
+ "use strict";
+ baja.Ord.make('local:|foxs:|history:/' + company + '/' + devicePath + '|bql:select * from control:ControlPoint where timestamp.millis > ' + startDate_millisecond + ' and timestamp.millis < ' + endDate_millisecond)
+ .get(
+ function (table) {
+
+ table.cursor({
+ each: function (item) {
+ console.log("item: " + item);
+ if (_index == 0)
+ _ss += '{"deviceName":"' + deviceName + '", "value":' + item.$map.$map.value.$display + ', "timestamp":"' + item.$map.$map.timestamp.$val.$cEncStr + '"}';
+ else
+ _ss += ',{"deviceName":"' + deviceName + '", "value":' + item.$map.$map.value.$display + ', "timestamp":"' + item.$map.$map.timestamp.$val.$cEncStr + '"}';
+ _index++;
+ },
+ after: function () {
+ _result += '{' + '"count": ' + _index + ', "data":[';
+ _result += _ss;
+ _result += ']}';
+ if (typeof callback === 'function') {
+ callback(_result);
+ }
+ },
+ limit: -1,
+ offset: 0
+ });
+ })
+ });
}