2022-11-15 18:47:16 +08:00
|
|
|
|
<style>
|
2022-11-23 17:19:28 +08:00
|
|
|
|
|
2022-11-15 18:47:16 +08:00
|
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
<div class="row">
|
2022-11-18 12:31:57 +08:00
|
|
|
|
<div class="col-sm-12 col-xl-5">
|
|
|
|
|
<div class="d-flex mb-4" style="gap:15px">
|
|
|
|
|
<div class="row m-0 align-items-center">
|
2022-11-21 18:47:47 +08:00
|
|
|
|
<span id="sysNorLight" class="circle-light mr-2 " data-light-type="normal"></span>
|
2022-11-18 12:31:57 +08:00
|
|
|
|
<label class="mb-0">正常</label>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="row m-0 align-items-center">
|
2022-11-21 18:47:47 +08:00
|
|
|
|
<span id="sysCloLight" class="circle-light mr-2" data-light-type="close"></span>
|
2022-11-18 12:31:57 +08:00
|
|
|
|
<label class="mb-0">關機</label>
|
2022-11-15 18:47:16 +08:00
|
|
|
|
</div>
|
2022-11-18 12:31:57 +08:00
|
|
|
|
<div class="row m-0 align-items-center">
|
2022-11-21 18:47:47 +08:00
|
|
|
|
<span id="sysErrLight" class="circle-light mr-2" data-light-type="error"></span>
|
2022-11-18 12:31:57 +08:00
|
|
|
|
<label class="mb-0">異常</label>
|
2022-11-15 18:47:16 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2022-11-18 12:31:57 +08:00
|
|
|
|
<div class="col-12 p-0" id="floDevList">
|
2022-11-15 18:47:16 +08:00
|
|
|
|
|
2022-11-18 12:31:57 +08:00
|
|
|
|
|
|
|
|
|
</div>
|
2022-11-15 18:47:16 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div class="col-sm-12 col-xl-7">
|
2022-11-18 12:31:57 +08:00
|
|
|
|
<!--<img src="img/clouds.png" class="img-fluid" style="min-height: 520px;">-->
|
2022-11-15 18:47:16 +08:00
|
|
|
|
<!--<a href="javascript:;" data-toggle="modal" data-target=".default-example-modal-right-lg">
|
|
|
|
|
<span class="badge border border-light bg-primary-700 position-absolute pos-top pos-left"><i class="fal fa-image fa-3x"></i></span></a>-->
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2022-11-23 15:38:52 +08:00
|
|
|
|
var allDevList = [];
|
2022-11-15 18:47:16 +08:00
|
|
|
|
$(function () {
|
2022-11-16 14:53:22 +08:00
|
|
|
|
getFloDevList();
|
2022-11-21 18:47:47 +08:00
|
|
|
|
setLightColor();
|
2022-11-23 15:38:52 +08:00
|
|
|
|
|
2022-11-23 17:19:28 +08:00
|
|
|
|
subDevice();
|
2022-11-15 18:47:16 +08:00
|
|
|
|
})
|
|
|
|
|
|
2022-11-23 17:19:28 +08:00
|
|
|
|
//baja 訂閱設備
|
|
|
|
|
function subDevice() {
|
2022-11-23 15:38:52 +08:00
|
|
|
|
myBaja = new subscriptionDevices();
|
|
|
|
|
var ordPath = {
|
|
|
|
|
"building_tag": pageAct.buiTag,
|
|
|
|
|
"system_tag": pageAct.sysMainTag,
|
|
|
|
|
"name_tag": pageAct.sysSubTag,
|
|
|
|
|
}
|
|
|
|
|
myBaja.setSubscribeDevicesByBql(ordPath);
|
|
|
|
|
myBaja.setSubscribeDevicesCallBack(function (data) {
|
|
|
|
|
|
|
|
|
|
let matchDevice = allDevList.filter(x => x.device_number.split("_")[x.device_number.split("_").length - 1] == data.device_number)[0];
|
|
|
|
|
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 == norDevPoiName && data.value == matchDevice.device_normal_point_value) {
|
|
|
|
|
//顯示正常燈號
|
|
|
|
|
$(`#${matchDevice.device_number}_status`).attr("data-light-type", "normal").data("light-type", "normal");
|
|
|
|
|
} else if (data.point_name == cloDevPoiName && data.value == matchDevice.device_close_point_value) {
|
|
|
|
|
$(`#${matchDevice.device_number}_status`).attr("data-light-type", "close").data("light-type", "close");
|
|
|
|
|
} else if (data.point_name == errDevPoiName && data.value == matchDevice.device_error_point_value) {
|
|
|
|
|
$(`#${matchDevice.device_number}_status`).attr("data-light-type", "error").data("light-type", "error");
|
|
|
|
|
}
|
|
|
|
|
setLightColor();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-21 18:47:47 +08:00
|
|
|
|
function setLightColor() {
|
|
|
|
|
$("[data-light-type]").each((index, ele) => {
|
|
|
|
|
let type = $(ele).data("light-type");
|
2022-11-23 17:19:28 +08:00
|
|
|
|
let isFlashing = false;
|
2022-11-21 18:47:47 +08:00
|
|
|
|
let color = "#000";
|
|
|
|
|
switch (type) {
|
|
|
|
|
case "normal":
|
|
|
|
|
color = pageAct.sysSubObj.device_normal_color ?? "var(--theme-success)";
|
2022-11-23 17:19:28 +08:00
|
|
|
|
isFlashing = pageAct.sysSubObj.device_normal_flashing == "1"
|
2022-11-21 18:47:47 +08:00
|
|
|
|
break;
|
|
|
|
|
case "close":
|
|
|
|
|
color = pageAct.sysSubObj.device_close_color ?? "var(--theme-secondary)";
|
2022-11-23 17:19:28 +08:00
|
|
|
|
isFlashing = pageAct.sysSubObj.device_close_flashing == "1"
|
2022-11-21 18:47:47 +08:00
|
|
|
|
break;
|
|
|
|
|
case "error":
|
|
|
|
|
color = pageAct.sysSubObj.device_error_color ?? "var(--theme-danger)";
|
2022-11-23 17:19:28 +08:00
|
|
|
|
isFlashing = pageAct.sysSubObj.device_error_flashing == "1"
|
2022-11-21 18:47:47 +08:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
$(ele).css("background-color", color);
|
2022-11-23 17:19:28 +08:00
|
|
|
|
if (isFlashing) {
|
|
|
|
|
$(ele).parents(".card.device-wrap").addClass("light-flash");
|
|
|
|
|
}
|
2022-11-21 18:47:47 +08:00
|
|
|
|
})
|
2022-11-18 18:30:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-11-16 14:53:22 +08:00
|
|
|
|
function getFloDevList() {
|
|
|
|
|
let url = baseApiUrl + "/api/Device/GetDeviceList";
|
|
|
|
|
let sendData = {
|
2022-11-17 15:32:39 +08:00
|
|
|
|
sub_system_tag: pageAct.sysSubTag,
|
2022-11-16 14:53:22 +08:00
|
|
|
|
building_tag: pageAct.buiTag,
|
|
|
|
|
floor_tag: pageAct.floTag,
|
|
|
|
|
};
|
|
|
|
|
objSendData.Data = sendData;
|
|
|
|
|
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
|
|
|
|
|
if (!res || res.code != "0000" || !res.data) {
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
let strHtml = ``;
|
|
|
|
|
$.each(res.data, (index, floObj) => {
|
2022-11-21 18:47:47 +08:00
|
|
|
|
strHtml += `<div class='d-flex justify-content-start mb-5' style="">`
|
2022-11-18 12:31:57 +08:00
|
|
|
|
strHtml += `<button id="floItemBtn${floObj.full_name}" type="button" class="btn btn-primary waves-effect waves-themed mr-5 align-self-center" >${floObj.full_name}</button>`
|
2022-11-16 14:53:22 +08:00
|
|
|
|
|
|
|
|
|
$.each(floObj.device_list, (index2, devObj) => {
|
2022-11-17 09:36:53 +08:00
|
|
|
|
console.log(">>>> url: " + baseImgUrl + " , img: " + varPathImg + ", icon: " + devObj.device_master_icon);
|
2022-11-23 15:38:52 +08:00
|
|
|
|
allDevList.push(devObj);
|
2022-11-23 17:19:28 +08:00
|
|
|
|
|
2022-11-21 18:47:47 +08:00
|
|
|
|
strHtml += `<div class="card m-1 border device-wrap" style="width:300px">
|
|
|
|
|
<div class="card-body p-2">
|
|
|
|
|
<div class="d-flex mb-2">
|
|
|
|
|
<div class="mr-5 cur-poi">
|
|
|
|
|
<span class="d-inline-block mr-3">
|
|
|
|
|
<img src="${baseImgUrl + varPathImg + devObj.device_master_icon}" class="profile-image rounded-circle" onerror="defDev(this)" alt="...">
|
|
|
|
|
</span>
|
|
|
|
|
<a href="javascript:;">${devObj.full_name}</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="d-flex mb-0 mt-2 align-items-center">
|
2022-11-23 15:38:52 +08:00
|
|
|
|
<span id="${devObj.device_number}_status" class="circle-light"></span>
|
2022-11-21 18:47:47 +08:00
|
|
|
|
<span class="d-none">即時功率:</span>
|
|
|
|
|
<a href="javascript:;" name="devItem" data-id="${devObj.device_guid}" data-number="${devObj.device_number}" data-name="${devObj.full_name}" class=" ml-2 mb-0 ">詳細資料</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2022-11-16 14:53:22 +08:00
|
|
|
|
</div>`;
|
|
|
|
|
})
|
|
|
|
|
strHtml += "</div>"
|
|
|
|
|
})
|
|
|
|
|
$("#floDevList").append(strHtml);
|
|
|
|
|
initPopover();
|
|
|
|
|
}
|
|
|
|
|
}, null, "POST").send();
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-15 18:47:16 +08:00
|
|
|
|
function drawStateTabBlo() {
|
2022-11-17 09:36:53 +08:00
|
|
|
|
let strHtml = `<table class="table table-bordered table-striped text-center m-0" id="iframemodal">
|
|
|
|
|
<div class="modal-body">
|
|
|
|
|
<iframe src="http://localhost:8080/ord?station:%7Cslot:/TPE/B1/EE/E4/R2F/NA/WHT/N1|view:?fullScreen=true" width="100%" height="100%"></iframe>
|
|
|
|
|
</div>
|
|
|
|
|
</table>`
|
2022-11-15 18:47:16 +08:00
|
|
|
|
return strHtml;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-23 17:19:28 +08:00
|
|
|
|
|
2022-11-15 18:47:16 +08:00
|
|
|
|
</script>
|