Merge branch 'master' of https://gitea.mjm-staging.developers-homelab.net/BIMS/BIMS
This commit is contained in:
		
						commit
						cab706c76a
					
				@ -23,8 +23,10 @@
 | 
			
		||||
                </button>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="modal-body">
 | 
			
		||||
                <table id="lightSchTable" class="table table-bordered table-striped text-center m-0 w-100">
 | 
			
		||||
                </table>
 | 
			
		||||
                <!--<table id="lightSchTable" class="table table-bordered table-striped text-center m-0 w-100">
 | 
			
		||||
    </table>-->
 | 
			
		||||
                <div id="lightSchBlock" style="height:60vh"></div>
 | 
			
		||||
                
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="modal-footer">
 | 
			
		||||
                <button type="button" class="btn btn-secondary" data-dismiss="modal">關閉</button>
 | 
			
		||||
@ -39,6 +41,8 @@
 | 
			
		||||
    var subDeviceData = [];
 | 
			
		||||
    var heatMap = null;
 | 
			
		||||
    var buildMenuData = {};
 | 
			
		||||
    var forgeInvType = null;
 | 
			
		||||
    var forgeInvTypeDef = null;
 | 
			
		||||
 | 
			
		||||
    $(function () {
 | 
			
		||||
        getBuildMenu((arr, data) => {
 | 
			
		||||
@ -50,6 +54,7 @@
 | 
			
		||||
            if (arr.indexOf(3) != -1) {
 | 
			
		||||
                getHotspotPoint(() => {
 | 
			
		||||
                    show3DModel(data.urn_3D);
 | 
			
		||||
                    getInviForge();
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
@ -221,6 +226,13 @@
 | 
			
		||||
        return strHtml;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    function setLightSchBlcok(obj) {
 | 
			
		||||
        let devNum = $(obj).parents(".device-wrap").data("number");
 | 
			
		||||
        let devPath = devNum.replaceAll("_", "/");
 | 
			
		||||
        let iframe = `<iframe src="/ord?station:%7Cslot:/${devPath}/Sch|view:?fullScreen=true" style="min-height:100px;width:100%;height:100%"></iframe>`
 | 
			
		||||
        $("#lightSchBlock").html(iframe);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // forge 3D 異常點位變紅色
 | 
			
		||||
    function setForgeHotSpotColor(device) {
 | 
			
		||||
        let subData = subDeviceData.filter(x => x.device_number == device.device_number)[0]
 | 
			
		||||
@ -365,9 +377,14 @@
 | 
			
		||||
        $(loadEle).Loading("start");
 | 
			
		||||
        launchViewerForHotspot(urn, (viewer, nodeIds) => {
 | 
			
		||||
            let devDbIds = allDevList.map(x => x.forge_dbid);
 | 
			
		||||
            /*hideAllObjects(devDbIds);*/
 | 
			
		||||
            
 | 
			
		||||
            setTransparentBuilding(0, devDbIds);
 | 
			
		||||
 | 
			
		||||
            // 從資料庫設定不可視模型的類型,若沒有取道該小類不可視類型,則套用資料庫設定預設類型
 | 
			
		||||
            if (forgeInvType) {
 | 
			
		||||
                setInviForge(forgeInvType, devDbIds);
 | 
			
		||||
            } else {
 | 
			
		||||
                setInviForge(forgeInvTypeDef, devDbIds);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $(loadEle).Loading("close");
 | 
			
		||||
 | 
			
		||||
            let devices = allDevList.map(x => {
 | 
			
		||||
@ -406,7 +423,6 @@
 | 
			
		||||
            }
 | 
			
		||||
            forge3DElev.init();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            if (subDeviceData.length != 0) {
 | 
			
		||||
                let stSubArr = subDeviceData.map(x => Object.keys(x).filter(y => y == "ST").map(y => x));
 | 
			
		||||
 | 
			
		||||
@ -487,6 +503,32 @@
 | 
			
		||||
        getLightData(myDataList);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // 取得 不可視 3D 模型類型
 | 
			
		||||
    function getInviForge() {
 | 
			
		||||
        let url = baseApiUrl + "/api/Device/GetForgeInvType";
 | 
			
		||||
       
 | 
			
		||||
        ytAjax = new YourTeam.Ajax(url, null, function (res) {
 | 
			
		||||
            if (!res || res.code != "0000" || !res.data) {
 | 
			
		||||
 | 
			
		||||
            } else {
 | 
			
		||||
                let datas = res.data;
 | 
			
		||||
                
 | 
			
		||||
                forgeInvType = datas.filter(x => x.sub_system_tag == pageAct.sysSubTag)[0]?.invisible_value;
 | 
			
		||||
                forgeInvTypeDef = datas.filter(x => x.invisible_type == "default_value")[0]?.invisible_value;
 | 
			
		||||
            }
 | 
			
		||||
        }, null, "POST").send();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // 設置 模型隱藏或透明 
 | 
			
		||||
    function setInviForge(type, devDbIds) {
 | 
			
		||||
        console.log("devDbIds",devDbIds)
 | 
			
		||||
        if (type == "Hide") {
 | 
			
		||||
            hideAllObjects(devDbIds);
 | 
			
		||||
        } else if (type == "Opacity") {
 | 
			
		||||
            setTransparentBuilding(0, devDbIds);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    var parentEle = "";
 | 
			
		||||
    onEvent("autodesk:click:sprite", "[name=forgeViewer]", function (e, obj) {
 | 
			
		||||
        forgeUnFocusAll();
 | 
			
		||||
 | 
			
		||||
@ -194,11 +194,25 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
 | 
			
		||||
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="ml-auto d-flex mr-3">
 | 
			
		||||
 | 
			
		||||
                        <div class="dropdown">
 | 
			
		||||
                            <a href="javascript:;" id="toggleNoticeBtn" class="d-flex align-items-center justify-content-center ml-2">
 | 
			
		||||
                                <!--<img src="img/demo/avatars/avatar-admin.png" class="profile-image rounded-circle"
 | 
			
		||||
            alt="Dr. Codex Lantern">-->
 | 
			
		||||
                                <!--you can also add username next to the avatar with the codes below:-->
 | 
			
		||||
                                <div class="row m-0 justify-content-center userblock">
 | 
			
		||||
                                    <i id="noticeConIcon" class=" fs-1-5 w-100 text-center"></i>
 | 
			
		||||
                                    <span id="noticeConText" class="text-truncate text-truncate-header hidden-xs-down" data-hide="隱藏警告" data-show="顯示警告"></span>
 | 
			
		||||
                                </div>
 | 
			
		||||
 | 
			
		||||
                            </a>
 | 
			
		||||
                            
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <!--app user menu-->
 | 
			
		||||
                        <div class="dropdown">
 | 
			
		||||
                            <a href="#" data-toggle="dropdown" data-target="logoutList" class="d-flex align-items-center justify-content-center ml-2">
 | 
			
		||||
                                <!--<img src="img/demo/avatars/avatar-admin.png" class="profile-image rounded-circle"
 | 
			
		||||
                                alt="Dr. Codex Lantern">-->
 | 
			
		||||
            alt="Dr. Codex Lantern">-->
 | 
			
		||||
                                <!--you can also add username next to the avatar with the codes below:-->
 | 
			
		||||
                                <div class="row m-0 justify-content-center userblock">
 | 
			
		||||
                                    <i class="fas fa-user-circle fs-1-5 w-100 text-center"></i>
 | 
			
		||||
@ -213,6 +227,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
 | 
			
		||||
                                </a>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="ml-2 text-center">
 | 
			
		||||
                        <label class="mb-0 fs-1-2">Diamond Controls<span class="fs-09 position-absolute">®</span></label><br>
 | 
			
		||||
@ -845,6 +860,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
 | 
			
		||||
                getBuiList();
 | 
			
		||||
                getSysMonBtnList();
 | 
			
		||||
                checkDevState();
 | 
			
		||||
                loadNoticeConSta();
 | 
			
		||||
 | 
			
		||||
                if (lastPage) {
 | 
			
		||||
                    let lastPageAct = {};
 | 
			
		||||
@ -970,7 +986,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
 | 
			
		||||
 | 
			
		||||
                onEvent("yt:tab:change", "#lightSch-tab", function () {
 | 
			
		||||
                    if (pageAct.sysMainTag == "LT" && $("#lightSchModal").length != 0) {
 | 
			
		||||
                        loadLightSchTable();
 | 
			
		||||
                        setLightSchBlcok ? setLightSchBlcok(this) : "";
 | 
			
		||||
                        $("#lightSchModal").modal("show");
 | 
			
		||||
                    }
 | 
			
		||||
                })
 | 
			
		||||
@ -996,6 +1012,22 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
 | 
			
		||||
                onEvent("click", "button[id^=noticeChkBtn]", function () {
 | 
			
		||||
                    $(this).parents(".toast").YTNotice("hide");
 | 
			
		||||
                })
 | 
			
		||||
                
 | 
			
		||||
                onEvent("click", "button[id^=bajaAckBtn]", function () {
 | 
			
		||||
                    let uuid = $(this).data("uuid");
 | 
			
		||||
                    let url = window.location.origin + "/obix/alarm/" + uuid + "/ack";
 | 
			
		||||
                    let myBaja = new MyBaja();
 | 
			
		||||
                    myBaja.setMyUserAccount((data) => {
 | 
			
		||||
                        let sendData = '<obj is="obix:AckAlarmIn"><str name="' + data + '" val="obix" /></obj>';
 | 
			
		||||
                        $.post(url, sendData, (rel) => {
 | 
			
		||||
                            $(this).parents(".toast").YTNotice("hide");
 | 
			
		||||
                        }, "text")
 | 
			
		||||
                    })
 | 
			
		||||
                })
 | 
			
		||||
 | 
			
		||||
                onEvent("click", "#toggleNoticeBtn", function () {
 | 
			
		||||
                    chaNoticeConSta();
 | 
			
		||||
                })
 | 
			
		||||
 | 
			
		||||
                $(window).on("timeout:3s", function () {
 | 
			
		||||
 | 
			
		||||
@ -1115,7 +1147,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
 | 
			
		||||
                    let devName = $(ele).data("name"); //full_name
 | 
			
		||||
                    let lightHtml = type == "light" ? `<button type="button" id="lightSch-tab" class="btn btn-icon nav-link" role="tab" data-tabname="cardTab" data-target="#lightSch"><i class="fas fa-calendar-alt"></i></button>` : "";
 | 
			
		||||
                    let option = {
 | 
			
		||||
                        html: `<div class="card m-1 border device-wrap">
 | 
			
		||||
                        html: `<div class="card m-1 border device-wrap" data-number="${devNum}">
 | 
			
		||||
                                                <div class="card-header p-3">
 | 
			
		||||
 | 
			
		||||
                                                    <div class="position-absolute w-50" style="word-break: break-all;">
 | 
			
		||||
@ -1644,7 +1676,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
 | 
			
		||||
                                                    <span class="m-0">異常訊息:<span>${data.errMsg}</span></span>
 | 
			
		||||
                                                </div>
 | 
			
		||||
                                                <div class="d-flex m-0 gap-5 mt-2">
 | 
			
		||||
                                                        <button class="btn btn-sm btn-primary col-8 text-nowrap">已至現場確認問題</button>
 | 
			
		||||
                                                        <button id="bajaAckBtn${data.id}" data-uuid="${data.uuid}" class="btn btn-sm btn-primary col-8 text-nowrap">已至現場確認問題</button>
 | 
			
		||||
                                                        <button id="noticeChkBtn${data.id}" class="btn btn-sm btn-secondary col-4">確認</button>
 | 
			
		||||
                                                </div>
 | 
			
		||||
                                            </div>`
 | 
			
		||||
@ -1662,11 +1694,55 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
 | 
			
		||||
                    })
 | 
			
		||||
                    if (notices.length != 0) { 
 | 
			
		||||
                        $("#noticeBlock").YTNotice("add_many", notices.oSort("id").reverse());
 | 
			
		||||
                        
 | 
			
		||||
                    }
 | 
			
		||||
                    console.log("res", res)
 | 
			
		||||
 | 
			
		||||
                }
 | 
			
		||||
            }, null, "POST",true).send();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        function loadNoticeConSta() {
 | 
			
		||||
            let noticeStatus = localStorage.getItem("noticeStatus");
 | 
			
		||||
            chaNoticeConSta(noticeStatus ?? "show");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        function chaNoticeConSta(type = null) {
 | 
			
		||||
            let showText = $("#toggleNoticeBtn #noticeConText").data("show");
 | 
			
		||||
            let hideText = $("#toggleNoticeBtn #noticeConText").data("hide");
 | 
			
		||||
            let iconArr = ["fal fa-comment-slash", "fal fa-comment-dots"];
 | 
			
		||||
            $("#noticeConIcon").removeClass(iconArr[0]).removeClass(iconArr[1]);
 | 
			
		||||
            if (type != null) {
 | 
			
		||||
                if (type == "hide") {
 | 
			
		||||
                    setHide();
 | 
			
		||||
                } else if (type == "show") {
 | 
			
		||||
                    setShow();
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
                if ($("#noticeBlock").is(":visible")) {
 | 
			
		||||
                    setHide();
 | 
			
		||||
                } else if (!$("#noticeBlock").is(":visible")) {
 | 
			
		||||
                    setShow();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            function setShow() {
 | 
			
		||||
                $("#toggleNoticeBtn").find("#noticeConText").text(hideText);
 | 
			
		||||
                $("#noticeConIcon").addClass(iconArr[0]);
 | 
			
		||||
                $("#noticeBlock").show();
 | 
			
		||||
                $("#noticeBlock").animate({ opacity: 1 }, 200)
 | 
			
		||||
                localStorage.setItem("noticeStatus", "show");
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            function setHide() {
 | 
			
		||||
                $("#toggleNoticeBtn").find("#noticeConText").text(showText);
 | 
			
		||||
                $("#noticeConIcon").addClass(iconArr[1]);
 | 
			
		||||
                $("#noticeBlock").animate({ opacity: 0 }, 200, function () {
 | 
			
		||||
                    $("#noticeBlock").hide();
 | 
			
		||||
                })
 | 
			
		||||
                localStorage.setItem("noticeStatus", "hide");
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
        }
 | 
			
		||||
    </script>
 | 
			
		||||
 | 
			
		||||
</body>
 | 
			
		||||
 | 
			
		||||
@ -227,6 +227,11 @@ class elevator3D {
 | 
			
		||||
        // 通知檢視器更新場景
 | 
			
		||||
        this.viewer.impl.sceneUpdated(true);
 | 
			
		||||
 | 
			
		||||
        if (!$(this.ele)[0]) {
 | 
			
		||||
            callback ? callback() : "";
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (typeof $(this.ele)[0]._elevator3D == "undefined") {
 | 
			
		||||
            $(this.ele)[0]._elevator3D = [];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -296,7 +296,6 @@ function MyBaja() {
 | 
			
		||||
    // 取得使用者帳號
 | 
			
		||||
    this.setMyUserAccount = function (callBackFunc = null) {
 | 
			
		||||
        require(['baja!'], function (baja) {
 | 
			
		||||
            console.log("baja", baja)
 | 
			
		||||
            user_name = baja.getUserName();
 | 
			
		||||
            callBackFunc ? callBackFunc(user_name) : "";
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
@ -365,7 +365,7 @@ function displayDate(dateTime, dateType = "YMdHms", locale = 'zh-TW') {
 | 
			
		||||
        date = [year, String(month).padStart(2, '0'), String(day).padStart(2, '0')].filter(n => n).join("/");
 | 
			
		||||
      
 | 
			
		||||
        time = [String(hour).padStart(2, '0'), String(minute).padStart(2, '0')].join(":");
 | 
			
		||||
        
 | 
			
		||||
       
 | 
			
		||||
        if (dateType != "date" && dateType != "time" && dateType != "datetime") {
 | 
			
		||||
            let showArr = [];
 | 
			
		||||
            if (year) showArr.push(year);
 | 
			
		||||
@ -375,9 +375,10 @@ function displayDate(dateTime, dateType = "YMdHms", locale = 'zh-TW') {
 | 
			
		||||
                result += showArr.join("/");
 | 
			
		||||
                showArr = [];
 | 
			
		||||
            }
 | 
			
		||||
            if (hour) showArr.push(hour.toString().padStart(2, '0'));
 | 
			
		||||
            if (minute) showArr.push(minute.toString().padStart(2, '0'));
 | 
			
		||||
            if (second) showArr.push(second.toString().padStart(2, '0'));
 | 
			
		||||
            
 | 
			
		||||
            if (hour !== "") showArr.push(hour.toString().padStart(2, '0'));
 | 
			
		||||
            if (minute !== "") showArr.push(minute.toString().padStart(2, '0'));
 | 
			
		||||
            if (second !== "") showArr.push(second.toString().padStart(2, '0'));
 | 
			
		||||
            if (millisecond) showArr.push(millisecond.toString().padStart(3, '0'));
 | 
			
		||||
            if (showArr.length != 0) {
 | 
			
		||||
                result += " " + showArr.join(":");
 | 
			
		||||
 | 
			
		||||
@ -180,7 +180,7 @@ class YTNoticeBlock {
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                this.showNotices();
 | 
			
		||||
            }, 500)
 | 
			
		||||
            }, 100)
 | 
			
		||||
 | 
			
		||||
            
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -898,6 +898,52 @@ namespace FrontendWebApi.ApiControllers
 | 
			
		||||
                var param = new { @main_system_tag = fdi.main_system_tag, @sub_system_tag = fdi.sub_system_tag, @points = fdi.points };
 | 
			
		||||
                var fr = await backendRepository.GetAllAsync<DeviceItemViewModel>(sqlString, param);
 | 
			
		||||
 | 
			
		||||
                apiResult.Code = "0000";
 | 
			
		||||
                apiResult.Data = fr;
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception exception)
 | 
			
		||||
            {
 | 
			
		||||
                apiResult.Code = "9999";
 | 
			
		||||
                apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
 | 
			
		||||
                Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
 | 
			
		||||
                return Ok(apiResult);
 | 
			
		||||
            }
 | 
			
		||||
            return Ok(apiResult);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 取得 Forge 3D 模型不可見的類型
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        [HttpPost]
 | 
			
		||||
        [Route("api/Device/GetForgeInvType")]
 | 
			
		||||
        public async Task<ActionResult<ApiResult<List<DeviceItemViewModel>>>> GetForgeInvType([FromBody] string search_tag)
 | 
			
		||||
        {
 | 
			
		||||
            ApiResult<List<ForgeInvisible>> apiResult = new ApiResult<List<ForgeInvisible>>();
 | 
			
		||||
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                var sqlString = $@"SELECT 
 | 
			
		||||
                                    v1.system_key AS 'invisible_type',
 | 
			
		||||
                                    v1.system_value AS 'invisible_value',
 | 
			
		||||
                                    v2.system_value AS 'sub_system_tag' 
 | 
			
		||||
                                FROM variable v1
 | 
			
		||||
                                LEFT JOIN variable v2 ON v2.id = v1.system_parent_id AND v2.deleted = '0'
 | 
			
		||||
                                WHERE
 | 
			
		||||
                                    v1.deleted = '0' 
 | 
			
		||||
                                    AND v1.system_type = 'forge_3d_invisible_type'
 | 
			
		||||
                                    AND (
 | 
			
		||||
                                    (@isDef = true AND v1.system_key = 'default_value')
 | 
			
		||||
                                    OR (@isDef = false AND v2.system_value = @sub_system_tag)
 | 
			
		||||
                                    OR (@isDef = false AND @sub_system_tag IS NULL AND v1.system_key = 'default_value')
 | 
			
		||||
                                    OR (@isDef = false AND @sub_system_tag IS NULL AND v2.system_value = v2.system_value)
 | 
			
		||||
                                    )";
 | 
			
		||||
 | 
			
		||||
                var param = new { sub_system_tag = search_tag == "forge_default" ? null : search_tag, isDef = search_tag == "forge_default" };
 | 
			
		||||
 | 
			
		||||
                var fr = await backendRepository.GetAllAsync<ForgeInvisible>(sqlString, param);
 | 
			
		||||
         
 | 
			
		||||
 | 
			
		||||
                apiResult.Code = "0000";
 | 
			
		||||
                apiResult.Data = fr;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -164,4 +164,14 @@ namespace FrontendWebApi.Models
 | 
			
		||||
        public string points { get; set; }
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public class ForgeInvisible
 | 
			
		||||
    {
 | 
			
		||||
        public string invisible_type { get; set; }
 | 
			
		||||
        public string invisible_value { get; set; }
 | 
			
		||||
        public string sub_system_tag { get; set; }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user