Merge pull request '[前台] subDevice 結束 loading bug | dashbord 修正 chart 更新時機' (#1) from hotfix/system into master

Reviewed-on: BIMS/BIMS#1
This commit is contained in:
celeste 2023-05-29 06:24:33 +00:00
commit e9a8013767
3 changed files with 3177 additions and 3003 deletions

File diff suppressed because it is too large Load Diff

View File

@ -55,6 +55,7 @@
$(function () {
$(loadEle).Loading("start");
getBuildMenu((arr, data) => {
console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@", arr, data);
buildMenuData = data;
if (arr.indexOf(4) != -1) {
getFloDevList(arr[0] == 4 ? "left" : "right");
@ -114,8 +115,8 @@
let lightOnHotColorArr = [];
let lightOffHotColorArr = [];
// 燈光圈用
let lightOnGuidArr = [];
let lightOffGuidArr = [];
let deviceNormalArr = [];
let deviceCloseArr = [];
myBaja.setSubscribeDevicesCallBack(function (data) {
// console.log(data)
@ -123,6 +124,7 @@
(x) => x.device_number == data.device_number_full
)[0];
if (!matchDevice) {
$(loadEle).Loading("close");
return false;
}
@ -146,43 +148,39 @@
subData[data.point_name] = data.value;
}
// setForgeHotSpotColor(matchDevice);
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 == "SSC" && pageAct.sysSubTag === "L1") {
const lightOn = data.value.includes("true");
setLightOpenOrClose(lightOn, matchDevice.device_guid);
if (lightOn) {
setLightValues(matchDevice.device_guid, 200, 0xe1cf18);
// changeColorForHotspot(matchDevice.spriteDbid, null, true)
setLightOpenOrClose(lightOn, matchDevice);
if (lightOn && matchDevice.spriteDbid) {
if (
!lightOnHotColorArr.some(
({ spriteDbid }) => spriteDbid === matchDevice.spriteDbid
)
) {
setLightValues(matchDevice.device_node_guid, 200, 0xe1cf18);
lightOnHotColorArr.push(matchDevice);
}
lightOffHotColorArr = lightOffHotColorArr.filter(
(light) => light.spriteDbid !== matchDevice.spriteDbid
);
heatMap?.changeTemp(matchDevice.device_number, 40);
} else {
setLightValues(matchDevice.device_guid, 0, 0xffffff);
// changeColorForHotspot(matchDevice.spriteDbid)
} else if (matchDevice.spriteDbid) {
if (
!lightOffHotColorArr.some(
({ spriteDbid }) => spriteDbid === matchDevice.spriteDbid
)
) {
setLightValues(matchDevice.device_node_guid, 0, 0xffffff);
lightOffHotColorArr.push(matchDevice);
}
lightOnHotColorArr = lightOnHotColorArr.filter(
(light) => light.spriteDbid !== matchDevice.spriteDbid
);
heatMap?.changeTemp(matchDevice.device_number, 0);
}
}
@ -198,49 +196,92 @@
? parseInt(data.value)
: 0;
}
if (
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`)
.attr("data-light-type", "normal")
.data("light-type", "normal");
deviceNormalArr.push(matchDevice);
deviceCloseArr = deviceCloseArr.filter(
(device) => device.spriteDbid !== matchDevice.spriteDbid
);
} else if (
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`)
.attr("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.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`)
.attr("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 (
allDevList.length ===
lightOnHotColorArr.length + lightOffHotColorArr.length
deviceNormalArr.length + deviceCloseArr.length + alarmDbIdList.length
) {
changeColorForHotspot(
lightOnHotColorArr.map(({ spriteDbid }) => spriteDbid),
deviceNormalArr.map(({ spriteDbid }) => spriteDbid),
null,
true
);
changeColorForHotspot(
lightOffHotColorArr.map(({ spriteDbid }) => spriteDbid),
deviceCloseArr.map(({ spriteDbid }) => spriteDbid),
null,
false
);
}
changeColorForHotspot(
alarmDbIdList.map(({ spriteDbid }) => spriteDbid),
"error",
false
);
$(loadEle).Loading("close");
setLightColor();
setForgeHotSpotColor(matchDevice);
lightDevForgeSpotLig(matchDevice);
// 從設備訂閱更新每個設備卡片即時點位
setDevItemPoiValBySub(data);
@ -248,7 +289,10 @@
myBaja.setSubscribeDeviceEndCallBack(function (data) {
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]");
}

View File

@ -16,10 +16,8 @@
</div> -->
<div class="d-flex">
<div class="col-6 my-3">
<div
id="floChart"
style="height: 100%; width: 100%; background-color: #fff"
></div>
<div id="floChart"
style="height: 100%; width: 100%; background-color: #fff"></div>
</div>
<div class="col-6 my-3">
<!-- <div id="forgeViewer" class="position-relative" style="height:100%">
@ -27,11 +25,9 @@
</div>
</div> -->
<div id="forgeViewer" class="position-relative" style="height: 80vh">
<div
id="forgeHeatBarDiv"
<div id="forgeHeatBarDiv"
class="d-flex mb-4 position-absolute"
style="gap: 15px"
></div>
style="gap: 15px"></div>
</div>
</div>
</div>
@ -540,6 +536,7 @@
(x) => x.device_number == data.device_number_full
)[0];
if (!matchDevice) {
$(loadEle).Loading("close");
return false;
}
//將訂閱值塞入 subDeviceData
@ -645,6 +642,9 @@
(device) => device.spriteDbid !== matchDevice.spriteDbid
);
}
console.log(deviceScatterCloseArr.length,
deviceScatterNormalArr.length,
deviceScatterErrorArr.length)
if (
option.series[0].data.length ===
lightOnHotColorArr.length + lightOffHotColorArr.length
@ -763,7 +763,7 @@
viewer: viewer,
nodeId: node,
floorHeight: elev3DOption.floorHeight ?? [],
inited: function () {},
inited: function () { },
};
let elevator3DObj = new elevator3D(options);
let devNum = Object.keys(elev3DBind).filter(