照明設備開關 bug 修正

This commit is contained in:
Celeste 2023-04-28 14:01:58 +08:00
parent 605f3f8f87
commit 4e96375be4
5 changed files with 3653 additions and 3751 deletions

View File

@ -6,29 +6,23 @@
</div>
<!-- Modal center Add -->
<div
class="modal fade"
id="lightSchModal"
tabindex="-1"
role="dialog"
aria-hidden="true"
data-backdrop="static"
data-keyboard="false"
>
<div
class="modal-dialog modal-dialog-centered"
role="document"
style="min-width: 60%"
>
<div class="modal fade"
id="lightSchModal"
tabindex="-1"
role="dialog"
aria-hidden="true"
data-backdrop="static"
data-keyboard="false">
<div class="modal-dialog modal-dialog-centered"
role="document"
style="min-width: 60%">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">燈控排程</h4>
<button
type="button"
class="close"
data-dismiss="modal"
aria-label="Close"
>
<button type="button"
class="close"
data-dismiss="modal"
aria-label="Close">
<span aria-hidden="true"><i class="fal fa-times"></i></span>
</button>
</div>
@ -59,6 +53,7 @@
var forgeInvTypeDef = null;
$(function () {
$(loadEle).Loading("start");
getBuildMenu((arr, data) => {
buildMenuData = data;
if (arr.indexOf(4) != -1) {
@ -162,15 +157,31 @@
if (lightOn) {
setLightValues(matchDevice.device_guid, 200, 0xe1cf18);
// changeColorForHotspot(matchDevice.spriteDbid, null, true)
lightOnHotColorArr.push(matchDevice.spriteDbid);
if (
!lightOnHotColorArr.some(
({ spriteDbid }) => spriteDbid === matchDevice.spriteDbid
)
) {
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)
if (
!lightOffHotColorArr.some(
({ spriteDbid }) => spriteDbid === matchDevice.spriteDbid
)
) {
lightOffHotColorArr.push(matchDevice);
}
lightOnHotColorArr = lightOnHotColorArr.filter(
(light) => light !== matchDevice.spriteDbid
(light) => light.spriteDbid !== matchDevice.spriteDbid
);
lightOffHotColorArr.push(matchDevice.spriteDbid);
heatMap?.changeTemp(matchDevice.device_number, 0);
}
}
@ -187,7 +198,6 @@
? parseInt(data.value)
: 0;
}
if (
data.point_name == norDevPoiName &&
data.value == matchDevice.device_normal_point_value
@ -211,9 +221,24 @@
.attr("data-light-type", "error")
.data("light-type", "error");
}
if (
allDevList.length ===
lightOnHotColorArr.length + lightOffHotColorArr.length
) {
changeColorForHotspot(
lightOnHotColorArr.map(({ spriteDbid }) => spriteDbid),
null,
true
);
changeColorForHotspot(
lightOffHotColorArr.map(({ spriteDbid }) => spriteDbid),
null,
false
);
}
$(loadEle).Loading("close");
changeColorForHotspot(lightOnHotColorArr, null, true);
changeColorForHotspot(lightOffHotColorArr, null, false);
setLightColor();
setForgeHotSpotColor(matchDevice);
lightDevForgeSpotLig(matchDevice);
@ -230,7 +255,7 @@
});
}
function lightDevForgeSpotLig(devObj) {}
function lightDevForgeSpotLig(devObj) { }
// 從設備訂閱更新每個設備卡片即時點位
function setDevItemPoiValBySub(data) {
@ -289,7 +314,7 @@
if (
subData &&
subData[device.device_error_point_name] ==
device.device_error_point_value &&
device.device_error_point_value &&
(!isNaN(parseInt(device.spriteDbid)) || !isNaN(parseInt(device._dbId)))
) {
const _dbId = parseInt(device.spriteDbid) || parseInt(device._dbId);
@ -299,7 +324,7 @@
} else if (
subData &&
subData[device.device_error_point_name] !==
device.device_error_point_value &&
device.device_error_point_value &&
(!isNaN(parseInt(device.spriteDbid)) || !isNaN(parseInt(device._dbId)))
) {
const _dbId = parseInt(device.spriteDbid) || parseInt(device._dbId);
@ -342,44 +367,33 @@
$.each(floObj.device_list, (index2, devObj) => {
allDevList.push(devObj);
let devItem = getRiserPoiObj();
strHtml += `<div class="card m-1 border device-wrap" data-number="${
devObj.device_number
}" data-position="${position}">
strHtml += `<div class="card m-1 border device-wrap" data-number="${devObj.device_number
}" data-position="${position}">
<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 +
varPathDevIcon +
devObj.device_image
}" class="profile-image rounded-circle" onerror="defDev(this)" alt="...">
<img src="${baseImgUrl +
varPathDevIcon +
devObj.device_image
}" class="profile-image rounded-circle" onerror="defDev(this)" alt="...">
</span>
<a name="devItemName" data-number="${
devObj.device_number
}" href="javascript:;">${
devObj.full_name
}</a>
<a name="devItemName" data-number="${devObj.device_number
}" href="javascript:;">${devObj.full_name
}</a>
</div>
</div>
<div class="d-flex mb-0 mt-2 align-items-center">
<span id="${
devObj.device_number
}_status" class="circle-light"></span>
<span class="${
devItem ? "" : "d-none"
} ml-2">${
devItem?.full_name
}<span name="devItemPoiVal" data-point="${
devItem?.points
}"></span>${devItem?.unit}</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 " data-toggle="tooltip" title="默认的 Tooltip">詳細資料</a>
<span id="${devObj.device_number
}_status" class="circle-light"></span>
<span class="${devItem ? "" : "d-none"
} ml-2">${devItem?.full_name
}<span name="devItemPoiVal" data-point="${devItem?.points
}"></span>${devItem?.unit}</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 " data-toggle="tooltip" title="默认的 Tooltip">詳細資料</a>
</div>
</div>
</div>`;
@ -469,9 +483,9 @@
callback
? callback(
[res.data.left_drawing, res.data.right_drawing],
res.data
)
[res.data.left_drawing, res.data.right_drawing],
res.data
)
: "";
}
},
@ -511,12 +525,11 @@
}
function show3DModel(urn) {
$(loadEle).Loading("start");
launchViewerForHotspot(
urn,
(viewer, nodeIds) => {
// 隱藏 toolbar
// document.querySelector("#guiviewer3d-toolbar").style.display = "none";
document.querySelector("#guiviewer3d-toolbar").style.display = "none";
let devDbIds = allDevList.map((x) => x.forge_dbid);
// 大類
let subDevDbId = [];
@ -534,11 +547,11 @@
setInviForge(forgeInvTypeDef, [...devDbIds, ...subDevDbId]);
}
$(loadEle).Loading("close");
let sensorObjs = [];
let devices = [];
if (pageAct.sysSubTag === "M12") {
addHotPoint(viewer);
Forge3DSensor.sensorTimes = 0;
allDevList.forEach((device) => {
Forge3DSensor.sensorTimes++;
const sensorObj = new Forge3DSensor({
@ -550,23 +563,23 @@
selector: "[name=forgeViewer]",
elevCb: elevatorShow
? () => {
let elevOption = {
selector: "[name=forgeViewer]",
viewer: viewer,
ordPath: {
area_tag: pageAct.AreaTag,
building_tag: pageAct.buiTag,
},
sensorObjs,
};
let elevOption = {
selector: "[name=forgeViewer]",
viewer: viewer,
ordPath: {
area_tag: pageAct.AreaTag,
building_tag: pageAct.buiTag,
},
sensorObjs,
};
// 電梯移動訂閱程序載入
let forge3DElev = new Forge3DElevFull(elevOption);
forge3DElev.bajaEndCallback = function () {
endPageLoading();
};
forge3DElev.init();
}
// 電梯移動訂閱程序載入
let forge3DElev = new Forge3DElevFull(elevOption);
forge3DElev.bajaEndCallback = function () {
endPageLoading();
};
forge3DElev.init();
}
: null,
curDevice: {
...device,
@ -670,9 +683,7 @@
getE1NodeId(viewer);
}
},
() => {
$(loadEle).Loading("close");
},
() => { },
"[name=forgeViewer]"
);
}

View File

@ -49,7 +49,7 @@
getHotspotPoint(() => {
show3DModel(pageAct.urn);
});
if (!tempSubTag.includes(pageAct.sysSubTag)) {
if (tempSubTag.includes(pageAct.sysSubTag)) {
$("#topLight").html(setTopLight());
setLightColor();
}
@ -573,7 +573,13 @@
if (lightOn && matchDevice.spriteDbid) {
// setLightValues(matchDevice.device_guid, 200, 0xe1cf18);
// changeColorForHotspot(matchDevice.spriteDbid, null, lightOn);
lightOnHotColorArr.push(matchDevice);
if (
!lightOnHotColorArr.some(
({ spriteDbid }) => spriteDbid === matchDevice.spriteDbid
)
) {
lightOnHotColorArr.push(matchDevice);
}
lightOffHotColorArr = lightOffHotColorArr.filter(
(light) => light.spriteDbid !== matchDevice.spriteDbid
);
@ -582,10 +588,16 @@
// console.log(lightOn, matchDevice);
// setLightValues(matchDevice.device_guid, 0, 0xffffff);
// changeColorForHotspot(matchDevice.spriteDbid, null, lightOn);
if (
!lightOffHotColorArr.some(
({ spriteDbid }) => spriteDbid === matchDevice.spriteDbid
)
) {
lightOffHotColorArr.push(matchDevice);
}
lightOnHotColorArr = lightOnHotColorArr.filter(
(light) => light.spriteDbid !== matchDevice.spriteDbid
);
lightOffHotColorArr.push(matchDevice);
heatMap?.changeTemp(matchDevice.device_number, 0);
}
}
@ -681,7 +693,6 @@
deviceScatterErrorArr.length ===
option.series[0].data.length
) {
console.log("deviceScatterNormalArr", deviceScatterNormalArr)
deviceScatterNormalArr.forEach((device) => {
const cur = option.series[0].data.find(
({ device_number }) => device_number === device.device_number
@ -693,7 +704,6 @@
cur.itemStyle = { color: normalColor };
});
deviceScatterCloseArr.forEach((device) => {
const cur = option.series[0].data.find(
({ device_number }) => device_number === device.device_number
@ -1150,7 +1160,7 @@
};
obj.itemStyle = {
color: item.device_color || item.device_normal_color,
color: item.device_color || item.device_close_color,
};
res.push(obj);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff