[Frontend][電梯管理] 3D電梯程序調整

This commit is contained in:
dev01 2022-11-30 12:29:56 +08:00
parent d943fb3fc5
commit 194ef691d4

View File

@ -51,10 +51,10 @@
<div id="elevatorBlock" class="elevator">
<div class="elevator-header">
<div class="row m-0 align-items-center p-2 gap-3 btn-group btn-group-toggle">
<button class="btn btn-secondary btn-sm active" data-tabname="floShowType" data-target="#2dDiv">
<button class="btn btn-secondary btn-sm" data-tabname="floShowType" data-target="#2dDiv">
2D
</button>
<button class="btn btn-secondary btn-sm" data-tabname="floShowType" data-target="#3dDiv" onclick="show3D()">
<button class="btn btn-secondary btn-sm active" data-tabname="floShowType" data-target="#3dDiv" onclick="show3D()">
3D
</button>
</div>
@ -917,6 +917,7 @@
setCards();
subDeviceSetStatus();
setEleManTable();
})
function getFloDevList() {
@ -1015,6 +1016,12 @@
let main = {};
// 匯入 Master 名稱`
main.devName = master;
let subData = subSeviceData.filter(x => x.device_number.split("_")[5] == master)[0];
$.each(Object.keys(subData), (idx3, subKey) => {
if (subKey.startsWith("SP_FLS_")) {
main[subKey] = subData[subKey];
}
})
main._rowType = "master";
result.push(main);
// 該 Master 底下的設備
@ -1033,7 +1040,6 @@
result.push(main);
})
})
console.log("redraw", result)
return result;
}
@ -1110,11 +1116,20 @@
} else {
let strHtml = ``;
let masterArr = [];
let masDiv = "";
$.each(res.data, (index, floObj) => {
$.each(floObj.device_list, (index2, devObj) => {
allDevList.push(devObj);
if (masterArr.indexOf(devObj?.device_number?.split("_")[5]) == -1) {
let master = devObj?.device_number?.split("_")[5];
masDiv = creDiv(["col-12"]);
masDiv.append(creEle("h2", master, null, null))
masterArr.push(master);
}
strHtml += `<div id="${devObj.device_number}_card" class="card dev-card text-white mx-1 mb-3 col-4 " name="devItem" data-id="${devObj.device_guid}" data-number="${devObj.device_number}" data-name="${devObj.full_name}" style="max-width: 18rem;">
strHtml += `<div id="${devObj.device_number}_card" class="card dev-card text-white mb-3 col-4 " name="devItem" data-id="${devObj.device_guid}" data-number="${devObj.device_number}" data-name="${devObj.full_name}" style="max-width: 18rem;">
<div type="button" class="card-body">
<span class="d-flex">
<h5 class="card-title">號機別 : ${devObj.full_name}</h5>
@ -1127,10 +1142,10 @@
</span>
</div>
</div>`;
masDiv.append(strHtml)
})
})
$("#eleCards").html(strHtml);
$("#eleCards").html(masDiv);
initPopover();
//平面圖載入
chartHandler(`${baseImgUrl}/upload/floor_map/${res.data[0].floor_map_name}`);
@ -1298,7 +1313,7 @@
},
{
"title": "休止",
"data": "RCS",
"data": "SP_RCS",
},
{
"title": "獨立運轉",
@ -1306,17 +1321,21 @@
},
{
"title": "VIP",
"data": "VIP",
"data": "SP_VIP",
},
{
"title": "回歸",
"data": "RET",
"data": "SP_RET",
},
{
"title": "不服務樓層",
"data": null,
"render": function (data, type, row) {
return Object.keys(row).filter(x => x.startsWith("SP_FLS_") && row[x] == "trueText").map(x => x?.split("SP_FLS_")[1]).join("、");
let result = "";
if (row._rowType == "master") {
result = Object.keys(row).filter(x => x.startsWith("SP_FLS_") && row[x] == "trueText").map(x => x?.split("SP_FLS_")[1]).join("、");
}
return result;
}
},
{
@ -1337,7 +1356,6 @@
];
eleManTable = new YourTeam.JqDataTables.getTableByStatic(tag, datas, columns, column_defs, null, null, null, null, "tpi");
console.log(eleManTable)
}
// 電梯管理 Modal - 設置 Detail 訂閱內容
@ -1356,7 +1374,7 @@
$("#eleManModal #detDevDiv [name=devName]").text(matchDevice.full_name);
$("#eleManModal #detDevDiv [name=status]").text(subData["ST"]);
$("#eleManModal #detDevDiv [name=curFloor]").text(subData["CP"] + "F");
$("#eleManModal #detDevDiv [name=curFloor]").text(subData["CP"]);
$("#eleManModal #detDevDiv [name=preMea]").prop("checked", bajaValToBool(subData["SP_DP"])); //防疫對策
$("#eleManModal #detDevDiv [name=stop]").prop("checked", bajaValToBool(subData["SP_RCS"]));
$("#eleManModal #detDevDiv [name=onlyOpe]").prop("checked", bajaValToBool(subData["SP_IND"]));
@ -1374,6 +1392,7 @@
$("#notSerFloTable").html(setNotSerFloTable(allSerFloors));
let notSerFloors = Object.keys(subData).filter(x => x.startsWith("SP_FLS_") && subData[x] == "trueText").map(x => x?.split("SP_FLS_")[1]);
$(`[name^=notSerChk]`).prop("checked", false);
$.each(notSerFloors, (idx, floor) => {
$(`[name=notSerChk${floor}]`).prop("checked", true);
@ -1397,7 +1416,7 @@
datas.push({
row: idx,
col: 1,
data: `<input name="notSerChk${row.text}" type="checkbox" class="toggle" data-toggle="toggle">`,
data: `<input name="notSerChk${row.text}" data-point="SP_FLS_${row.id}" type="checkbox" class="toggle" data-toggle="toggle">`,
})
})
$.each(rows, (index, row) => {
@ -1451,7 +1470,7 @@
let master = $(this).prop("id").split("eleManMasEdit")[1];
let subData = subSeviceData.filter(x => x.device_number.split("_")[5] == master)[0];
$("#bajaMasSche").html("");
$("#detMasDiv").data("devnum", subData.device_number);
// 電梯管理 Modal 切換到 detail 頁面
modalTogDiv("#eleManModal", "#tabDiv", "#detMasDiv", "next", function () {
subDeviceSetEleManNotSerFloor(master);
@ -1462,10 +1481,21 @@
})
// 電梯管理 Modal 不服務樓層 設定不服務樓層(BAJA)
onEvent("click", "#eleManTable [name^=notSerChk]", function () {
onEvent("change", "#notSerFloTable [name^=notSerChk]", function () {
let devNum = $("#detMasDiv").data("devnum");
let devNumPath = devNum?.split("_").join("/");
let checked = $(this).prop("checked");
let tarPoint = $(this).data("point");
require(['baja!'], function (baja) {
baja.Ord.make("local:|foxs:|station:|slot:/TPE/B1/ELEV/EL/R2F/NA/ELEV1/N1").get()
.then(function (table) {
baja.Ord.make(`local:|foxs:|station:|slot:/${devNumPath}`).get()
.then(function (folder) {
folder.getSlots().isComponent().eachValue(function (point) {
if (point.getDisplayName() == tarPoint) {
point.set1({
value: checked
})
}
})
});
});
@ -1473,18 +1503,21 @@
// 電梯管理 Modal 設備 設定點位(BAJA)
onEvent("change", "#eleManDevTable input:checkbox", function () {
debugger
let devNum = $("#detDevDiv").data("devnum");
let point = $(this).data("point");
let val = $(this).val();
let tarPoint = $(this).data("point");
let checked = $(this).prop("checked");
let devNumPath = devNum?.split("_").join("/");
require(['baja!'], function (baja) {
baja.Ord.make(`local:|foxs:|station:|slot:${devNumPath}`).get()
.then(function (dev) {
dev.set({
slot: point,
value:val == "on"? true : false,
baja.Ord.make(`local:|foxs:|station:|slot:/${devNumPath}`).get()
.then(function (folder) {
folder.getSlots().isComponent().eachValue(function (point) {
if (point.getDisplayName() == tarPoint) {
point.set1({
value: checked
})
}
})
});
});
@ -1524,7 +1557,7 @@
}
//=====================================================================
// 樓層平面圖
// ↓ 樓層平面圖 ↓
//=====================================================================
function getDevice(devList) {
let selected_floor = devList[0];
@ -1600,7 +1633,7 @@
}
return item;
});
console.log(currentData)
if (currentData == null || currentData.length == 0) {
this.currentData = [];
}
@ -1646,7 +1679,7 @@
// animationDurationUpdate: 1500,
tooltip: {
formatter: function (params) {
console.log("23", params)
if (params.data.device_node_guid != undefined && params.data.device_node_guid != null && params.data.device_node_guid != "") {
return `名稱:${params.data.device_node_full_name}<br>
Guid${params.data.device_node_guid}`
@ -2298,16 +2331,22 @@
}
}
//=====================================================================
// ↑ 樓層平面圖 ↑
//=====================================================================
//載入3D模型
function load3DModel() {
launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6LW1vZGVsX3Rlc3QxMTIxLyVFMyU4MCU5MFRFU1QlRTMlODAlOTEubndk');
}
launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6LW1vZGVsX3Rlc3QxMTIxLyVFMyU4MCU5MFRFU1QlRTMlODAlOTEubndk');
setElevatorSpeed(0.2)
setElevatorFloor(3)
movElevator()
}
function show3D() {
if (isFirstLoad3D) {
isFirstLoad3D = false;
load3DModel();
}
}
</script>