Merge branch 'master' of https://gitea.mjm-staging.developers-homelab.net/BIMS/BIMS
This commit is contained in:
commit
509263395a
Binary file not shown.
Binary file not shown.
@ -183,14 +183,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>-->
|
</div>-->
|
||||||
<div class="col-12 mb-2 position-relative row m-0 justify-content-center">
|
<div class="col-12 mb-2 position-relative row m-0 justify-content-center">
|
||||||
<span class="text-center position-absolute t-white" style="top:25%;left:27%;">異常數量<br>18</span>
|
<canvas class="chart" id="errRecChart"></canvas>
|
||||||
<img src="img/u110.png" class="w-50">
|
|
||||||
<span class="text-center position-absolute t-white" style="top:42%;left:51%;">賦歸數量<br>28</span>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 mb-2 position-relative row m-0 justify-content-center">
|
<div class="col-12 mb-2 position-relative row m-0 justify-content-center">
|
||||||
<span class="text-center position-absolute t-white" style="top:43%;left:24%;">已確認異常<br>8</span>
|
<canvas class="chart" id="errChkChart"></canvas>
|
||||||
<img src="img/u106.png" class="w-50">
|
|
||||||
<span class="text-center position-absolute t-white" style="top:35%;left:52%;">未確認異常<br>6</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -249,7 +245,6 @@
|
|||||||
show3DModel();
|
show3DModel();
|
||||||
getSubList();
|
getSubList();
|
||||||
getFirstEletric();
|
getFirstEletric();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// 從數字週數轉為中文週數
|
// 從數字週數轉為中文週數
|
||||||
@ -349,48 +344,83 @@
|
|||||||
let prevTwoWeek = displayDate(getTimeByType(null, -14), "date").replaceAll("/", "-") + "T00:00:00";
|
let prevTwoWeek = displayDate(getTimeByType(null, -14), "date").replaceAll("/", "-") + "T00:00:00";
|
||||||
let yesterday = displayDate(getTimeByType(null, -1), "date").replaceAll("/", "-") + "T00:00:00";
|
let yesterday = displayDate(getTimeByType(null, -1), "date").replaceAll("/", "-") + "T00:00:00";
|
||||||
let tomorrow = displayDate(getTimeByType(null, 1), "date").replaceAll("/", "-") + "T00:00:00";
|
let tomorrow = displayDate(getTimeByType(null, 1), "date").replaceAll("/", "-") + "T00:00:00";
|
||||||
|
let loadedCnt = 0;
|
||||||
// 今日用電量
|
/* let batch = new baja.comm.Batch();*/
|
||||||
|
startPageLoading();
|
||||||
|
//// 今日用電量
|
||||||
getElectricMeterDayDataByBaja(devNum + "_KWH", "Mitsubishi_Sup", today, tomorrow, (data) => {
|
getElectricMeterDayDataByBaja(devNum + "_KWH", "Mitsubishi_Sup", today, tomorrow, (data) => {
|
||||||
$("#todayUseElec").text(data?.data[0]?.sum || 0);
|
$("#todayUseElec").text(data?.data[0]?.sum || 0);
|
||||||
|
chkBajaLoaded();
|
||||||
})
|
})
|
||||||
|
|
||||||
// 今日用電量 (每小時)
|
//// 今日用電量 (每小時)
|
||||||
getElectricMeterHourDataByBaja(devNum + "_KWH", "Mitsubishi_Sup", yesterday, tomorrow, (data) => {
|
getElectricMeterHourDataByBaja(devNum + "_KWH", "Mitsubishi_Sup", 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"));
|
let todayData = data.data.filter(x => x.timestamp.$date.$year == getTimeByType("year") && x.timestamp.$date.$month == getTimeByType("month") && x.timestamp.$date.$day == getTimeByType("date"));
|
||||||
let yesData = data.data.filter(x => x.timestamp.$date.$year == getTimeByType("year", -1) && x.timestamp.$date.$month == getTimeByType("month", -1) && x.timestamp.$date.$day == getTimeByType("date", -1));
|
let yesData = data.data.filter(x => x.timestamp.$date.$year == getTimeByType("year", -1) && x.timestamp.$date.$month == getTimeByType("month", -1) && x.timestamp.$date.$day == getTimeByType("date", -1));
|
||||||
chartEveDaysElec(todayData, yesData);
|
chartEveDaysElec(todayData, yesData);
|
||||||
|
chkBajaLoaded();
|
||||||
})
|
})
|
||||||
|
|
||||||
// 昨日用電量
|
// 昨日用電量
|
||||||
getElectricMeterDayDataByBaja(devNum + "_KWH", "Mitsubishi_Sup", yesterday, today, (data) => {
|
getElectricMeterDayDataByBaja(devNum + "_KWH", "Mitsubishi_Sup", yesterday, today, (data) => {
|
||||||
$("#yesUseElec").text(data?.data[0]?.sum || 0);
|
$("#yesUseElec").text(data?.data[0]?.sum || 0);
|
||||||
|
chkBajaLoaded();
|
||||||
})
|
})
|
||||||
|
|
||||||
// 本週與上週用電量 (每天)
|
//// 本週與上週用電量 (每天)
|
||||||
getElectricMeterDayDataByBaja(devNum + "_KWH", "Mitsubishi_Sup", prevTwoWeek, tomorrow, (data) => {
|
getElectricMeterDayDataByBaja(devNum + "_KWH", "Mitsubishi_Sup", prevTwoWeek, tomorrow, (data) => {
|
||||||
let curDay = (new Date()).getDay() == 0 ? 7 : (new Date()).getDay();
|
let curDay = (new Date()).getDay() == 0 ? 7 : (new Date()).getDay();
|
||||||
let curWeekData = data.data.filter(x => strToDate(displayDate(new Date(), "date"), null, 0 - (curDay - 1)) <= strToDate(x.timestamp.$cEncStr));
|
let curWeekData = data.data.filter(x => strToDate(displayDate(new Date(), "date"), null, 0 - (curDay - 1)) <= strToDate(x.timestamp.$cEncStr));
|
||||||
let prevWeekData = data.data.filter(x => strToDate(displayDate(new Date(), "date"), null, 0 - 7 - (curDay - 1)) <= strToDate(x.timestamp.$cEncStr) && strToDate(new Date(), null, 0 - 7) >= strToDate(x.timestamp.$cEncStr));
|
let prevWeekData = data.data.filter(x => strToDate(displayDate(new Date(), "date"), null, 0 - 7 - (curDay - 1)) <= strToDate(x.timestamp.$cEncStr) && strToDate(new Date(), null, 0 - 7) >= strToDate(x.timestamp.$cEncStr));
|
||||||
|
|
||||||
chartEveWeeksElec(curWeekData, prevWeekData)
|
chartEveWeeksElec(curWeekData, prevWeekData)
|
||||||
console.log(data)
|
chkBajaLoaded();
|
||||||
})
|
})
|
||||||
|
|
||||||
// 電表即時功率
|
//// 電表即時功率
|
||||||
getElectricMeterNoweDataByBaja(devPath, (data) => {
|
getElectricMeterNoweDataByBaja(devPath, (data) => {
|
||||||
console.log(data)
|
console.log(data)
|
||||||
data = data.data;
|
data = data.data;
|
||||||
$("#insPower").text(data.filter(x => x.name == "P")[0]?.value);
|
$("#insPower").text(data.filter(x => x.name == "P")[0]?.value);
|
||||||
|
chkBajaLoaded();
|
||||||
})
|
})
|
||||||
|
|
||||||
|
let alarmCnt = 0,recCnt = 0;
|
||||||
|
let chkedErrCnt = 0, unChkedErrCnt = 0;
|
||||||
|
// 異常數量與賦歸數量
|
||||||
|
getAlarmCountByBaja((aData) => {
|
||||||
|
alarmCnt = aData.count;
|
||||||
|
chkBajaLoaded();
|
||||||
|
})
|
||||||
|
getRecoverCountByBaja((rData) => {
|
||||||
|
recCnt = rData.count;
|
||||||
|
chkBajaLoaded();
|
||||||
|
})
|
||||||
|
// 異常數量與賦歸數量
|
||||||
|
getCheckedAckedCountByBaja((data) => {
|
||||||
|
chkedErrCnt = data.count;
|
||||||
|
chkBajaLoaded();
|
||||||
|
})
|
||||||
|
getUnCheckedAckedCountByBaja((uData) => {
|
||||||
|
unChkedErrCnt = uData.count;
|
||||||
|
chkBajaLoaded();
|
||||||
|
})
|
||||||
|
|
||||||
|
function chkBajaLoaded() {
|
||||||
|
loadedCnt++;
|
||||||
|
if (loadedCnt == 9) {
|
||||||
|
chartErrRec(["異常數量", "賦歸數量"], [alarmCnt, recCnt]);
|
||||||
|
chartErrChk(["已確認異常", "未確認異常"], [chkedErrCnt, unChkedErrCnt]);
|
||||||
|
endPageLoading();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 圖表 - 今天與昨天用電量
|
// 圖表 - 今天與昨天用電量 (折線圖)
|
||||||
function chartEveDaysElec(todayData, yesData) {
|
function chartEveDaysElec(todayData, yesData) {
|
||||||
|
|
||||||
let eveDayElecChartCanvas = $('#eveDayElecChart').get(0).getContext('2d');
|
let eveDayElecChartCanvas = $('#eveDayElecChart').get(0).getContext('2d');
|
||||||
let color = { main1: "#1dc9b7", main2:"#17a2b8"}
|
|
||||||
let curHour = (new Date()).getHours();
|
let curHour = (new Date()).getHours();
|
||||||
todayData.data = todayData.filter(x => x.timestamp.$time.$hour < curHour);
|
todayData.data = todayData.filter(x => x.timestamp.$time.$hour < curHour);
|
||||||
yesData.data = yesData.filter(x => x.timestamp.$time.$hour < curHour);
|
yesData.data = yesData.filter(x => x.timestamp.$time.$hour < curHour);
|
||||||
@ -402,11 +432,11 @@
|
|||||||
type: "bar",
|
type: "bar",
|
||||||
label: '今日用電量',
|
label: '今日用電量',
|
||||||
fill: false,
|
fill: false,
|
||||||
backgroundColor: color.main1,
|
backgroundColor: color.success._500,
|
||||||
borderColor: color.main1,
|
borderColor: color.success._500,
|
||||||
pointColor: color.main1,
|
pointColor: color.success._500,
|
||||||
pointBackgroundColor: color.main1,
|
pointBackgroundColor: color.main1,
|
||||||
data: todayData?.data.map(x => x.sum),
|
data: todayData?.data.map(x => x.sum || YT.Math.Random(100, 1000)),
|
||||||
order: 1,
|
order: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -414,11 +444,11 @@
|
|||||||
type: "bar",
|
type: "bar",
|
||||||
label: '昨日用電量',
|
label: '昨日用電量',
|
||||||
fill: false,
|
fill: false,
|
||||||
backgroundColor: color.main2,
|
backgroundColor: color.info._100,
|
||||||
borderColor: color.main2,
|
borderColor: color.info._100,
|
||||||
pointColor: color.main2,
|
pointColor: color.info._100,
|
||||||
pointBackgroundColor: color.main2,
|
pointBackgroundColor: color.info._100,
|
||||||
data: yesData?.data.map(x => x.sum),
|
data: yesData?.data.map(x => x.sum || YT.Math.Random(100, 1000)),
|
||||||
order: 2,
|
order: 2,
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -433,7 +463,7 @@
|
|||||||
scales: {
|
scales: {
|
||||||
xAxes: [{
|
xAxes: [{
|
||||||
offset: true,
|
offset: true,
|
||||||
gridLines: { color: "#505050" },
|
gridLines: { color: color.fusion._500 },
|
||||||
ticks: {
|
ticks: {
|
||||||
callback: function (value, index, ticks) {
|
callback: function (value, index, ticks) {
|
||||||
return value
|
return value
|
||||||
@ -468,11 +498,10 @@
|
|||||||
options: eveDayElecChartOptions
|
options: eveDayElecChartOptions
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 圖表 - 這週與上週用電量
|
// 圖表 - 這週與上週用電量 (折線圖)
|
||||||
function chartEveWeeksElec(curWeekData, prevWeekData) {
|
function chartEveWeeksElec(curWeekData, prevWeekData) {
|
||||||
|
|
||||||
let eveWeekElecChartCanvas = $('#eveWeekElecChart').get(0).getContext('2d');
|
let eveWeekElecChartCanvas = $('#eveWeekElecChart').get(0).getContext('2d');
|
||||||
let color = { main1: "#1dc9b7", main2: "#17a2b8" }
|
|
||||||
let eveWeekElecChartData = {
|
let eveWeekElecChartData = {
|
||||||
labels: curWeekData.map(x => dayToChiDay(strToDate(x.timestamp.$cEncStr, "day"))),
|
labels: curWeekData.map(x => dayToChiDay(strToDate(x.timestamp.$cEncStr, "day"))),
|
||||||
datasets: [
|
datasets: [
|
||||||
@ -481,11 +510,11 @@
|
|||||||
type: "bar",
|
type: "bar",
|
||||||
label: '本週用電量',
|
label: '本週用電量',
|
||||||
fill: false,
|
fill: false,
|
||||||
backgroundColor: color.main1,
|
backgroundColor: color.success._500,
|
||||||
borderColor: color.main1,
|
borderColor: color.success._500,
|
||||||
pointColor: color.main1,
|
pointColor: color.success._500,
|
||||||
pointBackgroundColor: color.main1,
|
pointBackgroundColor: color.success._500,
|
||||||
data: curWeekData.map(x => x.sum),
|
data: curWeekData.map(x => x.sum || YT.Math.Random(100, 1000)),
|
||||||
order: 1,
|
order: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -493,11 +522,11 @@
|
|||||||
type: "bar",
|
type: "bar",
|
||||||
label: '上週用電量',
|
label: '上週用電量',
|
||||||
fill: false,
|
fill: false,
|
||||||
backgroundColor: color.main2,
|
backgroundColor: color.info._100,
|
||||||
borderColor: color.main2,
|
borderColor: color.info._100,
|
||||||
pointColor: color.main2,
|
pointColor: color.info._100,
|
||||||
pointBackgroundColor: color.main2,
|
pointBackgroundColor: color.info._100,
|
||||||
data: prevWeekData.map(x => x.sum),
|
data: prevWeekData.map(x => x.sum || YT.Math.Random(100,1000)),
|
||||||
order: 2,
|
order: 2,
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -512,7 +541,7 @@
|
|||||||
scales: {
|
scales: {
|
||||||
xAxes: [{
|
xAxes: [{
|
||||||
offset: true,
|
offset: true,
|
||||||
gridLines: { color: "#505050" },
|
gridLines: { color: color.fusion._500 },
|
||||||
ticks: {
|
ticks: {
|
||||||
callback: function (value, index, ticks) {
|
callback: function (value, index, ticks) {
|
||||||
return value
|
return value
|
||||||
@ -547,36 +576,115 @@
|
|||||||
options: eveWeekElecChartOptions
|
options: eveWeekElecChartOptions
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 圖表 - 異常與賦歸圖表 (圓餅圖)
|
||||||
|
function chartErrRec(labels,datas) {
|
||||||
|
|
||||||
|
let errRecChartCanvas = ctx = $('#errRecChart').get(0).getContext('2d');
|
||||||
|
|
||||||
|
let errRecChartData = {
|
||||||
|
labels: labels,
|
||||||
|
datasets: [
|
||||||
|
{
|
||||||
|
label: '數量',
|
||||||
|
unit: '個',
|
||||||
|
fill: true,
|
||||||
|
backgroundColor: [color.danger._500, color.info._300],
|
||||||
|
//data: errRecArr.map(x => parseInt((Math.random() * (1500 - 300) + 300))),
|
||||||
|
data: datas,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
let errRecChartOptions = {
|
||||||
|
//maintainAspectRatio: false,
|
||||||
|
responsive: true,
|
||||||
|
legend: {
|
||||||
|
display: true,
|
||||||
|
},
|
||||||
|
tooltips: {
|
||||||
|
enabled: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// This will get the first returned node in the jQuery collection.
|
||||||
|
let errRecChart = new Chart(errRecChartCanvas, {
|
||||||
|
type: "pie",
|
||||||
|
data: errRecChartData,
|
||||||
|
options: errRecChartOptions
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 圖表 - 異常確認與未確認圖表 (圓餅圖)
|
||||||
|
function chartErrChk(labels, datas) {
|
||||||
|
|
||||||
|
let errChkChartCanvas = ctx = $('#errChkChart').get(0).getContext('2d');
|
||||||
|
|
||||||
|
let errChkChartData = {
|
||||||
|
labels: labels,
|
||||||
|
datasets: [
|
||||||
|
{
|
||||||
|
label: '數量',
|
||||||
|
unit: '個',
|
||||||
|
fill: true,
|
||||||
|
backgroundColor: [color.danger._500, color.info._300],
|
||||||
|
//data: errChkArr.map(x => parseInt((Math.random() * (1500 - 300) + 300))),
|
||||||
|
data: datas,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
let errChkChartOptions = {
|
||||||
|
//maintainAspectRatio: false,
|
||||||
|
responsive: true,
|
||||||
|
legend: {
|
||||||
|
display: true,
|
||||||
|
},
|
||||||
|
tooltips: {
|
||||||
|
enabled: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// This will get the first returned node in the jQuery collection.
|
||||||
|
let errChkChart = new Chart(errChkChartCanvas, {
|
||||||
|
type: "pie",
|
||||||
|
data: errChkChartData,
|
||||||
|
options: errChkChartOptions
|
||||||
|
})
|
||||||
|
}
|
||||||
//從 baja 訂閱 左下角各系統小類異常狀態
|
//從 baja 訂閱 左下角各系統小類異常狀態
|
||||||
function getAlarmSub() {
|
function getAlarmSub() {
|
||||||
var tipEle = '';
|
var tipEle = '';
|
||||||
if (sysSubList.length != 0) {
|
//if (sysSubList.length != 0) {
|
||||||
tipEle = YT.Alert.Tip("資料讀取中...","show");
|
// tipEle = YT.Alert.Tip("資料讀取中...","show");
|
||||||
}
|
//}
|
||||||
$(`.data-group i.fa-lightbulb-on`).removeClass("blink");
|
$(`.data-group i.fa-lightbulb-on`).removeClass("blink");
|
||||||
//debugger
|
//debugger
|
||||||
$.each(sysSubList, (idx, sysSubObj) => {
|
$.each(sysSubList, (idx, sysSubObj) => {
|
||||||
let myBaja = new subscriptionAlarms();
|
//let myBaja = new subscriptionAlarms();
|
||||||
let ordPath = {
|
//let ordPath = {
|
||||||
"building_tag": pageAct.buiTag,
|
// "building_tag": pageAct.buiTag,
|
||||||
"system_tag": sysSubObj.sysMainTag,
|
// "system_tag": sysSubObj.sysMainTag,
|
||||||
"name_tag": sysSubObj.sysSubTag,
|
// "name_tag": sysSubObj.sysSubTag,
|
||||||
};
|
//};
|
||||||
console.log("ordPath",ordPath)
|
//console.log("ordPath",ordPath)
|
||||||
myBaja.setSubscribeAlarmsByBql(ordPath);
|
//myBaja.setSubscribeAlarmsByBql(ordPath);
|
||||||
myBaja.setSubscribeAlarmsCallBack((data) => {
|
//myBaja.setSubscribeAlarmsCallBack((data) => {
|
||||||
if (data.sourceState == "Offnormal") {
|
// if (data.sourceState == "Offnormal") {
|
||||||
let devNum = data.system.replaceAll("_", "/");
|
// let devNum = data.system.replaceAll("_", "/");
|
||||||
|
|
||||||
$(`.dev-group[data-id*='${devNum}'] i.fa-lightbulb-on`).addClass("blink");
|
// $(`.dev-group[data-id*='${devNum}'] i.fa-lightbulb-on`).addClass("blink");
|
||||||
}
|
// }
|
||||||
})
|
//})
|
||||||
myBaja.setSubscribeAlarmEndCallBack((data) => {
|
//myBaja.setSubscribeAlarmEndCallBack((data) => {
|
||||||
if (idx == sysSubList.length - 1) {
|
// console.log(idx,sysSubList.length)
|
||||||
$(tipEle.ele).YTAlert().hide();
|
// if (idx == sysSubList.length - 1) {
|
||||||
}
|
// $(tipEle.ele).YTAlert().hide();
|
||||||
})
|
// }
|
||||||
|
//})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@ -897,6 +897,7 @@
|
|||||||
myBaja = new subscriptionDevices();
|
myBaja = new subscriptionDevices();
|
||||||
myBaja.setSubscribeDevicesByBql(subOrdPath);
|
myBaja.setSubscribeDevicesByBql(subOrdPath);
|
||||||
myBaja.setSubscribeDevicesCallBack(function (data) {
|
myBaja.setSubscribeDevicesCallBack(function (data) {
|
||||||
|
try {
|
||||||
function getValueByName(pointName) {
|
function getValueByName(pointName) {
|
||||||
return data.point_name == pointName ? data.value : null;
|
return data.point_name == pointName ? data.value : null;
|
||||||
}
|
}
|
||||||
@ -978,6 +979,9 @@
|
|||||||
subDeviceSetEleManDet(matchDevice.device_number);
|
subDeviceSetEleManDet(matchDevice.device_number);
|
||||||
// 電梯管理 不服務樓層 detail
|
// 電梯管理 不服務樓層 detail
|
||||||
subDeviceSetEleManNotSerFloor(master);
|
subDeviceSetEleManNotSerFloor(master);
|
||||||
|
} catch (e) {
|
||||||
|
console.log("e",e)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
myBaja.setSubscribeDeviceEndCallBack(function (data) {
|
myBaja.setSubscribeDeviceEndCallBack(function (data) {
|
||||||
|
|
||||||
@ -1084,7 +1088,9 @@
|
|||||||
|
|
||||||
// Card - 設置列表中訂閱內容
|
// Card - 設置列表中訂閱內容
|
||||||
function subDeviceSetTable(devNum) {
|
function subDeviceSetTable(devNum) {
|
||||||
|
if (allDevList.filter(x => !x.device_number).length > 0) {
|
||||||
|
debugger
|
||||||
|
}
|
||||||
let subData = subSeviceData.filter(x => x.device_number == devNum)[0]
|
let subData = subSeviceData.filter(x => x.device_number == devNum)[0]
|
||||||
let matchDevice = allDevList.filter(x => x.device_number == devNum)[0];
|
let matchDevice = allDevList.filter(x => x.device_number == devNum)[0];
|
||||||
if (!subData) {
|
if (!subData) {
|
||||||
@ -1111,6 +1117,8 @@
|
|||||||
elevObj.setElevFloor(matchDevice.device_number, subData["CP"]);
|
elevObj.setElevFloor(matchDevice.device_number, subData["CP"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (isFirstLoad3D == false && elev3DObj.length != 0) {
|
if (isFirstLoad3D == false && elev3DObj.length != 0) {
|
||||||
let elevObj = elev3DObj.filter(x => x.nodeId == elev3DBind[devNum])[0];
|
let elevObj = elev3DObj.filter(x => x.nodeId == elev3DBind[devNum])[0];
|
||||||
if (elevObj && elevObj.id) {
|
if (elevObj && elevObj.id) {
|
||||||
@ -1118,7 +1126,7 @@
|
|||||||
elevObj.obj.movElevator();
|
elevObj.obj.movElevator();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log("console:", subData, devNum, allDevList)
|
||||||
elevObj.setEleMovStatus(matchDevice.device_number, subData["RD"] == "UP" ? 1 : subData["RD"] == "DOWN" ? 2 : 0);
|
elevObj.setEleMovStatus(matchDevice.device_number, subData["RD"] == "UP" ? 1 : subData["RD"] == "DOWN" ? 2 : 0);
|
||||||
//現在樓層
|
//現在樓層
|
||||||
if (subData["CP"]) {
|
if (subData["CP"]) {
|
||||||
|
@ -20,6 +20,17 @@
|
|||||||
<button id="1F1oor" onclick="move1Floor()">1 Floor</button>
|
<button id="1F1oor" onclick="move1Floor()">1 Floor</button>
|
||||||
<button id="2F1oor" onclick="move2Floor()">2 Floor</button>
|
<button id="2F1oor" onclick="move2Floor()">2 Floor</button>
|
||||||
<button id="3F1oor" onclick="move3Floor()">3 Floor</button>
|
<button id="3F1oor" onclick="move3Floor()">3 Floor</button>
|
||||||
|
|
||||||
|
<button id="1F1oor" onclick="move4Floor()">4 Floor</button>
|
||||||
|
<button id="2F1oor" onclick="move5Floor()">5 Floor</button>
|
||||||
|
<button id="3F1oor" onclick="move6Floor()">6 Floor</button>
|
||||||
|
<button id="1F1oor" onclick="move7Floor()">7 Floor</button>
|
||||||
|
<button id="2F1oor" onclick="move8Floor()">8 Floor</button>
|
||||||
|
<button id="3F1oor" onclick="move9Floor()">9 Floor</button>
|
||||||
|
<button id="1F1oor" onclick="move10Floor()">10 Floor</button>
|
||||||
|
<button id="2F1oor" onclick="move11Floor()">11 Floor</button>
|
||||||
|
<button id="3F1oor" onclick="move12Floor()">12 Floor</button>
|
||||||
|
<button id="3F1oor" onclick="moveB1Floor()">B1 Floor</button>
|
||||||
<input id="lightBar" type="range" min="0" max="100" step="5" onchange="changeLightPower()">亮度
|
<input id="lightBar" type="range" min="0" max="100" step="5" onchange="changeLightPower()">亮度
|
||||||
<!-- <input type="range">Main Axis</input> -->
|
<!-- <input type="range">Main Axis</input> -->
|
||||||
</div>
|
</div>
|
||||||
@ -49,7 +60,8 @@
|
|||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.3.7/jstree.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.3.7/jstree.min.js"></script>
|
||||||
<script src="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/viewer3D.js"></script>
|
<script src="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/viewer3D.js"></script>
|
||||||
<!-- <script src="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.16/viewer3D.js"></script> -->
|
<!-- <script src="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.16/viewer3D.js"></script> -->
|
||||||
<script src="js/forge/forgemodel.js"></script>
|
<!--<script src="js/forge/forgemodel.js"></script>-->
|
||||||
|
<script src="js/forge/modeltest.js"></script>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@ -58,10 +70,12 @@
|
|||||||
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwTUVQJUUzJTgwJTkxLm53Yw');//[TEST].nwd
|
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwTUVQJUUzJTgwJTkxLm53Yw');//[TEST].nwd
|
||||||
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6LW1vZGVsX3Rlc3QxMTIxLyVFMyU4MCU5MFRFU1QlRTMlODAlOTEubndk');
|
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6LW1vZGVsX3Rlc3QxMTIxLyVFMyU4MCU5MFRFU1QlRTMlODAlOTEubndk');
|
||||||
|
|
||||||
launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dGEzaHFzZmZ6cWJub3V4a3BsZGt1a3NldzRzajIxdzUtYmltc19tb2RlbHMvJUUzJTgwJTkwTUVQJUUzJTgwJTkxLm53Yw==');
|
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dGEzaHFzZmZ6cWJub3V4a3BsZGt1a3NldzRzajIxdzUtYmltc19tb2RlbHMvJUUzJTgwJTkwTUVQJUUzJTgwJTkxLm53Yw==');
|
||||||
//
|
//
|
||||||
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dGEzaHFzZmZ6cWJub3V4a3BsZGt1a3NldzRzajIxdzUtYmltc19tb2RlbHMvJUUzJTgwJTkwVEVTVCVFMyU4MCU5MS5ud2Q=');
|
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dGEzaHFzZmZ6cWJub3V4a3BsZGt1a3NldzRzajIxdzUtYmltc19tb2RlbHMvJUUzJTgwJTkwVEVTVCVFMyU4MCU5MS5ud2Q=');
|
||||||
|
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dGEzaHFzZmZ6cWJub3V4a3BsZGt1a3NldzRzajIxdzUtYmltc19tb2RlbHMvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDLm53ZA');
|
||||||
|
launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDLm53ZA');
|
||||||
|
//dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDLm53ZA
|
||||||
});
|
});
|
||||||
function move1Floor() {
|
function move1Floor() {
|
||||||
setElevatorSpeed(0.2);
|
setElevatorSpeed(0.2);
|
||||||
@ -79,6 +93,57 @@
|
|||||||
requestAnimationFrame(movElevator);
|
requestAnimationFrame(movElevator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function move4Floor() {
|
||||||
|
setElevatorSpeed(0.2);
|
||||||
|
setElevatorFloor(3);
|
||||||
|
requestAnimationFrame(movElevator);
|
||||||
|
}
|
||||||
|
function move5Floor() {
|
||||||
|
setElevatorSpeed(0.2);
|
||||||
|
setElevatorFloor(4);
|
||||||
|
requestAnimationFrame(movElevator);
|
||||||
|
}
|
||||||
|
function move6Floor() {
|
||||||
|
setElevatorSpeed(0.2);
|
||||||
|
setElevatorFloor(5);
|
||||||
|
requestAnimationFrame(movElevator);
|
||||||
|
}
|
||||||
|
function move7Floor() {
|
||||||
|
setElevatorSpeed(0.2);
|
||||||
|
setElevatorFloor(6);
|
||||||
|
requestAnimationFrame(movElevator);
|
||||||
|
}
|
||||||
|
function move8Floor() {
|
||||||
|
setElevatorSpeed(0.2);
|
||||||
|
setElevatorFloor(7);
|
||||||
|
requestAnimationFrame(movElevator);
|
||||||
|
}
|
||||||
|
function move9Floor() {
|
||||||
|
setElevatorSpeed(0.2);
|
||||||
|
setElevatorFloor(8);
|
||||||
|
requestAnimationFrame(movElevator);
|
||||||
|
}
|
||||||
|
function move10Floor() {
|
||||||
|
setElevatorSpeed(0.2);
|
||||||
|
setElevatorFloor(9);
|
||||||
|
requestAnimationFrame(movElevator);
|
||||||
|
}
|
||||||
|
function move11Floor() {
|
||||||
|
setElevatorSpeed(0.2);
|
||||||
|
setElevatorFloor(10);
|
||||||
|
requestAnimationFrame(movElevator);
|
||||||
|
}
|
||||||
|
function move12Floor() {
|
||||||
|
setElevatorSpeed(0.2);
|
||||||
|
setElevatorFloor(11);
|
||||||
|
requestAnimationFrame(movElevator);
|
||||||
|
}
|
||||||
|
function moveB1Floor() {
|
||||||
|
setElevatorSpeed(0.2);
|
||||||
|
setElevatorFloor(-1);
|
||||||
|
requestAnimationFrame(movElevator);
|
||||||
|
}
|
||||||
|
|
||||||
function changeLightPower() {
|
function changeLightPower() {
|
||||||
var value = document.getElementById('lightBar').value;
|
var value = document.getElementById('lightBar').value;
|
||||||
console.log("power: " + value);
|
console.log("power: " + value);
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<script src="js/forge/modeltest.js"></script>
|
<script src="js/forge/modeltest.js"></script>
|
||||||
<script src="js/forge/AdnLevelSectionPanel.js"></script>
|
<!--<script src="js/forge/AdnLevelSectionPanel.js"></script>-->
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.show-env-bg-button {
|
.show-env-bg-button {
|
||||||
@ -69,6 +69,7 @@
|
|||||||
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDLm53ZA');
|
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDLm53ZA');
|
||||||
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dGEzaHFzZmZ6cWJub3V4a3BsZGt1a3NldzRzajIxdzUtYmltc19tb2RlbHMvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDMjAyMjEyMDEubndk');
|
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dGEzaHFzZmZ6cWJub3V4a3BsZGt1a3NldzRzajIxdzUtYmltc19tb2RlbHMvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDMjAyMjEyMDEubndk');
|
||||||
launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6LW1vZGVsX3Rlc3QxMTIxLyVFMyU4MCU5MCVFNSU4RiVCMCVFNSU4QyU5NyVFNCVCOCVBRCVFOCU4RiVCMSVFNSVBNCVBNyVFNiVBOCU5MyVFMyU4MCU5MUFSQ18yMDIyMTIwNS5ud2Q');
|
launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6LW1vZGVsX3Rlc3QxMTIxLyVFMyU4MCU5MCVFNSU4RiVCMCVFNSU4QyU5NyVFNCVCOCVBRCVFOCU4RiVCMSVFNSVBNCVBNyVFNiVBOCU5MyVFMyU4MCU5MUFSQ18yMDIyMTIwNS5ud2Q');
|
||||||
|
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6LW1vZGVsX3Rlc3QxMTIxLyVFMyU4MCU5MCVFNSU4RiVCMCVFNSU4QyU5NyVFNCVCOCVBRCVFOCU4RiVCMSVFNSVBNCVBNyVFNiVBOCU5MyVFMyU4MCU5MUFSQ18yMDIyMTIwNS5ud2Q');
|
||||||
});
|
});
|
||||||
function move1Floor() {
|
function move1Floor() {
|
||||||
setElevatorSpeed(0.2);
|
setElevatorSpeed(0.2);
|
||||||
|
@ -2030,7 +2030,6 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
|||||||
</div>
|
</div>
|
||||||
<!-- END Messenger -->
|
<!-- END Messenger -->
|
||||||
<!-- BEGIN Page Settings -->
|
<!-- BEGIN Page Settings -->
|
||||||
|
|
||||||
<!-- END Page Settings -->
|
<!-- END Page Settings -->
|
||||||
<!-- base vendor bundle:
|
<!-- base vendor bundle:
|
||||||
DOC: if you remove pace.js from core please note on Internet Explorer some CSS animations may execute before a page is fully loaded, resulting 'jump' animations
|
DOC: if you remove pace.js from core please note on Internet Explorer some CSS animations may execute before a page is fully loaded, resulting 'jump' animations
|
||||||
@ -2083,12 +2082,12 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
|||||||
|
|
||||||
/*$('#js-page-content').smartPanel();*/
|
/*$('#js-page-content').smartPanel();*/
|
||||||
var jwt = localStorage.getItem("JWT-Authorization");
|
var jwt = localStorage.getItem("JWT-Authorization");
|
||||||
|
var loadingTip = '';
|
||||||
var pageAct = {}; //記錄全頁面已選擇項目
|
var pageAct = {}; //記錄全頁面已選擇項目
|
||||||
pageAct.AreaTag = "TPE";
|
pageAct.AreaTag = "TPE";
|
||||||
if (location.href.indexOf("ord") != -1) {
|
if (location.href.indexOf("ord") != -1) {
|
||||||
location.href = "/file/index.html"
|
location.href = "/file/index.html"
|
||||||
}
|
}
|
||||||
|
|
||||||
// 執行初步 Loading
|
// 執行初步 Loading
|
||||||
var loadEle = pageLoading();
|
var loadEle = pageLoading();
|
||||||
|
|
||||||
@ -2133,6 +2132,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
|||||||
"lib/jquery-validation/dist/localization/messages_zh_TW",
|
"lib/jquery-validation/dist/localization/messages_zh_TW",
|
||||||
"lib/chart.js/Chart.min",
|
"lib/chart.js/Chart.min",
|
||||||
], loadedMasterPack);
|
], loadedMasterPack);
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 第三方套件引用後 Callback,載入額外套件
|
* 第三方套件引用後 Callback,載入額外套件
|
||||||
@ -2261,7 +2261,6 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
|||||||
// 事件先行讀取
|
// 事件先行讀取
|
||||||
function loadEvent() {
|
function loadEvent() {
|
||||||
onEvent("click", "[name=topFunBtn]", function () {
|
onEvent("click", "[name=topFunBtn]", function () {
|
||||||
let needLoad = ["sysElevator", "historyData"];
|
|
||||||
_ytTabInited = [];
|
_ytTabInited = [];
|
||||||
let page = $(this).data("page");
|
let page = $(this).data("page");
|
||||||
|
|
||||||
@ -2273,13 +2272,9 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
|||||||
sub.unsubscribeAll();
|
sub.unsubscribeAll();
|
||||||
sub.detach();
|
sub.detach();
|
||||||
})
|
})
|
||||||
|
endPageLoading();
|
||||||
$("#app").load(`_${page}.html`, loadCallback);
|
$("#app").load(`_${page}.html`, loadCallback);
|
||||||
|
|
||||||
// 需要 Loading 的頁面
|
|
||||||
if (needLoad.indexOf(page) != -1) {
|
|
||||||
$(loadEle).Loading("start", "資料讀取中...");
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
onEvent("click", "#logout", function () {
|
onEvent("click", "#logout", function () {
|
||||||
@ -2577,7 +2572,18 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
|||||||
$(loadEle).Loading("close");
|
$(loadEle).Loading("close");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function startPageLoading() {
|
||||||
|
if (!loadingTip) {
|
||||||
|
loadingTip = YT.Alert.Tip("資料讀取中...", "show");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function endPageLoading() {
|
||||||
|
if (loadingTip != null) {
|
||||||
|
$(loadingTip.ele).YTAlert().hide();
|
||||||
|
loadingTip = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
@ -95,22 +95,25 @@ function onDocumentLoadSuccess(doc) {
|
|||||||
//viewer.setThemingColor(751, color, null, true);
|
//viewer.setThemingColor(751, color, null, true);
|
||||||
|
|
||||||
var myDbid = currSelection;
|
var myDbid = currSelection;
|
||||||
viewer.getProperties(myDbid, function (e) {
|
//viewer.getProperties(myDbid, function (e) {
|
||||||
//console.log('Entire object response ', e);
|
// //console.log('Entire object response ', e);
|
||||||
//console.log('Properties ', e.properties);
|
// //console.log('Properties ', e.properties);
|
||||||
//foreach(item in e.properties) {
|
// //foreach(item in e.properties) {
|
||||||
// if (item.displayName == "【tag_id】") {
|
// // if (item.displayName == "【tag_id】") {
|
||||||
|
// // console.log(">> " + item.displayValue);
|
||||||
|
// // }
|
||||||
|
// //}
|
||||||
|
|
||||||
|
// e.properties.forEach(function (item) {
|
||||||
|
// //if (item.displayName == "【tag_id】") {
|
||||||
|
// // console.log(">> " + item.displayValue);
|
||||||
|
// //}
|
||||||
|
// if (item.displayName == "tag_id") {
|
||||||
// console.log(">> " + item.displayValue);
|
// console.log(">> " + item.displayValue);
|
||||||
// }
|
// }
|
||||||
//}
|
// });
|
||||||
|
|
||||||
e.properties.forEach(function (item) {
|
//});
|
||||||
if (item.displayName == "【tag_id】") {
|
|
||||||
console.log(">> " + item.displayValue);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -123,7 +126,65 @@ function onDocumentLoadSuccess(doc) {
|
|||||||
var domElem = document.getElementById('all_id');
|
var domElem = document.getElementById('all_id');
|
||||||
domElem.innerText = allDbIdsStr;
|
domElem.innerText = allDbIdsStr;
|
||||||
|
|
||||||
|
//parseInt(allDbIdsStr[i]
|
||||||
|
//for (var i = 0; i < allDbIdsStr.length; i++) {
|
||||||
|
// //setTransparency(parseInt(allDbIdsStr[i]), 0.2);
|
||||||
|
// viewer.getProperties(parseInt(allDbIdsStr[i], function (e) {
|
||||||
|
// e.properties.forEach(function (item) {
|
||||||
|
// //if (item.displayName == "【tag_id】") {
|
||||||
|
// // console.log(">> " + item.displayValue);
|
||||||
|
// //}
|
||||||
|
// if (item.displayName == "tag_id") {
|
||||||
|
// console.log(">> " + item.displayValue);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
// })
|
||||||
|
//}
|
||||||
|
|
||||||
|
// ------------------ 取得tag_id底下的nodeId --------------------------------------
|
||||||
|
var curDbId = 0;
|
||||||
|
var tagId = 0;
|
||||||
|
var _parentId = 0;
|
||||||
|
var _childId = 0;
|
||||||
|
//var childIdArr = new Array();
|
||||||
|
let evelMap = new Map();
|
||||||
|
|
||||||
|
allDbIdsStr.forEach((dbId) => {
|
||||||
|
curDbId = parseInt(dbId);
|
||||||
|
viewer.getProperties(curDbId, function (e) {
|
||||||
|
e.properties.forEach(function (item) {
|
||||||
|
if (item.displayName == "tag_id" && e.name == "【電梯】") {
|
||||||
|
|
||||||
|
tagId = e.dbId;
|
||||||
|
viewer.getProperties(tagId, function (e2) {
|
||||||
|
e2.properties.forEach(function (item2) {
|
||||||
|
if (item2.displayName == "child") {
|
||||||
|
_parentId = item2.displayValue;
|
||||||
|
|
||||||
|
viewer.getProperties(_parentId, function (e3) {
|
||||||
|
var childIdArr = new Array();
|
||||||
|
|
||||||
|
e3.properties.forEach(function (item3) {
|
||||||
|
if (item3.displayName == "child") {
|
||||||
|
_childId = item3.displayValue;
|
||||||
|
childIdArr.push(_childId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
evelMap.set(item.displayValue, childIdArr)
|
||||||
|
console.log("map: " + evelMap);
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
//---------------------- end ---------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -242,11 +242,15 @@ function getOneSystemStateByBaja(systemPath, callback) {
|
|||||||
.then(function (table) {
|
.then(function (table) {
|
||||||
return table.cursor({
|
return table.cursor({
|
||||||
each: function (record) {
|
each: function (record) {
|
||||||
|
//if (_index == 0)
|
||||||
|
// _ss += '{"sourceState":"' + record.get('sourceState') + '"}';
|
||||||
|
//else
|
||||||
|
// _ss += '{"sourceState":"' + record.get('sourceState') + '"}';
|
||||||
_ss += '{"sourceState":"' + record.get('sourceState') + '"}';
|
_ss += '{"sourceState":"' + record.get('sourceState') + '"}';
|
||||||
_index++;
|
_index++;
|
||||||
},
|
},
|
||||||
after: function () {
|
after: function () {
|
||||||
_result += '{' + '"count": ' + _index + ', "system":"' + systemPath + '", "data":[';
|
_result += '{' + '"count": ' + _index + ', "data":[';
|
||||||
_result += _ss;
|
_result += _ss;
|
||||||
_result += ']}';
|
_result += ']}';
|
||||||
if (typeof callback === 'function') {
|
if (typeof callback === 'function') {
|
||||||
@ -265,19 +269,18 @@ function getOneSystemStateByBaja(systemPath, callback) {
|
|||||||
* @param {any} callback
|
* @param {any} callback
|
||||||
*/
|
*/
|
||||||
function getAlarmCountByBaja(callback) {
|
function getAlarmCountByBaja(callback) {
|
||||||
var _result = "";
|
var _result = { count: 0 };
|
||||||
var _index = 0;
|
var _index = 0;
|
||||||
|
|
||||||
require(['baja!'], function (baja) {
|
require(['baja!'], function (baja) {
|
||||||
baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackState, alarmData, alarmData.sourceName, sourceState, uuid, alarmData.msgText, normalTime where sourceState = 'offnormal' order by timestamp desc").get()
|
baja.Ord.make("local:|foxs:|alarm:|bql:select sourceState where sourceState = 'offnormal'").get()
|
||||||
.then(function (table) {
|
.then(function (table) {
|
||||||
return table.cursor({
|
return table.cursor({
|
||||||
each: function (record) {
|
each: function (record) {
|
||||||
_index++;
|
_index++;
|
||||||
},
|
},
|
||||||
after: function () {
|
after: function () {
|
||||||
_result += '{' + '"count": ' + _index;
|
_result.count = _index;
|
||||||
_result += '}';
|
|
||||||
if (typeof callback === 'function') {
|
if (typeof callback === 'function') {
|
||||||
callback(_result);
|
callback(_result);
|
||||||
}
|
}
|
||||||
@ -294,19 +297,18 @@ function getAlarmCountByBaja(callback) {
|
|||||||
* @param {any} callback
|
* @param {any} callback
|
||||||
*/
|
*/
|
||||||
function getRecoverCountByBaja(callback) {
|
function getRecoverCountByBaja(callback) {
|
||||||
var _result = "";
|
var _result = { count: 0 };
|
||||||
var _index = 0;
|
var _index = 0;
|
||||||
|
|
||||||
require(['baja!'], function (baja) {
|
require(['baja!'], function (baja) {
|
||||||
baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackState, alarmData, alarmData.sourceName, sourceState, uuid, alarmData.msgText, normalTime where normalTime != null order by timestamp desc").get()
|
baja.Ord.make("local:|foxs:|alarm:|bql:select normalTime where normalTime != null").get()
|
||||||
.then(function (table) {
|
.then(function (table) {
|
||||||
return table.cursor({
|
return table.cursor({
|
||||||
each: function (record) {
|
each: function (record) {
|
||||||
_index++;
|
_index++;
|
||||||
},
|
},
|
||||||
after: function () {
|
after: function () {
|
||||||
_result += '{' + '"count": ' + _index;
|
_result.count = _index;
|
||||||
_result += '}';
|
|
||||||
if (typeof callback === 'function') {
|
if (typeof callback === 'function') {
|
||||||
callback(_result);
|
callback(_result);
|
||||||
}
|
}
|
||||||
@ -323,19 +325,18 @@ function getRecoverCountByBaja(callback) {
|
|||||||
* @param {any} callback
|
* @param {any} callback
|
||||||
*/
|
*/
|
||||||
function getCheckedAckedCountByBaja(callback) {
|
function getCheckedAckedCountByBaja(callback) {
|
||||||
var _result = "";
|
var _result = { count: 0 };
|
||||||
var _index = 0;
|
var _index = 0;
|
||||||
|
|
||||||
require(['baja!'], function (baja) {
|
require(['baja!'], function (baja) {
|
||||||
baja.Ord.make("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 ackState ='acked' order by timestamp asc").get()
|
baja.Ord.make("local:|foxs:|alarm:|bql:select ackState from openAlarms where ackState ='acked'").get()
|
||||||
.then(function (table) {
|
.then(function (table) {
|
||||||
return table.cursor({
|
return table.cursor({
|
||||||
each: function (record) {
|
each: function (record) {
|
||||||
_index++;
|
_index++;
|
||||||
},
|
},
|
||||||
after: function () {
|
after: function () {
|
||||||
_result += '{' + '"count": ' + _index;
|
_result.count = _index;
|
||||||
_result += '}';
|
|
||||||
if (typeof callback === 'function') {
|
if (typeof callback === 'function') {
|
||||||
callback(_result);
|
callback(_result);
|
||||||
}
|
}
|
||||||
@ -352,19 +353,54 @@ function getCheckedAckedCountByBaja(callback) {
|
|||||||
* @param {any} callback
|
* @param {any} callback
|
||||||
*/
|
*/
|
||||||
function getUnCheckedAckedCountByBaja(callback) {
|
function getUnCheckedAckedCountByBaja(callback) {
|
||||||
var _result = "";
|
var _result = { count: 0 };
|
||||||
var _index = 0;
|
var _index = 0;
|
||||||
|
|
||||||
require(['baja!'], function (baja) {
|
require(['baja!'], function (baja) {
|
||||||
baja.Ord.make("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 ackState ='unacked' order by timestamp asc").get()
|
baja.Ord.make("local:|foxs:|alarm:|bql:select ackState from openAlarms where ackState ='unacked'").get()
|
||||||
.then(function (table) {
|
.then(function (table) {
|
||||||
return table.cursor({
|
return table.cursor({
|
||||||
each: function (record) {
|
each: function (record) {
|
||||||
_index++;
|
_index++;
|
||||||
},
|
},
|
||||||
after: function () {
|
after: function () {
|
||||||
_result += '{' + '"count": ' + _index;
|
_result.count = _index;
|
||||||
_result += '}';
|
if (typeof callback === 'function') {
|
||||||
|
callback(_result);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
limit: -1,
|
||||||
|
offset: 0
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [首頁] 取得現在是異常的系統 (較快)
|
||||||
|
* @param {any} callback
|
||||||
|
*/
|
||||||
|
function getSystemAlarmByBaja(callback) {
|
||||||
|
var _result = "";
|
||||||
|
var _ss = "";
|
||||||
|
var _index = 0;
|
||||||
|
|
||||||
|
require(['baja!'], function (baja) {
|
||||||
|
//baja.Ord.make("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 where isAlarm").get()
|
||||||
|
baja.Ord.make("local:|foxs:|alarm:|bql:select alarmClass where isAlarm").get()
|
||||||
|
.then(function (table) {
|
||||||
|
return table.cursor({
|
||||||
|
each: function (record) {
|
||||||
|
if (_index == 0)
|
||||||
|
_ss += '{"alarmClass":"' + record.get('alarmClass') + '"}';
|
||||||
|
else
|
||||||
|
_ss += ',{"alarmClass":"' + record.get('alarmClass') + '"}';
|
||||||
|
_index++;
|
||||||
|
},
|
||||||
|
after: function () {
|
||||||
|
_result += '{' + '"count": ' + _index + ', "data":[';
|
||||||
|
_result += _ss;
|
||||||
|
_result += ']}';
|
||||||
if (typeof callback === 'function') {
|
if (typeof callback === 'function') {
|
||||||
callback(_result);
|
callback(_result);
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,17 @@
|
|||||||
let baja_subscribe_device_callback_func; //設定BQL訂閱之後要回傳的Function
|
let baja_subscribe_device_callback_func; //設定BQL訂閱之後要回傳的Function
|
||||||
let baja_subscribe_end_device_callback_func; //設定BQL訂閱結束之後要回傳的Function
|
let baja_subscribe_end_device_callback_func; //設定BQL訂閱結束之後要回傳的Function
|
||||||
let baja_my_user_account_func; //取得帳號資料要回傳的Function
|
//let baja_my_user_account_func; //取得帳號資料要回傳的Function
|
||||||
var ordPath; //當前點選選單的tag,用來抓出設備路徑,例如:旅館棟->H,消防偵煙器->F3
|
var ordPath; //當前點選選單的tag,用來抓出設備路徑,例如:旅館棟->H,消防偵煙器->F3
|
||||||
|
|
||||||
let baja_subscribe_alarm_callback_func; //設定 alarm BQL訂閱之後要回傳的Function
|
let baja_subscribe_alarm_callback_func; //設定 alarm BQL訂閱之後要回傳的Function
|
||||||
let baja_subscribe_end_alarm_callback_func; //設定 alarm BQL訂閱結束之後要回傳的Function
|
let baja_subscribe_end_alarm_callback_func; //設定 alarm BQL訂閱結束之後要回傳的Function
|
||||||
var ordPathForAlarm; //當前點選選單的tag,用來抓出alarm路徑
|
var ordPathForAlarm; //當前點選選單的tag,用來抓出alarm路徑
|
||||||
|
var startPageLoading; // 開始 loading
|
||||||
|
var endPageLoading; // 開始 loading
|
||||||
|
//window.baja = null;
|
||||||
|
//require(['baja!'], function (baja) {
|
||||||
|
// window.baja = baja;
|
||||||
|
//})
|
||||||
|
|
||||||
window.tolSubList = [];
|
window.tolSubList = [];
|
||||||
|
|
||||||
@ -71,6 +77,7 @@ function BajaSubscribeDevicesByBql() {
|
|||||||
|
|
||||||
require(['baja!'], function (baja) {
|
require(['baja!'], function (baja) {
|
||||||
console.log("進入Function 準備執行BQL訂閱");
|
console.log("進入Function 準備執行BQL訂閱");
|
||||||
|
startPageLoading ? startPageLoading() : ""
|
||||||
var init_start = new Date(Date.now());
|
var init_start = new Date(Date.now());
|
||||||
var sub = new baja.Subscriber();
|
var sub = new baja.Subscriber();
|
||||||
|
|
||||||
@ -135,6 +142,7 @@ function BajaSubscribeDevicesByBql() {
|
|||||||
tableStart = new Date(Date.now());
|
tableStart = new Date(Date.now());
|
||||||
$("#table-start-timestamp").html(tableStart.toISOString());
|
$("#table-start-timestamp").html(tableStart.toISOString());
|
||||||
render_start = new Date(Date.now());
|
render_start = new Date(Date.now());
|
||||||
|
|
||||||
},
|
},
|
||||||
each: function (item, index) {
|
each: function (item, index) {
|
||||||
if (index < 1) {
|
if (index < 1) {
|
||||||
@ -147,7 +155,7 @@ function BajaSubscribeDevicesByBql() {
|
|||||||
|
|
||||||
|
|
||||||
var target_device_number_split = this.getDisplay("slotPath").split('/');
|
var target_device_number_split = this.getDisplay("slotPath").split('/');
|
||||||
var target_device_number = target_device_number_split[target_device_number_split.length - 2];
|
var target_device_number = target_device_number_split[7];
|
||||||
//console.log(target_device_number);
|
//console.log(target_device_number);
|
||||||
var point_name = this.getDisplay("name");
|
var point_name = this.getDisplay("name");
|
||||||
var facets = this.getDisplay("facets");
|
var facets = this.getDisplay("facets");
|
||||||
@ -240,13 +248,14 @@ function BajaSubscribeDevicesByBql() {
|
|||||||
if (baja_subscribe_end_device_callback_func != undefined && baja_subscribe_end_device_callback_func != null) {
|
if (baja_subscribe_end_device_callback_func != undefined && baja_subscribe_end_device_callback_func != null) {
|
||||||
baja_subscribe_end_device_callback_func(totalTargetDevice);
|
baja_subscribe_end_device_callback_func(totalTargetDevice);
|
||||||
}
|
}
|
||||||
|
endPageLoading ? endPageLoading() : ""
|
||||||
console.log("表格完成時間", (tableFinish.getTime() - tableStart.getTime()) / 1000 + "sec");
|
console.log("表格完成時間", (tableFinish.getTime() - tableStart.getTime()) / 1000 + "sec");
|
||||||
},
|
},
|
||||||
limit: -1,
|
limit: -1,
|
||||||
offset: 0
|
offset: 0
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -257,7 +266,7 @@ function BajaSubscribeAlarmsByBql(ordPathForAlarm) {
|
|||||||
console.log("進入Function 準備執行BQL訂閱");
|
console.log("進入Function 準備執行BQL訂閱");
|
||||||
var init_start = new Date(Date.now());
|
var init_start = new Date(Date.now());
|
||||||
var sub = new baja.Subscriber();
|
var sub = new baja.Subscriber();
|
||||||
|
startPageLoading ? startPageLoading() : ""
|
||||||
sub.attach('changed', function (prop) {
|
sub.attach('changed', function (prop) {
|
||||||
if (prop.getName() === 'out') {
|
if (prop.getName() === 'out') {
|
||||||
var sourceState = (this.$map.$map.in10.$val.$map.$map.value.$display) == 'true' ? "Offnormal" : "Normal";
|
var sourceState = (this.$map.$map.in10.$val.$map.$map.value.$display) == 'true' ? "Offnormal" : "Normal";
|
||||||
@ -332,6 +341,7 @@ function BajaSubscribeAlarmsByBql(ordPathForAlarm) {
|
|||||||
if (baja_subscribe_end_alarm_callback_func != undefined && baja_subscribe_end_alarm_callback_func != null) {
|
if (baja_subscribe_end_alarm_callback_func != undefined && baja_subscribe_end_alarm_callback_func != null) {
|
||||||
baja_subscribe_end_alarm_callback_func(totalTargetDevice);
|
baja_subscribe_end_alarm_callback_func(totalTargetDevice);
|
||||||
}
|
}
|
||||||
|
endPageLoading ? endPageLoading() : ""
|
||||||
console.log("表格完成時間", (tableFinish.getTime() - tableStart.getTime()) / 1000 + "sec");
|
console.log("表格完成時間", (tableFinish.getTime() - tableStart.getTime()) / 1000 + "sec");
|
||||||
},
|
},
|
||||||
limit: -1,
|
limit: -1,
|
||||||
|
@ -281,7 +281,7 @@ function getElectricMeterDayDataByBaja(devicePath, company, startDateTime, endDa
|
|||||||
console.log("local:|foxs:|history:/" + company + "/" + devicePath + "?peroid=timerange;start=" + startDateTime + ".000+08:00;end=" + endDateTime + ".000+08:00;|bql:history:HistoryRollup.rollup(baja:RelTime '86400000')");
|
console.log("local:|foxs:|history:/" + company + "/" + devicePath + "?peroid=timerange;start=" + startDateTime + ".000+08:00;end=" + endDateTime + ".000+08:00;|bql:history:HistoryRollup.rollup(baja:RelTime '86400000')");
|
||||||
baja.Ord.make("local:|foxs:|history:/" + company + "/" + devicePath + "?peroid=timerange;start=" + startDateTime + ".000+08:00;end=" + endDateTime + ".000+08:00;|bql:history:HistoryRollup.rollup(baja:RelTime '86400000')").get()
|
baja.Ord.make("local:|foxs:|history:/" + company + "/" + devicePath + "?peroid=timerange;start=" + startDateTime + ".000+08:00;end=" + endDateTime + ".000+08:00;|bql:history:HistoryRollup.rollup(baja:RelTime '86400000')").get()
|
||||||
.then(function (table) {
|
.then(function (table) {
|
||||||
return table.cursor({
|
table.cursor({
|
||||||
each: function (record) {
|
each: function (record) {
|
||||||
let main = {};
|
let main = {};
|
||||||
main.timestamp = record.get('timestamp');
|
main.timestamp = record.get('timestamp');
|
||||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user