[前台]系統監控詳細資料 zoom in | 感測設備隨電梯移動及溫度變化 | 系統監控 pop 小卡 icon 功能提示
This commit is contained in:
		
							parent
							
								
									283f53f22a
								
							
						
					
					
						commit
						092c055c2e
					
				@ -1,25 +1,61 @@
 | 
				
			|||||||
<style>
 | 
					<style>
 | 
				
			||||||
    .elevator { background-color: #fff; min-height: 520px; }
 | 
					    .elevator {
 | 
				
			||||||
 | 
					        background-color: #fff;
 | 
				
			||||||
 | 
					        min-height: 520px;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    .elevator-table-wrapper { padding: 0.8rem; }
 | 
					    .elevator-table-wrapper {
 | 
				
			||||||
 | 
					        padding: 0.8rem;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    table.elevator-build { /*border: 1px double #000;*/ }
 | 
					    table.elevator-build { /*border: 1px double #000;*/
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    table.elevator-build td { padding: 0.2rem 0.5rem; height: 50px; width: 45px; border: 1px solid #000; }
 | 
					        table.elevator-build td {
 | 
				
			||||||
 | 
					            padding: 0.2rem 0.5rem;
 | 
				
			||||||
 | 
					            height: 50px;
 | 
				
			||||||
 | 
					            width: 45px;
 | 
				
			||||||
 | 
					            border: 1px solid #000;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    elevator .elevator-body, elevator .elevator-header { padding: 0.7rem; }
 | 
					    elevator .elevator-body, elevator .elevator-header {
 | 
				
			||||||
 | 
					        padding: 0.7rem;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    .elevator-item { position: absolute; width: 43px; height: 47px; border: 4px solid orange; }
 | 
					    .elevator-item {
 | 
				
			||||||
 | 
					        position: absolute;
 | 
				
			||||||
 | 
					        width: 43px;
 | 
				
			||||||
 | 
					        height: 47px;
 | 
				
			||||||
 | 
					        border: 4px solid orange;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    .elevator-item-toup { border: 4px solid rgba(255,255,255,0); position: absolute; border-bottom: 0; z-index: 2; }
 | 
					    .elevator-item-toup {
 | 
				
			||||||
 | 
					        border: 4px solid rgba(255,255,255,0);
 | 
				
			||||||
 | 
					        position: absolute;
 | 
				
			||||||
 | 
					        border-bottom: 0;
 | 
				
			||||||
 | 
					        z-index: 2;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    .elevator-item-todown { border: 4px solid rgba(255,255,255,0); position: absolute; border-top: 0; z-index: 2; }
 | 
					    .elevator-item-todown {
 | 
				
			||||||
 | 
					        border: 4px solid rgba(255,255,255,0);
 | 
				
			||||||
 | 
					        position: absolute;
 | 
				
			||||||
 | 
					        border-top: 0;
 | 
				
			||||||
 | 
					        z-index: 2;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    .table-compact td { padding: 0.2rem 0.3rem; }
 | 
					    .table-compact td {
 | 
				
			||||||
 | 
					        padding: 0.2rem 0.3rem;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    #emerTurn tr td:nth-child(2) { width: 50%; text-align: center; justify-content: center; }
 | 
					    #emerTurn tr td:nth-child(2) {
 | 
				
			||||||
 | 
					        width: 50%;
 | 
				
			||||||
 | 
					        text-align: center;
 | 
				
			||||||
 | 
					        justify-content: center;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    #emerTurn tr td:nth-child(1) { width: 35%; }
 | 
					    #emerTurn tr td:nth-child(1) {
 | 
				
			||||||
 | 
					        width: 35%;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
</style>
 | 
					</style>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<div class="d-flex">
 | 
					<div class="d-flex">
 | 
				
			||||||
@ -215,7 +251,7 @@
 | 
				
			|||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
                    <div class="">
 | 
					                    <div class="">
 | 
				
			||||||
                        <a type="button" class="mr-2" data-toggle="tooltip" data-placement="top"
 | 
					                        <a type="button" class="mr-2" data-toggle="tooltip" data-placement="top"
 | 
				
			||||||
                           title="及時狀態">
 | 
					                           title="即時狀態">
 | 
				
			||||||
                            <i class="fal fa-tv fa-2x" data-toggle="modal"
 | 
					                            <i class="fal fa-tv fa-2x" data-toggle="modal"
 | 
				
			||||||
                               data-target="#exampleModal"></i>
 | 
					                               data-target="#exampleModal"></i>
 | 
				
			||||||
                        </a>
 | 
					                        </a>
 | 
				
			||||||
 | 
				
			|||||||
@ -11,7 +11,8 @@
 | 
				
			|||||||
</div>
 | 
					</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<!-- Modal center Add -->
 | 
					<!-- 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 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-dialog modal-dialog-centered" role="document" style="min-width:60%">
 | 
				
			||||||
        <div class="modal-content">
 | 
					        <div class="modal-content">
 | 
				
			||||||
            <div class="modal-header">
 | 
					            <div class="modal-header">
 | 
				
			||||||
@ -24,7 +25,7 @@
 | 
				
			|||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
            <div class="modal-body">
 | 
					            <div class="modal-body">
 | 
				
			||||||
                <!--<table id="lightSchTable" class="table table-bordered table-striped text-center m-0 w-100">
 | 
					                <!--<table id="lightSchTable" class="table table-bordered table-striped text-center m-0 w-100">
 | 
				
			||||||
    </table>-->
 | 
					                </table>-->
 | 
				
			||||||
                <div id="lightSchBlock" style="height:60vh"></div>
 | 
					                <div id="lightSchBlock" style="height:60vh"></div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
@ -46,9 +47,10 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    $(function () {
 | 
					    $(function () {
 | 
				
			||||||
        getBuildMenu((arr, data) => {
 | 
					        getBuildMenu((arr, data) => {
 | 
				
			||||||
 | 
					            console.log(arr)
 | 
				
			||||||
            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");
 | 
				
			||||||
                setLightColor();
 | 
					                setLightColor();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (arr.indexOf(3) != -1) {
 | 
					            if (arr.indexOf(3) != -1) {
 | 
				
			||||||
@ -147,7 +149,7 @@
 | 
				
			|||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        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 == "Temp") != -1) {
 | 
				
			||||||
                // 顯示溫度條
 | 
					                // 顯示溫度條
 | 
				
			||||||
                showHeat("[name=forgeHeatBar]");
 | 
					                showHeat("[name=forgeHeatBar]");
 | 
				
			||||||
@ -166,7 +168,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        let pointSpan = $(`.card.device-wrap[data-number=${data.device_number_full}] span[name=devItemPoiVal]`);
 | 
					        let pointSpan = $(`.card.device-wrap[data-number=${data.device_number_full}] span[name=devItemPoiVal]`);
 | 
				
			||||||
        if (pointSpan && pointSpan.data("point") == data.point_name) {
 | 
					        if (pointSpan && pointSpan.data("point") == data.point_name) {
 | 
				
			||||||
            console.log(data)
 | 
					            // console.log(data)
 | 
				
			||||||
            pointSpan.text(data.value);
 | 
					            pointSpan.text(data.value);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -284,7 +286,7 @@
 | 
				
			|||||||
                                        <div class="d-flex mb-0 mt-2 align-items-center">
 | 
					                                        <div class="d-flex mb-0 mt-2 align-items-center">
 | 
				
			||||||
                                                <span id="${devObj.device_number}_status" class="circle-light"></span>
 | 
					                                                <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>
 | 
					                                                <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 ">詳細資料</a>
 | 
					                                                <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>
 | 
					                                        </div>
 | 
				
			||||||
                                    </div>`;
 | 
					                                    </div>`;
 | 
				
			||||||
@ -376,42 +378,67 @@
 | 
				
			|||||||
    function show3DModel(urn) {
 | 
					    function show3DModel(urn) {
 | 
				
			||||||
        $(loadEle).Loading("start");
 | 
					        $(loadEle).Loading("start");
 | 
				
			||||||
        launchViewerForHotspot(urn, (viewer, nodeIds) => {
 | 
					        launchViewerForHotspot(urn, (viewer, nodeIds) => {
 | 
				
			||||||
          let devDbIds = allDevList.map(x => x.forge_dbid); // 大類
 | 
					
 | 
				
			||||||
          console.log(allDevList);
 | 
					            addHotPoint(viewer)
 | 
				
			||||||
          let subDevDbId = [];
 | 
					            let devDbIds = allDevList.map(x => x.forge_dbid);
 | 
				
			||||||
          allDevList.forEach(({ device_nodes }) => {
 | 
					            // 大類
 | 
				
			||||||
            subDevDbId = [...subDevDbId, ...device_nodes.map(n => n.forge_dbid)]
 | 
					            let subDevDbId = [];
 | 
				
			||||||
          })
 | 
					            allDevList.forEach(({ device_nodes }) => {
 | 
				
			||||||
 | 
					                subDevDbId = [...subDevDbId, ...device_nodes.map(n => n.forge_dbid)]
 | 
				
			||||||
 | 
					            })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // 從資料庫設定不可視模型的類型,若沒有取道該小類不可視類型,則套用資料庫設定預設類型
 | 
					            // 從資料庫設定不可視模型的類型,若沒有取道該小類不可視類型,則套用資料庫設定預設類型
 | 
				
			||||||
            if (forgeInvType) {
 | 
					            if (forgeInvType) {
 | 
				
			||||||
              setInviForge(forgeInvType, [...devDbIds, ...subDevDbId]);
 | 
					                setInviForge(forgeInvType, [...devDbIds, ...subDevDbId]);
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
              setInviForge(forgeInvTypeDef, [...devDbIds, ...subDevDbId]);
 | 
					                setInviForge(forgeInvTypeDef, [...devDbIds, ...subDevDbId]);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $(loadEle).Loading("close");
 | 
					            $(loadEle).Loading("close");
 | 
				
			||||||
 | 
					            let sensorObjs = []
 | 
				
			||||||
            let devices = allDevList.map(x => {
 | 
					            let devices = []
 | 
				
			||||||
                return {
 | 
					            if (pageAct.sysSubTag === "M12") {
 | 
				
			||||||
                    roomDbId: !isNaN(parseInt(x.room_dbid)) ? parseInt(x.room_dbid) : -1,
 | 
					                allDevList.forEach((device) => {
 | 
				
			||||||
                    id: x.device_number,
 | 
					                    const sensorObj = new Forge3DSensor({
 | 
				
			||||||
                    position: isJSON(x.device_coordinate_3d) ? JSON.parse(x.device_coordinate_3d) : {}, // x: 0, y: 25, z: -2.5      (3.35, -4.81, 12.88
 | 
					                        viewer: viewer,
 | 
				
			||||||
                    sensorTypes: ["temperature", "humidity"]
 | 
					                        ordPath: {
 | 
				
			||||||
                }
 | 
					                            "area_tag": pageAct.AreaTag,
 | 
				
			||||||
            })
 | 
					                            "building_tag": pageAct.buiTag,
 | 
				
			||||||
 | 
					                        },
 | 
				
			||||||
 | 
					                        curDevice: {
 | 
				
			||||||
 | 
					                            roomDbId: !isNaN(parseInt(device.room_dbid)) ? parseInt(device.room_dbid) : -1,
 | 
				
			||||||
 | 
					                            id: device.device_number,
 | 
				
			||||||
 | 
					                            position: isJSON(device.device_coordinate_3d) ? JSON.parse(device.device_coordinate_3d) : {}, // x: 0, y: 25, z: -2.5      (3.35, -4.81, 12.88
 | 
				
			||||||
 | 
					                            temp: 25,
 | 
				
			||||||
 | 
					                            forge_dbid: parseInt(device.forge_dbid)
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    });
 | 
				
			||||||
 | 
					                    sensorObjs.push(sensorObj)
 | 
				
			||||||
 | 
					                })
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                allDevList.map(x => {
 | 
				
			||||||
 | 
					                    return {
 | 
				
			||||||
 | 
					                        roomDbId: !isNaN(parseInt(x.room_dbid)) ? parseInt(x.room_dbid) : -1,
 | 
				
			||||||
 | 
					                        id: x.device_number,
 | 
				
			||||||
 | 
					                        position: isJSON(x.device_coordinate_3d) ? JSON.parse(x.device_coordinate_3d) : {}, // x: 0, y: 25, z: -2.5      (3.35, -4.81, 12.88
 | 
				
			||||||
 | 
					                        sensorTypes: ["temperature", "humidity"],
 | 
				
			||||||
 | 
					                        temp: 0,
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                })
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            let option = {
 | 
					            let option = {
 | 
				
			||||||
                devices: devices,
 | 
					                devices: devices,
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          if (pageAct.sysMainTag !== "LT") {
 | 
					            if (pageAct.sysMainTag !== "LT" && pageAct.sysSubTag !== "M12") {
 | 
				
			||||||
            heatMap = new ADHeatMaps(option);
 | 
					                heatMap = new ADHeatMaps(option);
 | 
				
			||||||
            heatMap.onComplete = () => {
 | 
					                heatMap.onComplete = () => {
 | 
				
			||||||
              $.each(allDevList, (idx, dev) => {
 | 
					                    $.each(allDevList, (idx, dev) => {
 | 
				
			||||||
                heatMap.changeTemp(dev.device_number, dev._temp || 0);
 | 
					                        heatMap.changeTemp(dev.device_number, dev._temp || 0);
 | 
				
			||||||
              })
 | 
					                    })
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            let elevOption = {
 | 
					            let elevOption = {
 | 
				
			||||||
                selector: "[name=forgeViewer]",
 | 
					                selector: "[name=forgeViewer]",
 | 
				
			||||||
@ -420,6 +447,7 @@
 | 
				
			|||||||
                    "area_tag": pageAct.AreaTag,
 | 
					                    "area_tag": pageAct.AreaTag,
 | 
				
			||||||
                    "building_tag": pageAct.buiTag,
 | 
					                    "building_tag": pageAct.buiTag,
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
 | 
					                sensorObjs
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // 電梯移動訂閱程序載入
 | 
					            // 電梯移動訂閱程序載入
 | 
				
			||||||
@ -438,36 +466,40 @@
 | 
				
			|||||||
                        setForgeHotSpotColor(matchDevice);
 | 
					                        setForgeHotSpotColor(matchDevice);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
          }
 | 
					            }
 | 
				
			||||||
          if (pageAct.sub_system_tag == "W2") {
 | 
					            if (pageAct.sysSubTag == "W2") {
 | 
				
			||||||
            getWaterNodeId();
 | 
					                // console.log("@@",pageAct, pageAct.sub_system_tag)
 | 
				
			||||||
          }
 | 
					                getWaterNodeId(viewer);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        }, () => {
 | 
					        }, () => {
 | 
				
			||||||
            $(loadEle).Loading("close");
 | 
					            $(loadEle).Loading("close");
 | 
				
			||||||
        }, "[name=forgeViewer]");
 | 
					        }, "[name=forgeViewer]");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // 供水系統 - 取得欲染色 dbid
 | 
					    // 供水系統 - 取得欲染色 dbid
 | 
				
			||||||
    function getWaterNodeId() {
 | 
					    function getWaterNodeId() {
 | 
				
			||||||
        //let url = baseApiUrl + "/api/Device/GetForgeNodeIdFromVar";
 | 
					        // let url = baseApiUrl + "/api/Device/GetForgeNodeIdFromVar";
 | 
				
			||||||
        //let sendData = { forgeNodeKey: "water_wupply" };
 | 
					        // let sendData = { forgeNodeKey: "water_wupply" };
 | 
				
			||||||
        //objSendData.Data = sendData;
 | 
					        // objSendData.Data = sendData;
 | 
				
			||||||
        //ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
 | 
					        // ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
 | 
				
			||||||
        //    if (!res || res.code != "0000" || !res.data) {
 | 
					        //     if (!res || res.code != "0000" || !res.data) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //    } else {
 | 
					        //     } else {
 | 
				
			||||||
        //        if (!isNaN(parseInt(res.data[0]?.system_value))) {
 | 
					        //         if (!isNaN(parseInt(res.data[0]?.system_value))) {
 | 
				
			||||||
        //            changeColor(parseInt(res.data[0]?.system_value))
 | 
					        //             changeColor(parseInt(res.data[0]?.system_value))
 | 
				
			||||||
        //        }
 | 
					        //         }
 | 
				
			||||||
        //        console.log(res.data)
 | 
					        //         console.log(res.data)
 | 
				
			||||||
        //    }
 | 
					        //     }
 | 
				
			||||||
        //}, null, "POST").send();
 | 
					        // }, null, "POST").send();
 | 
				
			||||||
 | 
					        // console.log("1",viewer.model)
 | 
				
			||||||
 | 
					        viewer.model.search("給水", (nodeIds) => {
 | 
				
			||||||
 | 
					            // console.log("2",nodeIds)
 | 
				
			||||||
 | 
					            viewer.show(nodeIds)
 | 
				
			||||||
 | 
					        }, (e) => { console.log(e) })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      viewer.model.search("給水", (nodeIds) => {
 | 
					 | 
				
			||||||
        console.log(nodeIds)
 | 
					 | 
				
			||||||
        viewer.show(nodeIds)
 | 
					 | 
				
			||||||
      }, (e) => { console.log(e) })
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function getHotspotPoint(callback = null) {
 | 
					    function getHotspotPoint(callback = null) {
 | 
				
			||||||
@ -533,7 +565,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // 設置 模型隱藏或透明
 | 
					    // 設置 模型隱藏或透明
 | 
				
			||||||
    function setInviForge(type, devDbIds) {
 | 
					    function setInviForge(type, devDbIds) {
 | 
				
			||||||
        console.log("devDbIds",devDbIds)
 | 
					 | 
				
			||||||
        if (type == "Hide") {
 | 
					        if (type == "Hide") {
 | 
				
			||||||
            hideAllObjects(devDbIds);
 | 
					            hideAllObjects(devDbIds);
 | 
				
			||||||
        } else if (type == "Opacity") {
 | 
					        } else if (type == "Opacity") {
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										7
									
								
								Frontend/img/forge/sensor_circle.svg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								Frontend/img/forge/sensor_circle.svg
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,7 @@
 | 
				
			|||||||
 | 
					<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" version="1.1">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 <g>
 | 
				
			||||||
 | 
					  <title>Layer 1</title>
 | 
				
			||||||
 | 
					  <circle fill="none" id="svg_1" r="8" cy="8" cx="8"/>
 | 
				
			||||||
 | 
					 </g>
 | 
				
			||||||
 | 
					</svg>
 | 
				
			||||||
| 
		 After Width: | Height: | Size: 197 B  | 
@ -801,7 +801,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
 | 
				
			|||||||
                        /*"lib/jquery-validation/dist/additional-methods.min",*/  /* 會影響 messages_zh_TW 文字呈現 */
 | 
					                        /*"lib/jquery-validation/dist/additional-methods.min",*/  /* 會影響 messages_zh_TW 文字呈現 */
 | 
				
			||||||
                        "lib/jquery-validation/dist/localization/messages_zh_TW",
 | 
					                        "lib/jquery-validation/dist/localization/messages_zh_TW",
 | 
				
			||||||
                        "lib/jquery-ui/jquery-ui.min",
 | 
					                        "lib/jquery-ui/jquery-ui.min",
 | 
				
			||||||
                        "lib/chart.js/chart.min",
 | 
					                        "lib/chart.js_4.1.2/chart.umd",
 | 
				
			||||||
                        "lib/dropzone/dropzone-min",
 | 
					                        "lib/dropzone/dropzone-min",
 | 
				
			||||||
                        "lib/jstree-master/jstree.min",
 | 
					                        "lib/jstree-master/jstree.min",
 | 
				
			||||||
                        "lib/notifications/sweetalert2/sweetalert2.bundle",
 | 
					                        "lib/notifications/sweetalert2/sweetalert2.bundle",
 | 
				
			||||||
@ -870,7 +870,9 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
 | 
				
			|||||||
                    if (isJSON(sessionStorage.getItem("pageAct"))) {
 | 
					                    if (isJSON(sessionStorage.getItem("pageAct"))) {
 | 
				
			||||||
                        lastPageAct = JSON.parse(sessionStorage.getItem("pageAct"));
 | 
					                        lastPageAct = JSON.parse(sessionStorage.getItem("pageAct"));
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    if ((lastPageAct.sysSubTag && lastPage == "systemMonitor") || lastPage == "sysElevator" || lastPage == "sysSensor") {
 | 
					                    if ((lastPageAct.sysSubTag && lastPage == "systemMonitor") || lastPage == "sysElevator"
 | 
				
			||||||
 | 
					                        //  || lastPage == "sysSensor"
 | 
				
			||||||
 | 
					                    ) {
 | 
				
			||||||
                        $(`#subSysBtn${lastPageAct.sysSubTag}`).click();
 | 
					                        $(`#subSysBtn${lastPageAct.sysSubTag}`).click();
 | 
				
			||||||
                        $("#sysMonTopBtn").YTTab("set");
 | 
					                        $("#sysMonTopBtn").YTTab("set");
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
@ -927,7 +929,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
 | 
				
			|||||||
                    //     }
 | 
					                    //     }
 | 
				
			||||||
                    // })
 | 
					                    // })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    console.log(result);
 | 
					                    // console.log(result);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -946,7 +948,9 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
 | 
				
			|||||||
                    if (!page) {
 | 
					                    if (!page) {
 | 
				
			||||||
                        return;
 | 
					                        return;
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    if (page != "systemMonitor" && page != "sysElevator" && page != "sysSenesor") {
 | 
					                    if (page != "systemMonitor" && page != "sysElevator"
 | 
				
			||||||
 | 
					                        //  && page != "sysSensor"
 | 
				
			||||||
 | 
					                    ) {
 | 
				
			||||||
                        $("#sysMonBtnList [name=topFunBtn]").removeClass("active");
 | 
					                        $("#sysMonBtnList [name=topFunBtn]").removeClass("active");
 | 
				
			||||||
                        pageAct.sysMainTag = null;
 | 
					                        pageAct.sysMainTag = null;
 | 
				
			||||||
                        pageAct.sysSubTag = null;
 | 
					                        pageAct.sysSubTag = null;
 | 
				
			||||||
@ -1161,12 +1165,22 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
 | 
				
			|||||||
                                                <label class="m-0 mt-2">${devName}</label>
 | 
					                                                <label class="m-0 mt-2">${devName}</label>
 | 
				
			||||||
                                            </div>
 | 
					                                            </div>
 | 
				
			||||||
                                            <div id="card-tab" class="row justify-content-end nav nav-tabs" role="tablist">
 | 
					                                            <div id="card-tab" class="row justify-content-end nav nav-tabs" role="tablist">
 | 
				
			||||||
                                                <button type="button" id="state-tab" class="btn btn-icon nav-link active" role="tab" data-tabname="cardTab" data-target="#state"><i class="fa fa-desktop icon"></i></button>
 | 
					                                                <button type="button" id="state-tab"
 | 
				
			||||||
 | 
					                                                data-toggle="tooltip" data-placement="bottom" title="即時監控"
 | 
				
			||||||
 | 
					                                                class="px-2 btn btn-icon border-0 nav-link active mx-1" role="tab" data-tabname="cardTab" data-target="#state"><i class="fa fa-desktop icon fa-2x"></i></button>
 | 
				
			||||||
                                                ${lightHtml}
 | 
					                                                ${lightHtml}
 | 
				
			||||||
                                                <button type="button" id="info-tab" class="btn btn-icon nav-link" role="tab" data-tabname="cardTab" data-target="#info"><i class="fa fa-cog icon"></i></button>
 | 
					                                                <button type="button" id="info-tab"
 | 
				
			||||||
                                                <button type="button" id="errRec-tab" class="btn btn-icon nav-link" role="tab" data-tabname="cardTab" data-target="#errRec"><i class="fas fa-exclamation-triangle"></i></button>
 | 
					                                                data-toggle="tooltip" data-placement="bottom" title="基本資料"
 | 
				
			||||||
                                                <button type="button" id="opeRec-tab" class="btn btn-icon nav-link" role="tab" data-tabname="cardTab" data-target="#opeRec"><i class="fa fa-bars icon"></i></button>
 | 
					                                                class="px-2 btn btn-icon border-0 nav-link mx-1" role="tab" data-tabname="cardTab" data-target="#info"><i class="fa fa-cog icon fa-2x"></i></button>
 | 
				
			||||||
                                                <button class="btn p-2"><i class="fas fa-times fs-1 text-white-50" data-close="yttooltip"></i></button>
 | 
					                                                <button type="button"
 | 
				
			||||||
 | 
					                                                d data-toggle="tooltip" data-placement="bottom" title="告警資料"
 | 
				
			||||||
 | 
					                                                id="errRec-tab" class=" px-2 btn btn-icon border-0 nav-link mx-1 position-relative " role="tab" data-tabname="cardTab" data-target="#errRec"><i class="fas fa-exclamation-triangle fa-2x"></i></button>
 | 
				
			||||||
 | 
					                                                <button type="button"
 | 
				
			||||||
 | 
					                                                data-toggle="tooltip" data-placement="bottom" title="運維紀錄"
 | 
				
			||||||
 | 
					                                                id="opeRec-tab" class=" px-2 btn btn-icon border-0 nav-link mx-1" role="tab" data-tabname="cardTab" data-target="#opeRec"><i class="fa fa-bars icon fa-2x"></i></button>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                                                <button type="button" class="px-2 btn btn-icon border-0 nav-link mx-1"><i class="fas fa-times text-white-50 fa-2x" data-close="yttooltip"></i></button>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                                            </div>
 | 
					                                            </div>
 | 
				
			||||||
                                        </div>
 | 
					                                        </div>
 | 
				
			||||||
                                        <div class="card-body p-2 tab-content">
 | 
					                                        <div class="card-body p-2 tab-content">
 | 
				
			||||||
@ -1202,11 +1216,11 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
 | 
				
			|||||||
                                controlFocusHotspot($(oriEle).data("dbId"));
 | 
					                                controlFocusHotspot($(oriEle).data("dbId"));
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
                            // 3D 視角 ZOOM IN 聚焦
 | 
					                            // 3D 視角 ZOOM IN 聚焦
 | 
				
			||||||
                            /*
 | 
					
 | 
				
			||||||
                            if (devObj) {
 | 
					                            if (devObj) {
 | 
				
			||||||
                                moveViewToDevice(devObj?.forge_dbid);
 | 
					                                moveViewToDevice(devObj?.forge_dbid);
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
                            */
 | 
					
 | 
				
			||||||
                            // pop 視窗卡片可拖移功能初始化
 | 
					                            // pop 視窗卡片可拖移功能初始化
 | 
				
			||||||
                            $(tooltipEle).draggable({
 | 
					                            $(tooltipEle).draggable({
 | 
				
			||||||
                                cursor: "move",
 | 
					                                cursor: "move",
 | 
				
			||||||
@ -1379,6 +1393,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            // Card - 異常紀錄 Table
 | 
					            // Card - 異常紀錄 Table
 | 
				
			||||||
            function callbackForErr(result) {
 | 
					            function callbackForErr(result) {
 | 
				
			||||||
 | 
					                console.log("@@@", result)
 | 
				
			||||||
                if (errRecTable) {
 | 
					                if (errRecTable) {
 | 
				
			||||||
                    errRecTable.destroy();
 | 
					                    errRecTable.destroy();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
@ -1410,9 +1425,9 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
 | 
				
			|||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        "title": "發生/完成時間",
 | 
					                        "title": "發生/完成時間",
 | 
				
			||||||
                        "data": "normalTime",
 | 
					                        "data": "normalTime",
 | 
				
			||||||
                        //"render": function (data, type, row) {
 | 
					                        // "render": function (data, type, row) {
 | 
				
			||||||
                        //    return row.timestamp + "<br>" + data;
 | 
					                        //     return row.timestamp + "<br>" + data;
 | 
				
			||||||
                        //},
 | 
					                        // },
 | 
				
			||||||
                    },
 | 
					                    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                ];
 | 
					                ];
 | 
				
			||||||
@ -1626,10 +1641,10 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
 | 
				
			|||||||
                            if (subSysObj.sub_system_tag == "EL") {
 | 
					                            if (subSysObj.sub_system_tag == "EL") {
 | 
				
			||||||
                                page = "sysElevator";
 | 
					                                page = "sysElevator";
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
                            console.log(subSysObj.sub_system_tag)
 | 
					                            // console.log(subSysObj.sub_system_tag)
 | 
				
			||||||
                            if (subSysObj.sub_system_tag == "M12") {
 | 
					                            // if (subSysObj.sub_system_tag == "M12") {
 | 
				
			||||||
                                page = "sysSensor";
 | 
					                            //     page = "sysSensor";
 | 
				
			||||||
                            }
 | 
					                            // }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                            let li = creEle("li");
 | 
					                            let li = creEle("li");
 | 
				
			||||||
                            let a = creA(subSysObj.full_name, { "href": "javascript:;" }, [], `subSysBtn${subSysObj.sub_system_tag}`, { page: page, tabname: "systemMonitor" }, "topFunBtn");
 | 
					                            let a = creA(subSysObj.full_name, { "href": "javascript:;" }, [], `subSysBtn${subSysObj.sub_system_tag}`, { page: page, tabname: "systemMonitor" }, "topFunBtn");
 | 
				
			||||||
 | 
				
			|||||||
@ -11,7 +11,7 @@ var levels;//剖面用
 | 
				
			|||||||
var lowerIdx;//剖面的下方樓層
 | 
					var lowerIdx;//剖面的下方樓層
 | 
				
			||||||
var upperIdx;//剖面的上方樓層
 | 
					var upperIdx;//剖面的上方樓層
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function launchViewer(urn, callback,failCallback, _selector = "#forgeViewer") {
 | 
					function launchViewer(urn, callback, failCallback, _selector = "#forgeViewer") {
 | 
				
			||||||
    selector = _selector;
 | 
					    selector = _selector;
 | 
				
			||||||
    var options = {
 | 
					    var options = {
 | 
				
			||||||
        env: 'AutodeskProduction',
 | 
					        env: 'AutodeskProduction',
 | 
				
			||||||
@ -90,7 +90,6 @@ function launchViewerForHotspot(urn, callback, failCallback, _selector = "#forge
 | 
				
			|||||||
        setShadowShow();
 | 
					        setShadowShow();
 | 
				
			||||||
        $(selector).on("autodesk:loaded", function (e, nodeIds) {
 | 
					        $(selector).on("autodesk:loaded", function (e, nodeIds) {
 | 
				
			||||||
            callback ? callback(viewer, nodeIds) : "";
 | 
					            callback ? callback(viewer, nodeIds) : "";
 | 
				
			||||||
            console.log(viewer.get)
 | 
					 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $(selector).on("autodesk:loaded:fail", function (e) {
 | 
					        $(selector).on("autodesk:loaded:fail", function (e) {
 | 
				
			||||||
@ -168,6 +167,7 @@ class elevator3D {
 | 
				
			|||||||
        this.movStatus = 0;
 | 
					        this.movStatus = 0;
 | 
				
			||||||
        this.targetFloorZ = 0;
 | 
					        this.targetFloorZ = 0;
 | 
				
			||||||
        this.floorHeight = option.floorHeight ?? [{}];
 | 
					        this.floorHeight = option.floorHeight ?? [{}];
 | 
				
			||||||
 | 
					        this.sensorObjs = option.sensorObjs ?? null;
 | 
				
			||||||
        this.init();
 | 
					        this.init();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -177,7 +177,7 @@ class elevator3D {
 | 
				
			|||||||
            // 定義結果陣列
 | 
					            // 定義結果陣列
 | 
				
			||||||
            let result = [];
 | 
					            let result = [];
 | 
				
			||||||
            // 使用 InstanceTree.enumNodeFragments 遍歷模型中的所有片段
 | 
					            // 使用 InstanceTree.enumNodeFragments 遍歷模型中的所有片段
 | 
				
			||||||
            this.viewer?.model?.getData().instanceTree.enumNodeFragments(nodeId,(fragId) => {
 | 
					            this.viewer?.model?.getData().instanceTree.enumNodeFragments(nodeId, (fragId) => {
 | 
				
			||||||
                // 將遍歷到的片段 ID 添加到結果陣列中
 | 
					                // 將遍歷到的片段 ID 添加到結果陣列中
 | 
				
			||||||
                result.push(fragId);
 | 
					                result.push(fragId);
 | 
				
			||||||
            }, (nodeId) => {
 | 
					            }, (nodeId) => {
 | 
				
			||||||
@ -219,6 +219,12 @@ class elevator3D {
 | 
				
			|||||||
                let fragPosition = new THREE.Vector3(0, 0, 0);// 一樓0 二樓15 三樓 26
 | 
					                let fragPosition = new THREE.Vector3(0, 0, 0);// 一樓0 二樓15 三樓 26
 | 
				
			||||||
                // 設置當前片段的位置
 | 
					                // 設置當前片段的位置
 | 
				
			||||||
                fragProxy.position = fragPosition;
 | 
					                fragProxy.position = fragPosition;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                // if(nodeId === 13704) {
 | 
				
			||||||
 | 
					                //   // 改變感測器熱點位置
 | 
				
			||||||
 | 
					                //   this.sensorObjs&&this.sensorObjs[0]?.changePos(13706, fragProxy.position.z)
 | 
				
			||||||
 | 
					                // }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                // 更新當前片段的動畫變換矩陣
 | 
					                // 更新當前片段的動畫變換矩陣
 | 
				
			||||||
                fragProxy.updateAnimTransform();
 | 
					                fragProxy.updateAnimTransform();
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
@ -298,6 +304,11 @@ class elevator3D {
 | 
				
			|||||||
                tarFrag.frag.position.z = fragProxy.position.z;
 | 
					                tarFrag.frag.position.z = fragProxy.position.z;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            fragProxyZ = fragProxy.position.z;
 | 
					            fragProxyZ = fragProxy.position.z;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (nodeId === 13704) {
 | 
				
			||||||
 | 
					                // 改變感測器熱點位置
 | 
				
			||||||
 | 
					                this.sensorObjs && this.sensorObjs[0]?.changePos(13706, fragProxyZ)
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
            fragProxy.updateAnimTransform()
 | 
					            fragProxy.updateAnimTransform()
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -349,7 +360,7 @@ function onDocumentLoadSuccess(doc, eleOption) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    viewer.addEventListener(Autodesk.Viewing.GEOMETRY_LOADED_EVENT, function () {
 | 
					    viewer.addEventListener(Autodesk.Viewing.GEOMETRY_LOADED_EVENT, function () {
 | 
				
			||||||
        let instanceTree = viewer.model?.getData().instanceTree;
 | 
					        let instanceTree = viewer.model?.getData().instanceTree;
 | 
				
			||||||
        console.log(instanceTree.nodeAccess)
 | 
					        // console.log(instanceTree.nodeAccess)
 | 
				
			||||||
        allDbIdsStr = Object.keys(instanceTree.nodeAccess.dbIdToIndex);
 | 
					        allDbIdsStr = Object.keys(instanceTree.nodeAccess.dbIdToIndex);
 | 
				
			||||||
        /*getNodeIdByDbIds("【電梯】", (nodeIds) => {*/
 | 
					        /*getNodeIdByDbIds("【電梯】", (nodeIds) => {*/
 | 
				
			||||||
        $(selector).trigger("autodesk:loaded");
 | 
					        $(selector).trigger("autodesk:loaded");
 | 
				
			||||||
@ -362,7 +373,7 @@ function onDocumentLoadSuccess(doc, eleOption) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 輔助函數,使用 Promise 封裝 viewer.getProperties 函數
 | 
					// 輔助函數,使用 Promise 封裝 viewer.getProperties 函數
 | 
				
			||||||
function viewerGetProperties(dbIds,attributeName = null) {
 | 
					function viewerGetProperties(dbIds, attributeName = null) {
 | 
				
			||||||
    // 在這裡,我們使用 viewer.getProperties 函數的成功回調函數作為 resolve 函數,
 | 
					    // 在這裡,我們使用 viewer.getProperties 函數的成功回調函數作為 resolve 函數,
 | 
				
			||||||
    // 並使用 viewer.getProperties 函數的失敗回調函數作為 resolve 函數的參數
 | 
					    // 並使用 viewer.getProperties 函數的失敗回調函數作為 resolve 函數的參數
 | 
				
			||||||
    // 這樣,當 viewer.getProperties 函數成功時,Promise 會傳回 properties 物件;
 | 
					    // 這樣,當 viewer.getProperties 函數成功時,Promise 會傳回 properties 物件;
 | 
				
			||||||
@ -373,9 +384,9 @@ function viewerGetProperties(dbIds,attributeName = null) {
 | 
				
			|||||||
            option.propFilter = [attributeName]; // 限制只返回指定的屬性
 | 
					            option.propFilter = [attributeName]; // 限制只返回指定的屬性
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        viewer.model.getBulkProperties2(dbIds, option,    // 取得指定元素的屬性信息
 | 
					        viewer.model.getBulkProperties2(dbIds, option,    // 取得指定元素的屬性信息
 | 
				
			||||||
        function (elements) {
 | 
					            function (elements) {
 | 
				
			||||||
            resolve(elements);   // 成功時傳回 elements 物件
 | 
					                resolve(elements);   // 成功時傳回 elements 物件
 | 
				
			||||||
        })
 | 
					            })
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -395,7 +406,7 @@ async function getNodeIdByDbIds(checkValue = [], callback = null) {
 | 
				
			|||||||
    let evelMap = new Map();
 | 
					    let evelMap = new Map();
 | 
				
			||||||
    let hasElement = false; // 設置是否有 【tag_id】的node
 | 
					    let hasElement = false; // 設置是否有 【tag_id】的node
 | 
				
			||||||
    let targetNodeIds = await getNodeIdBySearch(checkValue);
 | 
					    let targetNodeIds = await getNodeIdBySearch(checkValue);
 | 
				
			||||||
    let elements = await viewerGetProperties(targetNodeIds,"【tag_id】");
 | 
					    let elements = await viewerGetProperties(targetNodeIds, "【tag_id】");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // 從 elements 中篩選出包含 【tag_id】 屬性的元素
 | 
					    // 從 elements 中篩選出包含 【tag_id】 屬性的元素
 | 
				
			||||||
    elements = elements.filter(x => x.properties.findIndex(y => y.displayName == "【tag_id】" && checkValue.indexOf(y.displayValue) != -1) != -1);
 | 
					    elements = elements.filter(x => x.properties.findIndex(y => y.displayName == "【tag_id】" && checkValue.indexOf(y.displayValue) != -1) != -1);
 | 
				
			||||||
@ -413,7 +424,7 @@ async function getNodeIdByDbIds(checkValue = [], callback = null) {
 | 
				
			|||||||
        // 二次篩選
 | 
					        // 二次篩選
 | 
				
			||||||
        chiElements = targetNodeIds.filter(x => x.properties.findIndex(y => y.displayName == "child") != -1);
 | 
					        chiElements = targetNodeIds.filter(x => x.properties.findIndex(y => y.displayName == "child") != -1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
         // 獲取子元素的 nodeId
 | 
					        // 獲取子元素的 nodeId
 | 
				
			||||||
        targetNodeIds = chiElements.map(x => x.properties[0].displayValue);
 | 
					        targetNodeIds = chiElements.map(x => x.properties[0].displayValue);
 | 
				
			||||||
        // 獲取子元素的屬性信息
 | 
					        // 獲取子元素的屬性信息
 | 
				
			||||||
        chiElements = await viewerGetProperties(targetNodeIds);
 | 
					        chiElements = await viewerGetProperties(targetNodeIds);
 | 
				
			||||||
@ -560,8 +571,12 @@ class ADHeatMaps {
 | 
				
			|||||||
    init = async function () {
 | 
					    init = async function () {
 | 
				
			||||||
        // 載入 Autodesk Viewer 的資料視覺化擴充功能
 | 
					        // 載入 Autodesk Viewer 的資料視覺化擴充功能
 | 
				
			||||||
        const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization");
 | 
					        const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization");
 | 
				
			||||||
 | 
					        this.dataVizExtn = dataVizExtn;
 | 
				
			||||||
        // 儲存 Viewer 的模型
 | 
					        // 儲存 Viewer 的模型
 | 
				
			||||||
        this.model = viewer.model;
 | 
					        this.model = viewer.model;
 | 
				
			||||||
 | 
					        this.addHeatMaps()
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async addHeatMaps() {
 | 
				
			||||||
        const {
 | 
					        const {
 | 
				
			||||||
            SurfaceShadingData,
 | 
					            SurfaceShadingData,
 | 
				
			||||||
            SurfaceShadingPoint,
 | 
					            SurfaceShadingPoint,
 | 
				
			||||||
@ -584,11 +599,12 @@ class ADHeatMaps {
 | 
				
			|||||||
            this.devices.filter(x => x.roomDbId == rDbid).forEach((device) => {
 | 
					            this.devices.filter(x => x.roomDbId == rDbid).forEach((device) => {
 | 
				
			||||||
                const shadingPoint = new SurfaceShadingPoint(
 | 
					                const shadingPoint = new SurfaceShadingPoint(
 | 
				
			||||||
                    device.id,
 | 
					                    device.id,
 | 
				
			||||||
                    device.position,
 | 
					                    undefined,
 | 
				
			||||||
                    device.sensorTypes
 | 
					                    device.sensorTypes
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
 | 
					                shadingPoint.positionFromDBId(this.model, device.roomDbId)
 | 
				
			||||||
                shadingNode.addPoint(shadingPoint);
 | 
					                shadingNode.addPoint(shadingPoint);
 | 
				
			||||||
                device.temp = 0;
 | 
					                // device.temp = 0;
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            heatmapData.addChild(shadingNode);
 | 
					            heatmapData.addChild(shadingNode);
 | 
				
			||||||
@ -598,12 +614,10 @@ class ADHeatMaps {
 | 
				
			|||||||
        heatmapData.initialize(this.model);
 | 
					        heatmapData.initialize(this.model);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // 對模型做表面顏色的渲染
 | 
					        // 對模型做表面顏色的渲染
 | 
				
			||||||
        await dataVizExtn.setupSurfaceShading(this.model, heatmapData);
 | 
					        await this.dataVizExtn.setupSurfaceShading(this.model, heatmapData);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // 對 "temperature" 的溫度設定兩種顏色:紅色和藍色
 | 
					        // 對 "temperature" 的溫度設定兩種顏色:紅色和藍色
 | 
				
			||||||
        dataVizExtn.registerSurfaceShadingColors("temperature", [0x0000ff, 0x00ff00, 0xffff00, 0xff0000]);
 | 
					        this.dataVizExtn.registerSurfaceShadingColors("temperature", [0x0000ff, 0x00ff00, 0xffff00, 0xff0000]);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        this.dataVizExtn = dataVizExtn;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $.each(this.roomDbIds, (idx, rDbid) => {
 | 
					        $.each(this.roomDbIds, (idx, rDbid) => {
 | 
				
			||||||
            this.dataVizExtn.renderSurfaceShading("RoomPanel" + rDbid, "temperature", this.getSensorValue.bind(this));
 | 
					            this.dataVizExtn.renderSurfaceShading("RoomPanel" + rDbid, "temperature", this.getSensorValue.bind(this));
 | 
				
			||||||
@ -613,8 +627,9 @@ class ADHeatMaps {
 | 
				
			|||||||
        this.onComplete ? this.onComplete() : "";
 | 
					        this.onComplete ? this.onComplete() : "";
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    getSensorValue = function(device, sensorType) {
 | 
					    getSensorValue = function (device, sensorType) {
 | 
				
			||||||
        let dev = this.devices.filter(x => x.id == device.id)[0];
 | 
					        let dev = this.devices.filter(x => x.id == device.id)[0];
 | 
				
			||||||
 | 
					        // shadingPoint.positionFromDBId(this.model, device.roomDbId)
 | 
				
			||||||
        return dev.temp / 40;
 | 
					        return dev.temp / 40;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -627,7 +642,7 @@ class ADHeatMaps {
 | 
				
			|||||||
                dev.temp = temp;
 | 
					                dev.temp = temp;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
        $.each(this.roomDbIds, (idx, rDbid) => {
 | 
					        $.each(this.roomDbIds, async (idx, rDbid) => {
 | 
				
			||||||
            this.dataVizExtn.renderSurfaceShading("RoomPanel" + rDbid, "temperature", this.getSensorValue.bind(this));
 | 
					            this.dataVizExtn.renderSurfaceShading("RoomPanel" + rDbid, "temperature", this.getSensorValue.bind(this));
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
        //if (rDbid != null) {
 | 
					        //if (rDbid != null) {
 | 
				
			||||||
@ -753,16 +768,22 @@ async function testNewLight(dataList) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
//------------------- 加入熱點 -----------------
 | 
					//------------------- 加入熱點 -----------------
 | 
				
			||||||
async function addHotPoint(data) {
 | 
					async function addHotPoint(data) {
 | 
				
			||||||
    var viewer = data.target;
 | 
					    var viewer = data.target ? data.target : data;
 | 
				
			||||||
    const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization");
 | 
					    const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization");
 | 
				
			||||||
    const DataVizCore = Autodesk.DataVisualization.Core;
 | 
					    const DataVizCore = Autodesk.DataVisualization.Core;
 | 
				
			||||||
    const viewableType = Autodesk.DataVisualization.Core.ViewableType.SPRITE;//DataVizCore.ViewableType.SPRITE;
 | 
					    const viewableType = Autodesk.DataVisualization.Core.ViewableType.SPRITE;//DataVizCore.ViewableType.SPRITE;
 | 
				
			||||||
    const spriteColor = new THREE.Color(0xffffff);
 | 
					    let spriteColor = null;
 | 
				
			||||||
 | 
					    let spriteIcon = "";
 | 
				
			||||||
    const dbIdStart = 10;
 | 
					    const dbIdStart = 10;
 | 
				
			||||||
    const dbIdEnd = 19;
 | 
					    const dbIdEnd = 19;
 | 
				
			||||||
    let spriteIcon = "/file/img/forge/hotspot.svg";
 | 
					    if (pageAct.sysSubTag === "M12") {
 | 
				
			||||||
    if (location.href.indexOf("localhost:5966") != -1) {
 | 
					        return
 | 
				
			||||||
        spriteIcon = "/img/forge/hotspot.svg";
 | 
					    } else {
 | 
				
			||||||
 | 
					        spriteColor = new THREE.Color(0xffffff);
 | 
				
			||||||
 | 
					        spriteIcon = "/file/img/forge/hotspot.svg";
 | 
				
			||||||
 | 
					        if (location.href.indexOf("localhost:5966") != -1) {
 | 
				
			||||||
 | 
					            spriteIcon = "/img/forge/hotspot.svg";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const style = new DataVizCore.ViewableStyle(viewableType, spriteColor, spriteIcon);
 | 
					    const style = new DataVizCore.ViewableStyle(viewableType, spriteColor, spriteIcon);
 | 
				
			||||||
@ -793,14 +814,27 @@ async function addHotPoint(data) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    await viewableData.finish();
 | 
					    await viewableData.finish();
 | 
				
			||||||
    dataVizExtn.addViewables(viewableData);
 | 
					    dataVizExtn.addViewables(viewableData);
 | 
				
			||||||
 | 
					    // console.log(dataVizExtn)
 | 
				
			||||||
    $(selector).trigger("autodesk:complete:sprite", { myDataList });
 | 
					    $(selector).trigger("autodesk:complete:sprite", { myDataList });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //---------------- 熱點點擊事件 --------------------
 | 
					    //---------------- 熱點點擊事件 --------------------
 | 
				
			||||||
    function onSpriteClicked(event) {
 | 
					    function onSpriteClicked(event) {
 | 
				
			||||||
        event.hasStopped = true;
 | 
					        event.hasStopped = true;
 | 
				
			||||||
 | 
					        if (pageAct.sysSubTag === "M12" && event != undefined && event != null) {
 | 
				
			||||||
 | 
					            if (event.dbId >= dbIdStart) {
 | 
				
			||||||
 | 
					                changeColorForHotspot(event.dbId);
 | 
				
			||||||
 | 
					                changeScaleForHotspot(event.dbId, false);
 | 
				
			||||||
 | 
					                let myData = [this.curDevice].filter(x => x.forge_dbid == event.dbId)[0];
 | 
				
			||||||
 | 
					                moveViewToDevice(myData.forge_dbid);//移動視角至該設備
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                $(selector).trigger("autodesk:click:sprite", { event, myData });
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                $(selector).trigger("autodesk:clickOut:sprite", { event });
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        if (event != undefined && event != null) {
 | 
					        if (event != undefined && event != null) {
 | 
				
			||||||
            if (event.dbId >= dbIdStart) {//event.dbId > 0 && event.dbId < 19
 | 
					            if (event.dbId >= dbIdStart) {//event.dbId > 0 && event.dbId < 19
 | 
				
			||||||
                console.log(`Sprite clicked: ${event.dbId}`);
 | 
					                // console.log(`Sprite clicked: ${event.dbId}`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                for (let i = dbIdStart; i <= myDataList.length + 10; i++) {
 | 
					                for (let i = dbIdStart; i <= myDataList.length + 10; i++) {
 | 
				
			||||||
                    changeColorForHotspot(i);
 | 
					                    changeColorForHotspot(i);
 | 
				
			||||||
@ -821,7 +855,7 @@ async function addHotPoint(data) {
 | 
				
			|||||||
                //document.getElementById('deviceName').innerHTML = viewer.model.getInstanceTree().getNodeName(event.clickInfo.dbId);
 | 
					                //document.getElementById('deviceName').innerHTML = viewer.model.getInstanceTree().getNodeName(event.clickInfo.dbId);
 | 
				
			||||||
                //document.getElementById('deviceDbid').innerHTML = event.clickInfo.dbId;
 | 
					                //document.getElementById('deviceDbid').innerHTML = event.clickInfo.dbId;
 | 
				
			||||||
                //document.getElementById('devicePosition').innerHTML = "(" + (event.clickInfo.point.x).toFixed(2) + ", " + (event.clickInfo.point.y).toFixed(2) + ", " + (event.clickInfo.point.z).toFixed(2) + ")";
 | 
					                //document.getElementById('devicePosition').innerHTML = "(" + (event.clickInfo.point.x).toFixed(2) + ", " + (event.clickInfo.point.y).toFixed(2) + ", " + (event.clickInfo.point.z).toFixed(2) + ")";
 | 
				
			||||||
                console.log(`event>>  dbId: ${event.clickInfo.dbId}, id: ${event.clickInfo.object.id}, position.x: ${event.clickInfo.point.x}, y: ${event.clickInfo.point.y}, z: ${event.clickInfo.point.z}, name: ${viewer.model.getInstanceTree().getNodeName(event.clickInfo.dbId)}`);
 | 
					                // console.log(`event>>  dbId: ${event.clickInfo.dbId}, id: ${event.clickInfo.object.id}, position.x: ${event.clickInfo.point.x}, y: ${event.clickInfo.point.y}, z: ${event.clickInfo.point.z}, name: ${viewer.model.getInstanceTree().getNodeName(event.clickInfo.dbId)}`);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -847,8 +881,9 @@ async function addHotPoint(data) {
 | 
				
			|||||||
// 熱點 更換顏色
 | 
					// 熱點 更換顏色
 | 
				
			||||||
async function changeColorForHotspot(dbId, type = null) {
 | 
					async function changeColorForHotspot(dbId, type = null) {
 | 
				
			||||||
    const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization");
 | 
					    const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization");
 | 
				
			||||||
    let spriteColorFocus = new THREE.Color(0xffffff); 
 | 
					    // console.log(dbId, dataVizExtn.viewableData.getViewableColor(dbId, false))
 | 
				
			||||||
    if (type == "focus") {
 | 
					    let spriteColorFocus = dataVizExtn.viewableData?.getViewableColor(dbId, false) || new THREE.Color(0xffffff);
 | 
				
			||||||
 | 
					    if (type == "focus" && pageAct.sysSubTag !== "M12") {
 | 
				
			||||||
        spriteColorFocus = new THREE.Color(0x00ffe1);
 | 
					        spriteColorFocus = new THREE.Color(0x00ffe1);
 | 
				
			||||||
    } else if (type == "error") {
 | 
					    } else if (type == "error") {
 | 
				
			||||||
        spriteColorFocus = new THREE.Color(0xff0000);
 | 
					        spriteColorFocus = new THREE.Color(0xff0000);
 | 
				
			||||||
@ -861,6 +896,27 @@ async function changeColorForHotspot(dbId, type = null) {
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// 熱點 更換顏色---環境感知器
 | 
				
			||||||
 | 
					async function changeColorForSensorHotspot(dbId, temp) {
 | 
				
			||||||
 | 
					    const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization");
 | 
				
			||||||
 | 
					    const temps = [new THREE.Color(0x0000ff), new THREE.Color(0x00ff00), new THREE.Color(0xffff00), new THREE.Color(0xff0000)]
 | 
				
			||||||
 | 
					    let index = Math.floor(temp / 10);
 | 
				
			||||||
 | 
					    if (index > 3) {
 | 
				
			||||||
 | 
					        index = 3
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    const viewablesToUpdate = dbId;
 | 
				
			||||||
 | 
					    const color = temps[index]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    dataVizExtn.invalidateViewables(viewablesToUpdate, (viewable) => {
 | 
				
			||||||
 | 
					        return {
 | 
				
			||||||
 | 
					            color: color,
 | 
				
			||||||
 | 
					        };
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					    console.log(dataVizExtn)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 熱點 更換大小
 | 
					// 熱點 更換大小
 | 
				
			||||||
async function changeScaleForHotspot(dbId, type = true) {
 | 
					async function changeScaleForHotspot(dbId, type = true) {
 | 
				
			||||||
    const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization");
 | 
					    const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization");
 | 
				
			||||||
@ -1050,7 +1106,7 @@ async function loadHeatmapForFloor() {
 | 
				
			|||||||
//------------ 剖面 ----------------------
 | 
					//------------ 剖面 ----------------------
 | 
				
			||||||
async function getRemoteLevels() {
 | 
					async function getRemoteLevels() {
 | 
				
			||||||
    const aecData = await Autodesk.Viewing.Document.getAecModelData(this.viewer.model.getDocumentNode());
 | 
					    const aecData = await Autodesk.Viewing.Document.getAecModelData(this.viewer.model.getDocumentNode());
 | 
				
			||||||
    if (!aecData.levels) return null;
 | 
					    if (!aecData || !aecData.levels) return null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const levels2 = aecData.levels;
 | 
					    const levels2 = aecData.levels;
 | 
				
			||||||
    levels2.sort((a, b) => b.elevation - a.elevation);
 | 
					    levels2.sort((a, b) => b.elevation - a.elevation);
 | 
				
			||||||
@ -1106,10 +1162,10 @@ async function newLight(lightPosition) {
 | 
				
			|||||||
    //聚光燈
 | 
					    //聚光燈
 | 
				
			||||||
    var spotLight = new THREE.SpotLight(0xffffff, 200, 20, 0.6, 0.5, 10);
 | 
					    var spotLight = new THREE.SpotLight(0xffffff, 200, 20, 0.6, 0.5, 10);
 | 
				
			||||||
    spotLight.position.set(lightPosition.x, lightPosition.y, lightPosition.z);
 | 
					    spotLight.position.set(lightPosition.x, lightPosition.y, lightPosition.z);
 | 
				
			||||||
    console.log(lightPosition.x, lightPosition.y, lightPosition.z)
 | 
					    // console.log(lightPosition.x, lightPosition.y, lightPosition.z)
 | 
				
			||||||
    spotLight.castShadow = false;
 | 
					    spotLight.castShadow = false;
 | 
				
			||||||
    spotLight.visible = true;
 | 
					    spotLight.visible = true;
 | 
				
			||||||
    spotLight.target.position.set(lightPosition.x, lightPosition.y, lightPosition.z-20);
 | 
					    spotLight.target.position.set(lightPosition.x, lightPosition.y, lightPosition.z - 20);
 | 
				
			||||||
    viewer.scene.add(spotLight.target);
 | 
					    viewer.scene.add(spotLight.target);
 | 
				
			||||||
    viewer.scene.add(spotLight);
 | 
					    viewer.scene.add(spotLight);
 | 
				
			||||||
    viewer.impl.sceneUpdated(true);
 | 
					    viewer.impl.sceneUpdated(true);
 | 
				
			||||||
 | 
				
			|||||||
@ -6,24 +6,24 @@
 | 
				
			|||||||
})
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * fn 定義 | 手動初始化 Bootstrap dropdown select 
 | 
					* fn 定義 | 手動初始化 Bootstrap dropdown select
 | 
				
			||||||
 */
 | 
					*/
 | 
				
			||||||
$.fn.droSetItem = function () {
 | 
					$.fn.droSetItem = function () {
 | 
				
			||||||
    setDropdownItem(this);
 | 
					    setDropdownItem(this);
 | 
				
			||||||
    return this;
 | 
					    return this;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * fn 定義 | 輸出含原元素 html
 | 
					* fn 定義 | 輸出含原元素 html
 | 
				
			||||||
 */
 | 
					*/
 | 
				
			||||||
$.fn.outerHtml = function () {
 | 
					$.fn.outerHtml = function () {
 | 
				
			||||||
    return $(this).prop("outerHTML");
 | 
					    return $(this).prop("outerHTML");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * fn 定義 | Loading 操作
 | 
					* fn 定義 | Loading 操作
 | 
				
			||||||
 * @param {any} type - close / start / exceed , exceed => 繼續執行並可切換文字
 | 
					* @param {any} type - close / start / exceed , exceed => 繼續執行並可切換文字
 | 
				
			||||||
 * @param {any} text - 右下角 Alert 文字
 | 
					* @param {any} text - 右下角 Alert 文字
 | 
				
			||||||
 */
 | 
					*/
 | 
				
			||||||
$.fn.Loading = function (type = "close", text) {
 | 
					$.fn.Loading = function (type = "close", text) {
 | 
				
			||||||
    let ele = this;
 | 
					    let ele = this;
 | 
				
			||||||
    let aleObj = $(this)[0]._aleObj;
 | 
					    let aleObj = $(this)[0]._aleObj;
 | 
				
			||||||
@ -82,9 +82,9 @@ $.fn.YTAlert = function () {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 設置 bootstrap dropdown 為下拉選單 
 | 
					* 設置 bootstrap dropdown 為下拉選單
 | 
				
			||||||
 * @param {any} menuEle - .dropdown-menu element
 | 
					* @param {any} menuEle - .dropdown-menu element
 | 
				
			||||||
 */
 | 
					*/
 | 
				
			||||||
function setDropdownItem(menuEle) {
 | 
					function setDropdownItem(menuEle) {
 | 
				
			||||||
    if ($(menuEle).find(".dropdown-item.active").length == 0) {
 | 
					    if ($(menuEle).find(".dropdown-item.active").length == 0) {
 | 
				
			||||||
        $(menuEle).find(".dropdown-item").first().addClass("active");
 | 
					        $(menuEle).find(".dropdown-item").first().addClass("active");
 | 
				
			||||||
@ -106,19 +106,19 @@ function setDropdownItem(menuEle) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 預設設備圖像
 | 
					* 預設設備圖像
 | 
				
			||||||
 * @param {any} obj
 | 
					* @param {any} obj
 | 
				
			||||||
 */
 | 
					*/
 | 
				
			||||||
function defDev(obj) {
 | 
					function defDev(obj) {
 | 
				
			||||||
    let defSrc = 'img/defdev.png';
 | 
					    let defSrc = 'img/defdev.png';
 | 
				
			||||||
    obj.src = defSrc;
 | 
					    obj.src = defSrc;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * jquery datatable - ajax send data reset
 | 
					* jquery datatable - ajax send data reset
 | 
				
			||||||
 * @param {any} table
 | 
					* @param {any} table
 | 
				
			||||||
 * @param {any} sendData
 | 
					* @param {any} sendData
 | 
				
			||||||
 */
 | 
					*/
 | 
				
			||||||
function dtAjaxResetSendData(table, sendData) {
 | 
					function dtAjaxResetSendData(table, sendData) {
 | 
				
			||||||
    table.context[0].ajax.data = function (d) {
 | 
					    table.context[0].ajax.data = function (d) {
 | 
				
			||||||
        d = sendData;
 | 
					        d = sendData;
 | 
				
			||||||
@ -128,14 +128,14 @@ function dtAjaxResetSendData(table, sendData) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * element 建造 
 | 
					* element 建造
 | 
				
			||||||
 * @param {any} text
 | 
					* @param {any} text
 | 
				
			||||||
 * @param {any} id
 | 
					* @param {any} id
 | 
				
			||||||
 * @param {any} name
 | 
					* @param {any} name
 | 
				
			||||||
 * @param {any} cls
 | 
					* @param {any} cls
 | 
				
			||||||
 * @param {any} data
 | 
					* @param {any} data
 | 
				
			||||||
 * @param {any} attr
 | 
					* @param {any} attr
 | 
				
			||||||
 */
 | 
					*/
 | 
				
			||||||
function eleBuild(text = null, id = null, name = null, cls = [], data = {}, attr = {}) {
 | 
					function eleBuild(text = null, id = null, name = null, cls = [], data = {}, attr = {}) {
 | 
				
			||||||
    cls = cls ?? [], data = data ?? {}, attr = attr ?? {};
 | 
					    cls = cls ?? [], data = data ?? {}, attr = attr ?? {};
 | 
				
			||||||
    id = id ? `id="${id}"` : "";
 | 
					    id = id ? `id="${id}"` : "";
 | 
				
			||||||
@ -193,8 +193,8 @@ function creSpan(text = null, cls = [], id = null, attr = {}, data = {}, name =
 | 
				
			|||||||
    return creEle("span", text, id, name, cls, data, attr);
 | 
					    return creEle("span", text, id, name, cls, data, attr);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 根據該棟建築底下的'所有'電梯執行緒物件
 | 
					* 根據該棟建築底下的'所有'電梯執行緒物件
 | 
				
			||||||
 * */
 | 
					* */
 | 
				
			||||||
class ElevatorHandler {
 | 
					class ElevatorHandler {
 | 
				
			||||||
    constructor(ele, option = {}) {
 | 
					    constructor(ele, option = {}) {
 | 
				
			||||||
        this.ele = ele;
 | 
					        this.ele = ele;
 | 
				
			||||||
@ -448,27 +448,27 @@ function isJSON(str) {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function addBsToast(container, type = "warning",title="",content ="", id, datas = {}, option = {}) {
 | 
					function addBsToast(container, type = "warning", title = "", content = "", id, datas = {}, option = {}) {
 | 
				
			||||||
    datas = Object.keys(datas).length != 0 ? `${Object.keys(datas).map(x => `data-${x}="${datas[x]}"`).join(" ")}` : "";
 | 
					    datas = Object.keys(datas).length != 0 ? `${Object.keys(datas).map(x => `data-${x}="${datas[x]}"`).join(" ")}` : "";
 | 
				
			||||||
    let iconClass = option.iconHtml ?? `fas fa-exclamation-triangle`;
 | 
					    let iconClass = option.iconHtml ?? `fas fa-exclamation-triangle`;
 | 
				
			||||||
    let strHtml = `<div class="toast" role="alert" aria-live="assertive" aria-atomic="true" data-autohide="false" ${datas}>
 | 
					    let strHtml = `<div class="toast" role="alert" aria-live="assertive" aria-atomic="true" data-autohide="false" ${datas}>
 | 
				
			||||||
                        <div class="toast-header ${warning ? `bg-` + warning : ""}">
 | 
					                      <div class="toast-header ${warning ? `bg-` + warning : ""}">
 | 
				
			||||||
                            <i class="${iconClass}"></i>
 | 
					                          <i class="${iconClass}"></i>
 | 
				
			||||||
                            <strong class="mr-auto">${title}</strong>
 | 
					                          <strong class="mr-auto">${title}</strong>
 | 
				
			||||||
                            <small class="text-muted">just now</small>
 | 
					                          <small class="text-muted">just now</small>
 | 
				
			||||||
                            <button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
 | 
					                          <button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
 | 
				
			||||||
                                <span aria-hidden="true">×</span>
 | 
					                              <span aria-hidden="true">×</span>
 | 
				
			||||||
                            </button>
 | 
					                          </button>
 | 
				
			||||||
                        </div>
 | 
					                      </div>
 | 
				
			||||||
                        <div class="toast-body">
 | 
					                      <div class="toast-body">
 | 
				
			||||||
                            ${content}
 | 
					                          ${content}
 | 
				
			||||||
                        </div>
 | 
					                      </div>
 | 
				
			||||||
                    </div>`
 | 
					                  </div>`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 取得資料庫電梯設備,根據 baja 訂閱移動 3D 電梯
 | 
					* 取得資料庫電梯設備,根據 baja 訂閱移動 3D 電梯
 | 
				
			||||||
 * */
 | 
					* */
 | 
				
			||||||
class Forge3DElevFull {
 | 
					class Forge3DElevFull {
 | 
				
			||||||
    constructor(option = {}) {
 | 
					    constructor(option = {}) {
 | 
				
			||||||
        this.allElevDevList = [];  //全電梯設備清單
 | 
					        this.allElevDevList = [];  //全電梯設備清單
 | 
				
			||||||
@ -484,17 +484,18 @@ class Forge3DElevFull {
 | 
				
			|||||||
        this.selector = option.selector ?? "#forgeViewer";
 | 
					        this.selector = option.selector ?? "#forgeViewer";
 | 
				
			||||||
        this.bajaChaCallback = option.bajaChaCallback ?? null;
 | 
					        this.bajaChaCallback = option.bajaChaCallback ?? null;
 | 
				
			||||||
        this.bajaEndCallback = option.bajaEndCallback ?? null;
 | 
					        this.bajaEndCallback = option.bajaEndCallback ?? null;
 | 
				
			||||||
        this.sensorObj = null
 | 
					        this.sensorObjs = option.sensorObjs ?? null;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  init = function () {
 | 
					    init = function () {
 | 
				
			||||||
        this.sensorObj = new Forge3DSensor({
 | 
					 | 
				
			||||||
          viewer: this.viewer,
 | 
					 | 
				
			||||||
          ordPath: { ...this.ordPath },
 | 
					 | 
				
			||||||
        })
 | 
					 | 
				
			||||||
        // 系統大類、小類固定
 | 
					        // 系統大類、小類固定
 | 
				
			||||||
        this.ordPath.system_tag = this.sysMainTag;
 | 
					        this.ordPath.system_tag = this.sysMainTag;
 | 
				
			||||||
        this.ordPath.name_tag = this.sysSubTag;
 | 
					        this.ordPath.name_tag = this.sysSubTag;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // if (pageAct.sysSubTag === "M12") {
 | 
				
			||||||
 | 
					        //   console.log("@@",pageAct, pageAct.sysSubTag)
 | 
				
			||||||
 | 
					        //   this.getSensorDevList();
 | 
				
			||||||
 | 
					        // }
 | 
				
			||||||
        this.getElevDevList();
 | 
					        this.getElevDevList();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -534,6 +535,7 @@ class Forge3DElevFull {
 | 
				
			|||||||
                if (this.elev3DObj.length != 0) {
 | 
					                if (this.elev3DObj.length != 0) {
 | 
				
			||||||
                    let elevObj = this.elev3DObj.filter(x => x.nodeId == this.elev3DBind[matchDevice.device_number])[0];
 | 
					                    let elevObj = this.elev3DObj.filter(x => x.nodeId == this.elev3DBind[matchDevice.device_number])[0];
 | 
				
			||||||
                    if (elevObj && elevObj.id) {
 | 
					                    if (elevObj && elevObj.id) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        elevObj.obj.setElevatorFloor(data.value)
 | 
					                        elevObj.obj.setElevatorFloor(data.value)
 | 
				
			||||||
                        elevObj.obj.movElevator();
 | 
					                        elevObj.obj.movElevator();
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
@ -593,6 +595,13 @@ class Forge3DElevFull {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                        frags.forEach((fragProxy) => {
 | 
					                        frags.forEach((fragProxy) => {
 | 
				
			||||||
                            fragProxy.frag.position.z = this.elev3DOption.floorHeight.filter(x => x.floor == subData["CP"])[0]?.height ?? 0;
 | 
					                            fragProxy.frag.position.z = this.elev3DOption.floorHeight.filter(x => x.floor == subData["CP"])[0]?.height ?? 0;
 | 
				
			||||||
 | 
					                            console.log("1", fragProxy.frag.position.z)
 | 
				
			||||||
 | 
					                            let start = 0;
 | 
				
			||||||
 | 
					                            if (node === 13704 && start == 0) {
 | 
				
			||||||
 | 
					                                // 改變感測器熱點位置
 | 
				
			||||||
 | 
					                                this.sensorObjs && this.sensorObjs[0]?.changePos(13706, fragProxy.frag.position.z);
 | 
				
			||||||
 | 
					                                start = 1;
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
                            fragProxy.frag.updateAnimTransform();
 | 
					                            fragProxy.frag.updateAnimTransform();
 | 
				
			||||||
                        })
 | 
					                        })
 | 
				
			||||||
                        elevObj.obj.viewer.impl.sceneUpdated(true);
 | 
					                        elevObj.obj.viewer.impl.sceneUpdated(true);
 | 
				
			||||||
@ -617,6 +626,7 @@ class Forge3DElevFull {
 | 
				
			|||||||
                viewer: this.viewer,
 | 
					                viewer: this.viewer,
 | 
				
			||||||
                nodeId: node,
 | 
					                nodeId: node,
 | 
				
			||||||
                floorHeight: this.elev3DOption.floorHeight ?? [],
 | 
					                floorHeight: this.elev3DOption.floorHeight ?? [],
 | 
				
			||||||
 | 
					                sensorObjs: this.sensorObjs,
 | 
				
			||||||
                inited: function () {
 | 
					                inited: function () {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
@ -637,9 +647,16 @@ class Forge3DElevFull {
 | 
				
			|||||||
                elevObj.obj = Object.assign(elevObj, elevator3DObj ?? {})
 | 
					                elevObj.obj = Object.assign(elevObj, elevator3DObj ?? {})
 | 
				
			||||||
                elevObj.obj.init(() => {
 | 
					                elevObj.obj.init(() => {
 | 
				
			||||||
                    let frags = elevObj.obj.fragProxys.filter(x => x.nodeId == node);
 | 
					                    let frags = elevObj.obj.fragProxys.filter(x => x.nodeId == node);
 | 
				
			||||||
 | 
					 | 
				
			||||||
                    frags.forEach((fragProxy) => {
 | 
					                    frags.forEach((fragProxy) => {
 | 
				
			||||||
                        fragProxy.frag.position.z = this.elev3DOption.floorHeight.filter(x => x.floor == subData["CP"])[0]?.height ?? 0;
 | 
					                        fragProxy.frag.position.z = this.elev3DOption.floorHeight.filter(x => x.floor == subData["CP"])[0]?.height ?? 0;
 | 
				
			||||||
 | 
					                        console.log("2", fragProxy.frag.position.z)
 | 
				
			||||||
 | 
					                        // debugger
 | 
				
			||||||
 | 
					                        let start = 0;
 | 
				
			||||||
 | 
					                        if (node === 13704 && start == 0) {
 | 
				
			||||||
 | 
					                            // 改變感測器熱點位置
 | 
				
			||||||
 | 
					                            this.sensorObjs && this.sensorObjs[0]?.changePos(13706, fragProxy.frag.position.z);
 | 
				
			||||||
 | 
					                            start = 1;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                        fragProxy.frag.updateAnimTransform()
 | 
					                        fragProxy.frag.updateAnimTransform()
 | 
				
			||||||
                    })
 | 
					                    })
 | 
				
			||||||
                    elevObj.obj.viewer.impl.sceneUpdated(true);
 | 
					                    elevObj.obj.viewer.impl.sceneUpdated(true);
 | 
				
			||||||
@ -677,229 +694,211 @@ class Forge3DElevFull {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 取得資料庫溫度感測器
 | 
					* 取得資料庫溫度感測器
 | 
				
			||||||
 * 1. baja 取得溫度感測器改變顏色
 | 
					* 1. baja 取得溫度感測器改變顏色
 | 
				
			||||||
 * 2. 參數取得要移動到的電梯位置
 | 
					* 2. 參數取得要移動到的電梯位置
 | 
				
			||||||
 * */
 | 
					* */
 | 
				
			||||||
class Forge3DSensor {
 | 
					class Forge3DSensor {
 | 
				
			||||||
  constructor(option = {}) {
 | 
					    constructor(option = {}) {
 | 
				
			||||||
    this.allSensorDevList = [];  //溫度調節器設備清單
 | 
					        this.subDeviceData = [];    //每個設備訂閱點位值
 | 
				
			||||||
    this.subDeviceData = [];    //每個設備訂閱點位值
 | 
					        this.viewer = option.viewer ?? null;
 | 
				
			||||||
    this.viewer = option.viewer ?? null;
 | 
					        this.ordPath = option.ordPath; // TPE_B1
 | 
				
			||||||
    this.ordPath = option.ordPath; // TPE_B1
 | 
					        this.sysMainTag = "ME";
 | 
				
			||||||
    this.sysMainTag = "ME";
 | 
					        this.sysSubTag = "M12";
 | 
				
			||||||
    this.sysSubTag = "M12";
 | 
					        this.selector = "#forgeViewer";
 | 
				
			||||||
    this.selector = "#forgeViewer";
 | 
					        this.heatMap = null;
 | 
				
			||||||
    this.heatMap = null;
 | 
					        this.bajaChaCallback = option.bajaChaCallback ?? null;
 | 
				
			||||||
    this.bajaChaCallback = option.bajaChaCallback ?? null;
 | 
					        this.bajaEndCallback = option.bajaEndCallback ?? null;
 | 
				
			||||||
    this.bajaEndCallback = option.bajaEndCallback ?? null;
 | 
					        this.floorHeight = 0;
 | 
				
			||||||
    this.floorHeight = 0;
 | 
					        this.dataVizExtn = null;
 | 
				
			||||||
    this.dataVizExtn = null;
 | 
					        this.DataVizCore = null;
 | 
				
			||||||
    this.#init();
 | 
					        this.tempVal = 20;
 | 
				
			||||||
  }
 | 
					        this.curDevice = option.curDevice ?? null;
 | 
				
			||||||
 | 
					        this.#init();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  #init = async function () {
 | 
					    #init = async function () {
 | 
				
			||||||
    // 系統大類、小類固定
 | 
					        // 系統大類、小類固定
 | 
				
			||||||
    this.ordPath.system_tag = this.sysMainTag;
 | 
					        this.ordPath.system_tag = this.sysMainTag;
 | 
				
			||||||
    this.ordPath.name_tag = this.sysSubTag;
 | 
					        this.ordPath.name_tag = this.sysSubTag;
 | 
				
			||||||
    this.dataVizExtn = await this.viewer.loadExtension("Autodesk.DataVisualization");
 | 
					        this.dataVizExtn = await this.viewer.loadExtension("Autodesk.DataVisualization");
 | 
				
			||||||
    //this.getSensorDevList();
 | 
					        this.DataVizCore = Autodesk.DataVisualization.Core;
 | 
				
			||||||
  }
 | 
					        await this.addHotPoint();
 | 
				
			||||||
  // 取得Sensor設備列表
 | 
					        this.changeColorForSensorHotspot(this.curDevice.forge_dbid, 35)
 | 
				
			||||||
  getSensorDevList = function () {
 | 
					        this.subSensorDevice();
 | 
				
			||||||
    let url = baseApiUrl + "/api/Device/GetDeviceList";
 | 
					 | 
				
			||||||
    let sendData = {
 | 
					 | 
				
			||||||
      sub_system_tag: this.ordPath.name_tag, // M12
 | 
					 | 
				
			||||||
      building_tag: this.ordPath.building_tag, //B1
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
    objSendData.Data = sendData;
 | 
					 | 
				
			||||||
    ytAjax = new YourTeam.Ajax(url, objSendData, (res) => {
 | 
					 | 
				
			||||||
      if (!res || res.code != "0000" || !res.data) {
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      } else {
 | 
					
 | 
				
			||||||
        $.each(res.data, (index, floObj) => {
 | 
					    }
 | 
				
			||||||
          $.each(floObj.device_list, (index2, devObj) => {
 | 
					
 | 
				
			||||||
            this.allSensorDevList.push(devObj);
 | 
					    // 建立熱點
 | 
				
			||||||
          })
 | 
					    async addHotPoint() {
 | 
				
			||||||
        })
 | 
					
 | 
				
			||||||
        let devices = this.allSensorDevList.map((x) => {
 | 
					        // this.dataVizExtn.removeAllViewables()
 | 
				
			||||||
          if (x.device_number.includes("ME_M12")) {
 | 
					        await this.registerHotPoint()
 | 
				
			||||||
            return {
 | 
					        this.subSensorDevice();
 | 
				
			||||||
              roomDbId: 12879, // Bank2 電梯
 | 
					        // console.log("2",this.dataVizExtn)
 | 
				
			||||||
              id: x.device_number,
 | 
					    }
 | 
				
			||||||
              position: isJSON(x.device_coordinate_3d)
 | 
					
 | 
				
			||||||
                ? JSON.parse(x.device_coordinate_3d)
 | 
					    async registerHotPoint(color = "") {
 | 
				
			||||||
                : {}, // x: 0, y: 25, z: -2.5      (3.35, -4.81, 12.88
 | 
					        var viewer = this.viewer;
 | 
				
			||||||
              sensorTypes: ["temperature", "humidity"],
 | 
					        const viewableType = this.DataVizCore.ViewableType.SPRITE;//DataVizCore.ViewableType.SPRITE;
 | 
				
			||||||
            };
 | 
					        const spriteColor = new THREE.Color(0x000000);
 | 
				
			||||||
          }
 | 
					        // const highlightedColor = new THREE.Color(0xe0e0ff);
 | 
				
			||||||
 | 
					        let spriteIcon = "/file/img/forge/sensor_circle.svg";
 | 
				
			||||||
 | 
					        if (location.href.indexOf("localhost:5966") != -1) {
 | 
				
			||||||
 | 
					            spriteIcon = "/img/forge/sensor_circle.svg";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        const style = new this.DataVizCore.ViewableStyle(viewableType, spriteColor, spriteIcon);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        const viewableData = new this.DataVizCore.ViewableData();
 | 
				
			||||||
 | 
					        viewableData.spriteSize = 30; // Sprites as points of size 24 x 24 pixels
 | 
				
			||||||
 | 
					        // console.log(this.curDevice, [this.curDevice])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        [this.curDevice].forEach((myData, index) => {
 | 
				
			||||||
 | 
					            // console.log(myData)
 | 
				
			||||||
 | 
					            const dbId = myData.forge_dbid;
 | 
				
			||||||
 | 
					            const myPosition = myData.position;
 | 
				
			||||||
 | 
					            const viewable = new this.DataVizCore.SpriteViewable(myPosition, style, dbId);
 | 
				
			||||||
 | 
					            myData._dbId = dbId;
 | 
				
			||||||
 | 
					            viewableData.addViewable(viewable);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        //this.heatMap = new ADHeatMaps({
 | 
					        // console.log(viewableData)
 | 
				
			||||||
        //  devices
 | 
					        await viewableData.finish();
 | 
				
			||||||
        //});
 | 
					        this.dataVizExtn.addViewables(viewableData);
 | 
				
			||||||
        //this.subSensorDevice();
 | 
					        // console.log("1",this.dataVizExtn)
 | 
				
			||||||
      }
 | 
					        viewer.addEventListener(this.DataVizCore.MOUSE_CLICK, onSpriteClicked.bind(this));// SPRITE_SELECTED
 | 
				
			||||||
    }, null, "POST").send();
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // 訂閱sensor設備
 | 
					        // ---------------- 熱點點擊事件 --------------------
 | 
				
			||||||
  subSensorDevice = function () {
 | 
					        function onSpriteClicked(event) {
 | 
				
			||||||
    let myBaja = new subscriptionDevices();
 | 
					            event.hasStopped = true;
 | 
				
			||||||
    let ordPath = this.ordPath;
 | 
					            const dbIdStart = 10;
 | 
				
			||||||
 | 
					            // debugger
 | 
				
			||||||
 | 
					            if (event != undefined && event != null) {
 | 
				
			||||||
 | 
					                if (event.dbId >= dbIdStart) {
 | 
				
			||||||
 | 
					                    changeColorForHotspot(event.dbId);
 | 
				
			||||||
 | 
					                    changeScaleForHotspot(event.dbId, false);
 | 
				
			||||||
 | 
					                    let myData = [this.curDevice].filter(x => x.forge_dbid == event.dbId)[0];
 | 
				
			||||||
 | 
					                    moveViewToDevice(myData.forge_dbid);//移動視角至該設備
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    myBaja.setSubscribeDevicesByBql(ordPath);
 | 
					                    $(selector).trigger("autodesk:click:sprite", { event, myData });
 | 
				
			||||||
    myBaja.setSubscribeDevicesCallBack((data) => {
 | 
					                } else {
 | 
				
			||||||
      this.bajaChaCallback ? this.bajaChaCallback(data) : "";
 | 
					                    $(selector).trigger("autodesk:clickOut:sprite", { event });
 | 
				
			||||||
      if (this.allSensorDevList.length == 0) {
 | 
					                }
 | 
				
			||||||
        return false;
 | 
					            }
 | 
				
			||||||
      }
 | 
					        }
 | 
				
			||||||
      data.device_number = data.device_number_full; // "TPE_B1_ME_M12_U1F_NA_TH_N1" (forge TPE_B1_ME_M12_R2F_NA_TH_N1)
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      let matchDevice = this.allSensorDevList.find(
 | 
					 | 
				
			||||||
        (x) =>
 | 
					 | 
				
			||||||
          x.device_number == data.device_number ||
 | 
					 | 
				
			||||||
          x.device_number == "TPE_B1_ME_M12_R2F_NA_TH_N1",
 | 
					 | 
				
			||||||
      );
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (!matchDevice) {
 | 
					    // 改變熱點位置
 | 
				
			||||||
        return;
 | 
					    changePos(dbId, positionZ) {
 | 
				
			||||||
      }
 | 
					        this.dataVizExtn.invalidateViewables(dbId, (viewable) => {
 | 
				
			||||||
      //將訂閱值塞入 subDeviceData
 | 
					            // console.log(viewable._position)
 | 
				
			||||||
      if (
 | 
					            const z = viewable._position.z + positionZ
 | 
				
			||||||
        this.subDeviceData.findIndex(d => d.device_number == matchDevice.device_number) == -1
 | 
					            const newPos = { ...viewable._position, z }
 | 
				
			||||||
      ) {
 | 
					            return {
 | 
				
			||||||
        let obj = {};
 | 
					                // Move the viewable to a new location.
 | 
				
			||||||
        obj.device_number = matchDevice.device_number;
 | 
					                position: newPos
 | 
				
			||||||
        obj.dbid = matchDevice.forge_dbid;
 | 
					            };
 | 
				
			||||||
        this.subDeviceData.push(obj);
 | 
					        });
 | 
				
			||||||
      }
 | 
					    }
 | 
				
			||||||
      let subData = this.subDeviceData.find(
 | 
					 | 
				
			||||||
        (x) => x.device_number == matchDevice.device_number || x.device_number == "TPE_B1_ME_M12_R2F_NA_TH_N1"
 | 
					 | 
				
			||||||
      );
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (subData) {
 | 
					    // 熱點 更換顏色---環境感知器
 | 
				
			||||||
        subData[data.point_name] = data.value;
 | 
					    changeColorForSensorHotspot(dbId, temp) {
 | 
				
			||||||
      }
 | 
					        const temps = [new THREE.Color(0x00009c), new THREE.Color(0xffff31), new THREE.Color(0xff8c00), new THREE.Color(0xff0000)]
 | 
				
			||||||
      //let norDevPoiName = matchDevice.device_normal_point_name;
 | 
					        let index = Math.floor(temp / 10) - 1 || 0;
 | 
				
			||||||
      //let cloDevPoiName = matchDevice.device_close_point_name || "";
 | 
					        if (index > 3) {
 | 
				
			||||||
      //let errDevPoiName = matchDevice.device_error_point_name;
 | 
					            index = 3
 | 
				
			||||||
      if (data.point_name == "Temp" || data.point_name == "TEMP") {
 | 
					        }
 | 
				
			||||||
        this.heatMap?.changeTemp(
 | 
					        const viewablesToUpdate = dbId;
 | 
				
			||||||
          matchDevice.device_number,
 | 
					        const color = temps[index]
 | 
				
			||||||
          !isNaN(parseInt(data.value)) ? parseInt(data.value) : 0,
 | 
					        // debugger
 | 
				
			||||||
        );
 | 
					        // this.registerHotPoint(color)
 | 
				
			||||||
        let devIdx = this.allSensorDevList.findIndex(
 | 
					        //   const _this=this
 | 
				
			||||||
          (x) =>
 | 
					        //   setInterval(() => {
 | 
				
			||||||
            x.device_number == data.device_number_full ||
 | 
					        //     _this.dataVizExtn.invalidateViewables(viewablesToUpdate, (viewable) => {
 | 
				
			||||||
            x.device_number == "TPE_B1_ME_M12_R2F_NA_TH_N1",
 | 
					        //         return { color: color };
 | 
				
			||||||
        );
 | 
					        //     });
 | 
				
			||||||
        this.allSensorDevList[devIdx]._temp = !isNaN(parseInt(data.value))
 | 
					        //     // sceneUpdated(true)
 | 
				
			||||||
          ? parseInt(data.value)
 | 
					        // }, 1000);
 | 
				
			||||||
          : 0;
 | 
					        this.dataVizExtn.invalidateViewables(viewablesToUpdate, (viewable) => {
 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //myBaja.setSubscribeDeviceEndCallBack((data) => {
 | 
					            return {
 | 
				
			||||||
    //  if (data.findIndex((x) => x.point_name == "Temp" || x.point_name == "TEMP") != -1) {
 | 
					                color: color,
 | 
				
			||||||
    //    // 顯示溫度條
 | 
					            };
 | 
				
			||||||
    //    console.log(showHeat)
 | 
					        });
 | 
				
			||||||
    //    showHeat("[name=forgeHeatBar]");
 | 
					        // debugger
 | 
				
			||||||
    //  }
 | 
					        // console.log("3", this.dataVizExtn)
 | 
				
			||||||
    //});
 | 
					    }
 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // 位置呈現
 | 
					    // 訂閱sensor設備
 | 
				
			||||||
  changeSensorPos = async function () {
 | 
					    subSensorDevice() {
 | 
				
			||||||
    this.dataVizExtn.removeAllViewables();
 | 
					        // console.log("sensor 訂閱")
 | 
				
			||||||
    const DataVizCore = Autodesk.DataVisualization.Core;
 | 
					        // require(["baja!"], (baja)=>{
 | 
				
			||||||
    const viewableType = DataVizCore.ViewableType.SPRITE;
 | 
					        //   const sub = new baja.subscriber();
 | 
				
			||||||
    const spriteColor = new THREE.Color(0x000000);
 | 
					        //   sub.attach("changed",function(){
 | 
				
			||||||
    let spriteIcon = "/file/img/forge/hotspot.svg";
 | 
					        //     console.log(this)
 | 
				
			||||||
    if (location.href.indexOf("localhost:5966") != -1) {
 | 
					        //   })
 | 
				
			||||||
      spriteIcon = "/img/forge/hotspot.svg";
 | 
					        //   baja.Ord.make("local:|foxs:|station:|slot:/TPE/B1/ME/M12/U1F/NA/TH/N1/TEMP").get({subscribe: sub})
 | 
				
			||||||
    } const style = new DataVizCore.ViewableStyle(viewableType, spriteColor, spriteIcon);
 | 
					        // })
 | 
				
			||||||
    const viewableData = new DataVizCore.ViewableData();
 | 
					 | 
				
			||||||
    viewableData.spriteSize = 30
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // test 1    
 | 
					        let myBaja = new subscriptionDevices();
 | 
				
			||||||
    //   const myDataList = [{ position: { x: 0, y: 0, z: this.floorHeight } }];
 | 
					        myBaja.setSubscribeDevicesByBql(this.ordPath);
 | 
				
			||||||
    //   myDataList.forEach((myData, index) => {
 | 
					 | 
				
			||||||
    //     const position = myData.position;
 | 
					 | 
				
			||||||
    //     const viewable = new DataVizCore.SpriteViewable(position, style, 12982);
 | 
					 | 
				
			||||||
    //     console.log(viewable)
 | 
					 | 
				
			||||||
    //     viewableData.addViewable(viewable);
 | 
					 | 
				
			||||||
    //   });
 | 
					 | 
				
			||||||
    //   await viewableData.finish();
 | 
					 | 
				
			||||||
    //   this.dataVizExtn.addViewables(viewableData);
 | 
					 | 
				
			||||||
    //   console.log(this.floorHeight,this.dataVizExtn)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // test 2
 | 
					        myBaja.setSubscribeDevicesCallBack((data) => {
 | 
				
			||||||
    const myDataList = [{ position: { x: 0, y: 0, z: 0 } }];
 | 
					            // console.log(data)
 | 
				
			||||||
    myDataList.forEach((myData, index) => {
 | 
					            this.bajaChaCallback ? this.bajaChaCallback(data) : "";
 | 
				
			||||||
      const position = myData.position;
 | 
					            if (this.curDevice == null) {
 | 
				
			||||||
      const viewable = new DataVizCore.SpriteViewable(position, style, 12982);
 | 
					                return false;
 | 
				
			||||||
      viewableData.addViewable(viewable);
 | 
					            }
 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
    await viewableData.finish();
 | 
					 | 
				
			||||||
    this.dataVizExtn.addViewables(viewableData);
 | 
					 | 
				
			||||||
    let spritesToUpdate = this.dataVizExtn.viewableData.viewables.map((v) => v.dbId);
 | 
					 | 
				
			||||||
    this.dataVizExtn.invalidateViewables(spritesToUpdate, (viewable) => {
 | 
					 | 
				
			||||||
      return {
 | 
					 | 
				
			||||||
        // Move the viewable to a new location.
 | 
					 | 
				
			||||||
        position: { x: 0, y: 0, z: 100 },
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      };
 | 
					            data.device_number = data.device_number_full; // "TPE_B1_ME_M12_U1F_NA_TH_N1" (forge TPE_B1_ME_M12_R2F_NA_TH_N1)
 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
    console.log(this.floorHeight, this.dataVizExtn)
 | 
					 | 
				
			||||||
    console.log("site")
 | 
					 | 
				
			||||||
    //let nodeIds = this.allSensorDevList
 | 
					 | 
				
			||||||
    //  .filter((x) => !isNaN(parseInt(x.forge_dbid)))
 | 
					 | 
				
			||||||
    //  .map((x) => {
 | 
					 | 
				
			||||||
    //    return { devNum: x.device_number, nodeId: parseInt(x.forge_dbid) };
 | 
					 | 
				
			||||||
    //  });
 | 
					 | 
				
			||||||
    //console.log("sensor", nodeIds)
 | 
					 | 
				
			||||||
    //$.each(nodeIds, (idx, node) => {
 | 
					 | 
				
			||||||
    //  let options = {
 | 
					 | 
				
			||||||
    //    element: $(this.selector),
 | 
					 | 
				
			||||||
    //    viewer: this.viewer,
 | 
					 | 
				
			||||||
    //    nodeId: node,
 | 
					 | 
				
			||||||
    //    floorHeight: this.floorHeight ?? [],
 | 
					 | 
				
			||||||
    //    inited: function () {
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //    }
 | 
					            //將訂閱值塞入 subDeviceData
 | 
				
			||||||
    //  }
 | 
					            if (
 | 
				
			||||||
    //  let elevator3DObj = new elevator3D(options);
 | 
					                this.subDeviceData.findIndex(d => d.device_number == this.curDevice.id) == -1
 | 
				
			||||||
    //  elevator3DObj.init(() => {
 | 
					            ) {
 | 
				
			||||||
 | 
					                let obj = {};
 | 
				
			||||||
 | 
					                obj.device_number = this.curDevice.id;
 | 
				
			||||||
 | 
					                obj.dbid = this.curDevice.roomDbId;
 | 
				
			||||||
 | 
					                this.subDeviceData.push(obj);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            let subData = this.subDeviceData.find(
 | 
				
			||||||
 | 
					                (x) => x.device_number == this.curDevice.id || x.device_number == "TPE_B1_ME_M12_R2F_NA_TH_N1"
 | 
				
			||||||
 | 
					            );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //    const frags = this.viewer.model.getFragmentList();
 | 
					            if (subData) {
 | 
				
			||||||
    //    let scale = new THREE.Vector3();
 | 
					                subData[data.point_name] = data.value;
 | 
				
			||||||
    //    let rotation = new THREE.Quaternion();
 | 
					            }
 | 
				
			||||||
    //    let translation = new THREE.Vector3();
 | 
					            //let norDevPoiName = matchDevice.device_normal_point_name;
 | 
				
			||||||
    //    frags.getAnimTransform(node.nodeId, scale, rotation, translation);
 | 
					            //let cloDevPoiName = matchDevice.device_close_point_name || "";
 | 
				
			||||||
    //    console.log(frags.getAnimTransform(node.nodeId, scale, rotation, translation))
 | 
					            //let errDevPoiName = matchDevice.device_error_point_name;
 | 
				
			||||||
    //    translation.z = this.floorHeight;
 | 
					 | 
				
			||||||
    //    frags.updateAnimTransform(node.nodeId, scale, rotation, translation);
 | 
					 | 
				
			||||||
    //    console.log(frags, frags.getAnimTransform(node.nodeId, scale, rotation, translation))
 | 
					 | 
				
			||||||
    //    // let frags = elevator3DObj.fragProxys.filter(x => x.nodeId == node);
 | 
					 | 
				
			||||||
    //    // console.log("sensor",elevator3DObj, frags)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //    // let fragProxy = this.viewer.impl.getFragmentProxy(this.viewer.model, node.nodeId)
 | 
					            if (data.point_name == "Temp" || data.point_name == "TEMP") {
 | 
				
			||||||
    //    // fragProxy.position = new THREE.Vector3(0, 0, 0)
 | 
					                this.tempVal = !isNaN(parseInt(data.value)) ? parseInt(data.value) : 0;
 | 
				
			||||||
    //    // console.log(node,fragProxy)
 | 
					                // this.heatMap?.changeTemp(
 | 
				
			||||||
    //    // fragProxy.position.z = this.floorHeight
 | 
					                //   this.curDevice.id,
 | 
				
			||||||
    //    // fragProxy.updateAnimTransform()
 | 
					                //   !isNaN(parseInt(data.value)) ? parseInt(data.value) : 0,
 | 
				
			||||||
 | 
					                // );
 | 
				
			||||||
 | 
					                this.curDevice.temp = this.tempVal;
 | 
				
			||||||
 | 
					                // console.log(data.value, parseInt(data.value))
 | 
				
			||||||
 | 
					                this.changeColorForSensorHotspot(this.curDevice.forge_dbid, parseInt(data.value))
 | 
				
			||||||
 | 
					                // changeColorForSensorHotspot(this.curDevice.forge_dbid, parseInt(data.value))
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //    //   frags.forEach((fragProxy) => {
 | 
					        myBaja.setSubscribeDeviceEndCallBack((data) => {
 | 
				
			||||||
    //    //     console.log("sensor", this)
 | 
					            if (data.findIndex((x) => x.point_name == "Temp" || x.point_name == "TEMP") != -1) {
 | 
				
			||||||
    //    //     console.log("elev2")
 | 
					                // 顯示溫度條
 | 
				
			||||||
    //    //     fragProxy.frag.position.z = this.floorHeight
 | 
					                showHeat("[name=forgeHeatBar]");
 | 
				
			||||||
    //    //     console.log("sensor", fragProxy, fragProxy.frag)
 | 
					            }
 | 
				
			||||||
    //    //     fragProxy.frag.updateAnimTransform()
 | 
					        });
 | 
				
			||||||
    //    //   })
 | 
					        // window.x = 28
 | 
				
			||||||
 | 
					        // setInterval(()=>{
 | 
				
			||||||
 | 
					        //   this.changeColorForSensorHotspot(this.curDevice.forge_dbid, x++)
 | 
				
			||||||
 | 
					        // }, 2000)
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //    this.viewer.impl.sceneUpdated(true)
 | 
					 | 
				
			||||||
    //  })
 | 
					 | 
				
			||||||
    //})
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user