Merge pull request '[前台] subDevice 結束 loading bug | dashbord 修正 chart 更新時機' (#1) from hotfix/system into master
Reviewed-on: BIMS/BIMS#1
This commit is contained in:
commit
e9a8013767
File diff suppressed because it is too large
Load Diff
@ -55,6 +55,7 @@
|
|||||||
$(function () {
|
$(function () {
|
||||||
$(loadEle).Loading("start");
|
$(loadEle).Loading("start");
|
||||||
getBuildMenu((arr, data) => {
|
getBuildMenu((arr, data) => {
|
||||||
|
console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@", arr, data);
|
||||||
buildMenuData = data;
|
buildMenuData = data;
|
||||||
if (arr.indexOf(4) != -1) {
|
if (arr.indexOf(4) != -1) {
|
||||||
getFloDevList(arr[0] == 4 ? "left" : "right");
|
getFloDevList(arr[0] == 4 ? "left" : "right");
|
||||||
@ -114,8 +115,8 @@
|
|||||||
let lightOnHotColorArr = [];
|
let lightOnHotColorArr = [];
|
||||||
let lightOffHotColorArr = [];
|
let lightOffHotColorArr = [];
|
||||||
// 燈光圈用
|
// 燈光圈用
|
||||||
let lightOnGuidArr = [];
|
let deviceNormalArr = [];
|
||||||
let lightOffGuidArr = [];
|
let deviceCloseArr = [];
|
||||||
|
|
||||||
myBaja.setSubscribeDevicesCallBack(function (data) {
|
myBaja.setSubscribeDevicesCallBack(function (data) {
|
||||||
// console.log(data)
|
// console.log(data)
|
||||||
@ -123,6 +124,7 @@
|
|||||||
(x) => x.device_number == data.device_number_full
|
(x) => x.device_number == data.device_number_full
|
||||||
)[0];
|
)[0];
|
||||||
if (!matchDevice) {
|
if (!matchDevice) {
|
||||||
|
$(loadEle).Loading("close");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,43 +148,39 @@
|
|||||||
subData[data.point_name] = data.value;
|
subData[data.point_name] = data.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// setForgeHotSpotColor(matchDevice);
|
||||||
|
|
||||||
let norDevPoiName = matchDevice.device_normal_point_name;
|
let norDevPoiName = matchDevice.device_normal_point_name;
|
||||||
let cloDevPoiName = matchDevice.device_close_point_name;
|
let cloDevPoiName = matchDevice.device_close_point_name;
|
||||||
let errDevPoiName = matchDevice.device_error_point_name;
|
let errDevPoiName = matchDevice.device_error_point_name;
|
||||||
|
|
||||||
if (data.point_name == "SSC" && pageAct.sysSubTag === "L1") {
|
if (data.point_name == "SSC" && pageAct.sysSubTag === "L1") {
|
||||||
const lightOn = data.value.includes("true");
|
const lightOn = data.value.includes("true");
|
||||||
|
setLightOpenOrClose(lightOn, matchDevice);
|
||||||
setLightOpenOrClose(lightOn, matchDevice.device_guid);
|
if (lightOn && matchDevice.spriteDbid) {
|
||||||
if (lightOn) {
|
|
||||||
setLightValues(matchDevice.device_guid, 200, 0xe1cf18);
|
|
||||||
// changeColorForHotspot(matchDevice.spriteDbid, null, true)
|
|
||||||
if (
|
if (
|
||||||
!lightOnHotColorArr.some(
|
!lightOnHotColorArr.some(
|
||||||
({ spriteDbid }) => spriteDbid === matchDevice.spriteDbid
|
({ spriteDbid }) => spriteDbid === matchDevice.spriteDbid
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
|
setLightValues(matchDevice.device_node_guid, 200, 0xe1cf18);
|
||||||
lightOnHotColorArr.push(matchDevice);
|
lightOnHotColorArr.push(matchDevice);
|
||||||
}
|
}
|
||||||
lightOffHotColorArr = lightOffHotColorArr.filter(
|
lightOffHotColorArr = lightOffHotColorArr.filter(
|
||||||
(light) => light.spriteDbid !== matchDevice.spriteDbid
|
(light) => light.spriteDbid !== matchDevice.spriteDbid
|
||||||
);
|
);
|
||||||
heatMap?.changeTemp(matchDevice.device_number, 40);
|
} else if (matchDevice.spriteDbid) {
|
||||||
} else {
|
|
||||||
setLightValues(matchDevice.device_guid, 0, 0xffffff);
|
|
||||||
// changeColorForHotspot(matchDevice.spriteDbid)
|
|
||||||
if (
|
if (
|
||||||
!lightOffHotColorArr.some(
|
!lightOffHotColorArr.some(
|
||||||
({ spriteDbid }) => spriteDbid === matchDevice.spriteDbid
|
({ spriteDbid }) => spriteDbid === matchDevice.spriteDbid
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
|
setLightValues(matchDevice.device_node_guid, 0, 0xffffff);
|
||||||
lightOffHotColorArr.push(matchDevice);
|
lightOffHotColorArr.push(matchDevice);
|
||||||
}
|
}
|
||||||
lightOnHotColorArr = lightOnHotColorArr.filter(
|
lightOnHotColorArr = lightOnHotColorArr.filter(
|
||||||
(light) => light.spriteDbid !== matchDevice.spriteDbid
|
(light) => light.spriteDbid !== matchDevice.spriteDbid
|
||||||
);
|
);
|
||||||
|
|
||||||
heatMap?.changeTemp(matchDevice.device_number, 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,49 +196,92 @@
|
|||||||
? parseInt(data.value)
|
? parseInt(data.value)
|
||||||
: 0;
|
: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
data.point_name == norDevPoiName &&
|
data.point_name == norDevPoiName &&
|
||||||
data.value == matchDevice.device_normal_point_value
|
data.value == matchDevice.device_normal_point_value &&
|
||||||
|
!deviceNormalArr.some(
|
||||||
|
({ device_number }) => device_number === matchDevice.device_number
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
//顯示正常燈號
|
//顯示正常燈號
|
||||||
$(`#${matchDevice.device_number}_status`)
|
$(`#${matchDevice.device_number}_status`)
|
||||||
.attr("data-light-type", "normal")
|
.attr("data-light-type", "normal")
|
||||||
.data("light-type", "normal");
|
.data("light-type", "normal");
|
||||||
|
|
||||||
|
deviceNormalArr.push(matchDevice);
|
||||||
|
deviceCloseArr = deviceCloseArr.filter(
|
||||||
|
(device) => device.spriteDbid !== matchDevice.spriteDbid
|
||||||
|
);
|
||||||
} else if (
|
} else if (
|
||||||
data.point_name == cloDevPoiName &&
|
data.point_name == cloDevPoiName &&
|
||||||
data.value == matchDevice.device_close_point_value
|
data.value == matchDevice.device_close_point_value &&
|
||||||
|
!deviceCloseArr.some(
|
||||||
|
({ device_number }) => device_number === matchDevice.device_number
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
$(`#${matchDevice.device_number}_status`)
|
$(`#${matchDevice.device_number}_status`)
|
||||||
.attr("data-light-type", "close")
|
.attr("data-light-type", "close")
|
||||||
.data("light-type", "close");
|
.data("light-type", "close");
|
||||||
} else if (
|
|
||||||
|
deviceCloseArr.push(matchDevice);
|
||||||
|
deviceNormalArr = deviceNormalArr.filter(
|
||||||
|
(device) => device.spriteDbid !== matchDevice.spriteDbid
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
data.point_name == errDevPoiName &&
|
data.point_name == errDevPoiName &&
|
||||||
data.value == matchDevice.device_error_point_value
|
data.value == matchDevice.device_error_point_value &&
|
||||||
|
!alarmDbIdList.some(
|
||||||
|
(device) => device.device_number === matchDevice.device_number
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
|
if (pageAct.sysSubTag === "L1") {
|
||||||
|
$(`#${matchDevice.device_number}_status`)
|
||||||
|
.attr("data-light-error-type", "error")
|
||||||
|
.data("light-error-type", "error");
|
||||||
|
} else {
|
||||||
$(`#${matchDevice.device_number}_status`)
|
$(`#${matchDevice.device_number}_status`)
|
||||||
.attr("data-light-type", "error")
|
.attr("data-light-type", "error")
|
||||||
.data("light-type", "error");
|
.data("light-type", "error");
|
||||||
}
|
}
|
||||||
|
alarmDbIdList.push(matchDevice);
|
||||||
|
} else if (
|
||||||
|
data.point_name == errDevPoiName &&
|
||||||
|
data.value !== matchDevice.device_error_point_value
|
||||||
|
) {
|
||||||
|
$(`#${matchDevice.device_number}_status`)
|
||||||
|
.attr("data-light-error-type", "")
|
||||||
|
.data("light-error-type", "");
|
||||||
|
alarmDbIdList = alarmDbIdList.filter(
|
||||||
|
(device) => device.device_number !== matchDevice.device_number
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
allDevList.length ===
|
allDevList.length ===
|
||||||
lightOnHotColorArr.length + lightOffHotColorArr.length
|
deviceNormalArr.length + deviceCloseArr.length + alarmDbIdList.length
|
||||||
) {
|
) {
|
||||||
changeColorForHotspot(
|
changeColorForHotspot(
|
||||||
lightOnHotColorArr.map(({ spriteDbid }) => spriteDbid),
|
deviceNormalArr.map(({ spriteDbid }) => spriteDbid),
|
||||||
null,
|
null,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
changeColorForHotspot(
|
changeColorForHotspot(
|
||||||
lightOffHotColorArr.map(({ spriteDbid }) => spriteDbid),
|
deviceCloseArr.map(({ spriteDbid }) => spriteDbid),
|
||||||
null,
|
null,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
changeColorForHotspot(
|
||||||
|
alarmDbIdList.map(({ spriteDbid }) => spriteDbid),
|
||||||
|
"error",
|
||||||
|
false
|
||||||
|
);
|
||||||
$(loadEle).Loading("close");
|
$(loadEle).Loading("close");
|
||||||
|
|
||||||
setLightColor();
|
setLightColor();
|
||||||
setForgeHotSpotColor(matchDevice);
|
|
||||||
lightDevForgeSpotLig(matchDevice);
|
lightDevForgeSpotLig(matchDevice);
|
||||||
// 從設備訂閱更新每個設備卡片即時點位
|
// 從設備訂閱更新每個設備卡片即時點位
|
||||||
setDevItemPoiValBySub(data);
|
setDevItemPoiValBySub(data);
|
||||||
@ -248,7 +289,10 @@
|
|||||||
|
|
||||||
myBaja.setSubscribeDeviceEndCallBack(function (data) {
|
myBaja.setSubscribeDeviceEndCallBack(function (data) {
|
||||||
endPageLoading();
|
endPageLoading();
|
||||||
if (data.findIndex((x) => x.point_name == "Temp") != -1) {
|
if (data.findIndex((x) => x.point_name == "CO2") != -1) {
|
||||||
|
// 顯示溫度條
|
||||||
|
showHeatCO2("[name=forgeHeatBar]");
|
||||||
|
} else if (data.findIndex((x) => x.point_name == "Temp") != -1) {
|
||||||
// 顯示溫度條
|
// 顯示溫度條
|
||||||
showHeat("[name=forgeHeatBar]");
|
showHeat("[name=forgeHeatBar]");
|
||||||
}
|
}
|
||||||
|
@ -16,10 +16,8 @@
|
|||||||
</div> -->
|
</div> -->
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<div class="col-6 my-3">
|
<div class="col-6 my-3">
|
||||||
<div
|
<div id="floChart"
|
||||||
id="floChart"
|
style="height: 100%; width: 100%; background-color: #fff"></div>
|
||||||
style="height: 100%; width: 100%; background-color: #fff"
|
|
||||||
></div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6 my-3">
|
<div class="col-6 my-3">
|
||||||
<!-- <div id="forgeViewer" class="position-relative" style="height:100%">
|
<!-- <div id="forgeViewer" class="position-relative" style="height:100%">
|
||||||
@ -27,11 +25,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div> -->
|
</div> -->
|
||||||
<div id="forgeViewer" class="position-relative" style="height: 80vh">
|
<div id="forgeViewer" class="position-relative" style="height: 80vh">
|
||||||
<div
|
<div id="forgeHeatBarDiv"
|
||||||
id="forgeHeatBarDiv"
|
|
||||||
class="d-flex mb-4 position-absolute"
|
class="d-flex mb-4 position-absolute"
|
||||||
style="gap: 15px"
|
style="gap: 15px"></div>
|
||||||
></div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -540,6 +536,7 @@
|
|||||||
(x) => x.device_number == data.device_number_full
|
(x) => x.device_number == data.device_number_full
|
||||||
)[0];
|
)[0];
|
||||||
if (!matchDevice) {
|
if (!matchDevice) {
|
||||||
|
$(loadEle).Loading("close");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//將訂閱值塞入 subDeviceData
|
//將訂閱值塞入 subDeviceData
|
||||||
@ -645,6 +642,9 @@
|
|||||||
(device) => device.spriteDbid !== matchDevice.spriteDbid
|
(device) => device.spriteDbid !== matchDevice.spriteDbid
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
console.log(deviceScatterCloseArr.length,
|
||||||
|
deviceScatterNormalArr.length,
|
||||||
|
deviceScatterErrorArr.length)
|
||||||
if (
|
if (
|
||||||
option.series[0].data.length ===
|
option.series[0].data.length ===
|
||||||
lightOnHotColorArr.length + lightOffHotColorArr.length
|
lightOnHotColorArr.length + lightOffHotColorArr.length
|
||||||
|
Loading…
Reference in New Issue
Block a user