Merge branch 'master' of https://gitea.mjm-staging.developers-homelab.net/BIMS/BIMS
This commit is contained in:
		
						commit
						2b20e6641c
					
				@ -191,59 +191,19 @@
 | 
				
			|||||||
    <div class="modal-dialog modal-dialog-centered" role="document">
 | 
					    <div class="modal-dialog modal-dialog-centered" role="document">
 | 
				
			||||||
        <div class="modal-content">
 | 
					        <div class="modal-content">
 | 
				
			||||||
            <div class="modal-header">
 | 
					            <div class="modal-header">
 | 
				
			||||||
                <h4 class="modal-title">
 | 
					                <h4 id="devSysTabTitle" class="modal-title">
 | 
				
			||||||
                    王小明
 | 
					 | 
				
			||||||
                </h4>
 | 
					                </h4>
 | 
				
			||||||
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
 | 
					                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
 | 
				
			||||||
                    <span aria-hidden="true"><i class="fal fa-times"></i></span>
 | 
					                    <span aria-hidden="true"><i class="fal fa-times"></i></span>
 | 
				
			||||||
                </button>
 | 
					                </button>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
            <div class="modal-body">
 | 
					            <div class="modal-body">
 | 
				
			||||||
                <table class="table table-bordered table-striped text-center m-0 w-100">
 | 
					                <table id="devSysTable" class="table table-bordered table-striped text-center m-0 w-100">
 | 
				
			||||||
                    <thead class="thead-themed">
 | 
					 | 
				
			||||||
                        <tr>
 | 
					 | 
				
			||||||
                            <th>類別代號</th>
 | 
					 | 
				
			||||||
                            <th>類別名稱</th>
 | 
					 | 
				
			||||||
                            <th>存取權限</th>
 | 
					 | 
				
			||||||
                        </tr>
 | 
					 | 
				
			||||||
                    </thead>
 | 
					 | 
				
			||||||
                    <tbody>
 | 
					 | 
				
			||||||
                        <tr>
 | 
					 | 
				
			||||||
                            <td>0220100010</td>
 | 
					 | 
				
			||||||
                            <td>電錶</td>
 | 
					 | 
				
			||||||
                            <td>
 | 
					 | 
				
			||||||
                                <div class="custom-control custom-checkbox">
 | 
					 | 
				
			||||||
                                    <input type="checkbox" class="custom-control-input" id="defaultUnchecked">
 | 
					 | 
				
			||||||
                                    <label class="custom-control-label" for="defaultUnchecked">啟用</label>
 | 
					 | 
				
			||||||
                                </div>
 | 
					 | 
				
			||||||
                            </td>
 | 
					 | 
				
			||||||
                        </tr>
 | 
					 | 
				
			||||||
                        <tr>
 | 
					 | 
				
			||||||
                            <td>0220100010</td>
 | 
					 | 
				
			||||||
                            <td>照明設備</td>
 | 
					 | 
				
			||||||
                            <td>
 | 
					 | 
				
			||||||
                                <div class="custom-control custom-checkbox">
 | 
					 | 
				
			||||||
                                    <input type="checkbox" class="custom-control-input" id="defaultUnchecked">
 | 
					 | 
				
			||||||
                                    <label class="custom-control-label" for="defaultUnchecked">啟用</label>
 | 
					 | 
				
			||||||
                                </div>
 | 
					 | 
				
			||||||
                            </td>
 | 
					 | 
				
			||||||
                        </tr>
 | 
					 | 
				
			||||||
                        <tr>
 | 
					 | 
				
			||||||
                            <td>0220100010</td>
 | 
					 | 
				
			||||||
                            <td>環境感測</td>
 | 
					 | 
				
			||||||
                            <td>
 | 
					 | 
				
			||||||
                                <div class="custom-control custom-checkbox">
 | 
					 | 
				
			||||||
                                    <input type="checkbox" class="custom-control-input" id="defaultUnchecked">
 | 
					 | 
				
			||||||
                                    <label class="custom-control-label" for="defaultUnchecked">啟用</label>
 | 
					 | 
				
			||||||
                                </div>
 | 
					 | 
				
			||||||
                            </td>
 | 
					 | 
				
			||||||
                        </tr>
 | 
					 | 
				
			||||||
                    </tbody>
 | 
					 | 
				
			||||||
                </table>
 | 
					                </table>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
            <div class="modal-footer">
 | 
					            <div class="modal-footer">
 | 
				
			||||||
                <button type="button" class="btn btn-secondary" data-dismiss="modal">關閉</button>
 | 
					                <button type="button" class="btn btn-secondary" data-dismiss="modal">關閉</button>
 | 
				
			||||||
                <button id="accManSysRolSavBtn" type="button" class="btn btn-primary">儲存</button>
 | 
					                <button id="accManSysRolSavBtn" type="button" class="btn btn-primary" data-id="">儲存</button>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
@ -368,7 +328,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                    let btnDiv = creDiv(["row", "m-0", "justify-content-center"], { "style": "gap:10px" });
 | 
					                    let btnDiv = creDiv(["row", "m-0", "justify-content-center"], { "style": "gap:10px" });
 | 
				
			||||||
                    btnDiv.append(creBtnHtml("修改", "accManEdiBtn" + data, null, ["btn", "btn-info"], { "toggle": "modal", "target": "#accManModal" }));
 | 
					                    btnDiv.append(creBtnHtml("修改", "accManEdiBtn" + data, null, ["btn", "btn-info"], { "toggle": "modal", "target": "#accManModal" }));
 | 
				
			||||||
					btnDiv.append(creBtnHtml("設備權限", "accManSysRolEdiBtn" + data, null, ["btn", "btn-info"], { "toggle": "modal", "target": "#accManSysModal" }));
 | 
					                    btnDiv.append(creBtnHtml("設備權限", "accManSysRolEdiBtn" + data, null, ["btn", "btn-info"], { "toggle": "modal", "target": "#accManSysModal", "fullname": row.full_name }));
 | 
				
			||||||
                    btnDiv.append(creBtnHtml("刪除", "accManDelBtn" + data, null, ["btn", "btn-danger"], { "toggle": "modal", "target": "#delModal" }));
 | 
					                    btnDiv.append(creBtnHtml("刪除", "accManDelBtn" + data, null, ["btn", "btn-danger"], { "toggle": "modal", "target": "#delModal" }));
 | 
				
			||||||
                    return btnDiv.outerHtml();
 | 
					                    return btnDiv.outerHtml();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
@ -432,7 +392,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    function loadRolAuthTable() {
 | 
					    function loadRolAuthTable() {
 | 
				
			||||||
        pageAct.authCode = [];
 | 
					        pageAct.authCode = [];
 | 
				
			||||||
		
 | 
					
 | 
				
			||||||
        let ajaxObj = {
 | 
					        let ajaxObj = {
 | 
				
			||||||
            url: baseApiUrl + "/User/RoleAuthList",
 | 
					            url: baseApiUrl + "/User/RoleAuthList",
 | 
				
			||||||
            method: "POST",
 | 
					            method: "POST",
 | 
				
			||||||
@ -495,6 +455,18 @@
 | 
				
			|||||||
        ];
 | 
					        ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        rolAuthTable = new YourTeam.JqDataTables.getTableByAjax(ajaxObj, tag, null, columns, column_defs);
 | 
					        rolAuthTable = new YourTeam.JqDataTables.getTableByAjax(ajaxObj, tag, null, columns, column_defs);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let url = baseApiUrl + "/User/RoleAuthList";
 | 
				
			||||||
 | 
					        objSendData.Data = { SelectedRoleId: pageAct.selRolAuth }
 | 
				
			||||||
 | 
					        ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
 | 
				
			||||||
 | 
					            if (!res || res.code != "0000" || !res.data) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                $.each(res.data, function (i, v) {
 | 
				
			||||||
 | 
					                    pageAct.authCode.push(v.authCode);
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }, null, "POST").send();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function loadAuthPageTable() {
 | 
					    function loadAuthPageTable() {
 | 
				
			||||||
@ -527,14 +499,47 @@
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                "title": "功能名稱",
 | 
					                "title": "存取權限",
 | 
				
			||||||
                "data": "subName",
 | 
					                "data": "subName"
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        ];
 | 
					        ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        accAuthPageTable = new YourTeam.JqDataTables.getTableByAjax(ajaxObj, tag, null, columns, column_defs);
 | 
					        accAuthPageTable = new YourTeam.JqDataTables.getTableByAjax(ajaxObj, tag, null, columns, column_defs);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    function loadDevSysTable(data) {
 | 
				
			||||||
 | 
					        let tag = "#devSysTable";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let column_defs = [
 | 
				
			||||||
 | 
					            { "targets": [0], "width": "33%", "sortable": true },
 | 
				
			||||||
 | 
					            { "targets": [1], "width": "33%", "sortable": true },
 | 
				
			||||||
 | 
					            { "targets": [2], "width": "33%", "sortable": true },
 | 
				
			||||||
 | 
					        ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let columns = [
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                "title": "類別代號",
 | 
				
			||||||
 | 
					                "data": 'sub_system_tag',
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                "title": "類別名稱",
 | 
				
			||||||
 | 
					                "data": "full_name",
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                "title": "功能名稱",
 | 
				
			||||||
 | 
					                "data": null,
 | 
				
			||||||
 | 
					                "render": function (data, type, row, meta) {
 | 
				
			||||||
 | 
					                    return `<div class="custom-control custom-checkbox">
 | 
				
			||||||
 | 
					                                <input type="checkbox" class="custom-control-input" id="${row.auth_code}" data-type="usrDevSys">
 | 
				
			||||||
 | 
					                                <label class="custom-control-label" for="${row.auth_code}">啟用</label>
 | 
				
			||||||
 | 
					                            </div>`;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        devSysTable = new YourTeam.JqDataTables.getTableByStatic(tag, data, columns, column_defs, null, null, null, null, "tpi");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function getRoleSel() {
 | 
					    function getRoleSel() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        let url = baseApiUrl + "/User/RoleManagerList";
 | 
					        let url = baseApiUrl + "/User/RoleManagerList";
 | 
				
			||||||
@ -562,7 +567,10 @@
 | 
				
			|||||||
    function events() {
 | 
					    function events() {
 | 
				
			||||||
        onEvent("change", "#roleSel", function () {
 | 
					        onEvent("change", "#roleSel", function () {
 | 
				
			||||||
            let roleGuid = $(this).val();
 | 
					            let roleGuid = $(this).val();
 | 
				
			||||||
 | 
					            pageAct.selRolAuth = $(this).val();
 | 
				
			||||||
            dtAjaxResetSendData(rolAuthTable, { SelectedRoleId: roleGuid })
 | 
					            dtAjaxResetSendData(rolAuthTable, { SelectedRoleId: roleGuid })
 | 
				
			||||||
 | 
					            loadRolAuthTable();
 | 
				
			||||||
 | 
					            setAuthPage();
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        onEvent("click", "[data-target*=accManModal]", function () {
 | 
					        onEvent("click", "[data-target*=accManModal]", function () {
 | 
				
			||||||
@ -657,7 +665,7 @@
 | 
				
			|||||||
            else if (acc_table == "rolAuth") {
 | 
					            else if (acc_table == "rolAuth") {
 | 
				
			||||||
                loadRolAuthTable();
 | 
					                loadRolAuthTable();
 | 
				
			||||||
                setAuthPage();
 | 
					                setAuthPage();
 | 
				
			||||||
			}
 | 
					            }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        onEvent("click", "li.nav-item", function () {
 | 
					        onEvent("click", "li.nav-item", function () {
 | 
				
			||||||
@ -735,12 +743,6 @@
 | 
				
			|||||||
            }, null, "POST").send();
 | 
					            }, null, "POST").send();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        onEvent("change", "#roleSel", function () {
 | 
					 | 
				
			||||||
            pageAct.selRolAuth = $(this).val();
 | 
					 | 
				
			||||||
            loadRolAuthTable();
 | 
					 | 
				
			||||||
			setAuthPage();
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        onEvent("click", "[id*=rolAuthDelBtn]", function () {
 | 
					        onEvent("click", "[id*=rolAuthDelBtn]", function () {
 | 
				
			||||||
            pageAct.authCode = $(this).data('authcode');
 | 
					            pageAct.authCode = $(this).data('authcode');
 | 
				
			||||||
            pageAct.authUsrId = $(this).data('id');
 | 
					            pageAct.authUsrId = $(this).data('id');
 | 
				
			||||||
@ -769,6 +771,89 @@
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
            }, null, "POST").send();
 | 
					            }, null, "POST").send();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        onEvent("click", "[id*=accManSysRolEdiBtn]", function () {
 | 
				
			||||||
 | 
					            pageAct.addUsrDevSys = [];
 | 
				
			||||||
 | 
					            pageAct.delUsrDevSys = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            let name = $(this).data('fullname');
 | 
				
			||||||
 | 
					            let id = $(this).prop('id').split('Btn')[1];
 | 
				
			||||||
 | 
					            let url = baseApiUrl + "/User/GetMainSub";
 | 
				
			||||||
 | 
					            let sendData = {
 | 
				
			||||||
 | 
					                building_tag: pageAct.buiTag
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            objSendData.Data = sendData;
 | 
				
			||||||
 | 
					            function success(res) {
 | 
				
			||||||
 | 
					                $('#devSysTabTitle').html(name);
 | 
				
			||||||
 | 
					                $('#accManSysRolSavBtn').attr('data-id', id);
 | 
				
			||||||
 | 
					                let data = [];
 | 
				
			||||||
 | 
					                $.each(res.data.history_Main_Systems, function (i, v) {
 | 
				
			||||||
 | 
					                    $.each(v.history_Sub_systems, function (i, v) {
 | 
				
			||||||
 | 
					                        data.push(v);
 | 
				
			||||||
 | 
					                    });
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (data.length > 0) {
 | 
				
			||||||
 | 
					                    loadDevSysTable(data);
 | 
				
			||||||
 | 
					                    getUsrDevSys(id);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            ytAjax = new YourTeam.Ajax(url, objSendData, success, null, "POST").send();
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        onEvent("click", "[data-type=usrDevSys]", function () {
 | 
				
			||||||
 | 
					            if (pageAct.usrDevSys.length > 0) {
 | 
				
			||||||
 | 
					                if ($(this).is(':checked')) {
 | 
				
			||||||
 | 
					                    if ((jQuery.inArray($(this).prop('id'), pageAct.usrDevSys) == -1)) {
 | 
				
			||||||
 | 
					                        pageAct.addUsrDevSys.push($(this).prop('id'));
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    if (jQuery.inArray($(this).prop('id'), pageAct.delUsrDevSys) != -1) {
 | 
				
			||||||
 | 
					                        pageAct.delUsrDevSys.splice($.inArray($(this).prop('id'), pageAct.delUsrDevSys), 1);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                else {
 | 
				
			||||||
 | 
					                    if (jQuery.inArray($(this).prop('id'), pageAct.usrDevSys) != -1) {
 | 
				
			||||||
 | 
					                        pageAct.delUsrDevSys.push($(this).prop('id'));
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    if (jQuery.inArray($(this).prop('id'), pageAct.addUsrDevSys) != -1) {
 | 
				
			||||||
 | 
					                        pageAct.addUsrDevSys.splice($.inArray($(this).prop('id'), pageAct.addUsrDevSys), 1);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        onEvent("click", "#accManSysRolSavBtn", function () {
 | 
				
			||||||
 | 
					            //get user role id
 | 
				
			||||||
 | 
					            let url = baseApiUrl + "/User/GetUsrRolId";
 | 
				
			||||||
 | 
					            let sendData = {
 | 
				
			||||||
 | 
					                userinfo_guid: $(this).data('id')
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            objSendData.Data = sendData;
 | 
				
			||||||
 | 
					            function success(res) {
 | 
				
			||||||
 | 
					                //save role auth(devSys)
 | 
				
			||||||
 | 
					                url = baseApiUrl + "/User/SaveRoleAuth";
 | 
				
			||||||
 | 
					                sendData = {
 | 
				
			||||||
 | 
					                    SelectedRoleId: res.data,
 | 
				
			||||||
 | 
					                    SaveCheckAuth: pageAct.addUsrDevSys
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                objSendData.Data = sendData;
 | 
				
			||||||
 | 
					                ytAjax = new YourTeam.Ajax(url, objSendData, null, null, "POST").send();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                //delete role auth(devSys)
 | 
				
			||||||
 | 
					                url = baseApiUrl + "/User/DelDevSysRoleAuth";
 | 
				
			||||||
 | 
					                sendData = {
 | 
				
			||||||
 | 
					                    SelectedRoleId: res.data,
 | 
				
			||||||
 | 
					                    SaveCheckAuth: pageAct.delUsrDevSys
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                objSendData.Data = sendData;
 | 
				
			||||||
 | 
					                ytAjax = new YourTeam.Ajax(url, objSendData, null, null, "POST").send();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                $("#accManSysModal").modal("hide");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            ytAjax = new YourTeam.Ajax(url, objSendData, success, null, "POST").send();
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function clearPagSes() {
 | 
					    function clearPagSes() {
 | 
				
			||||||
@ -779,23 +864,44 @@
 | 
				
			|||||||
        pageAct.rolManId = null;
 | 
					        pageAct.rolManId = null;
 | 
				
			||||||
        pageAct.selRolAuth = null;
 | 
					        pageAct.selRolAuth = null;
 | 
				
			||||||
        pageAct.authCode = [];
 | 
					        pageAct.authCode = [];
 | 
				
			||||||
 | 
					        pageAct.useDevSys = [];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function setAuthPage() {
 | 
					    function setAuthPage() {
 | 
				
			||||||
        pageAct.authCode = $('[id*=rolAuthDelBtn]').map(function (i, v) { return $(v).data('authcode'); }).toArray();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        $(`#accAuthPageTable input[type=checkbox]`).prop('disabled', false);
 | 
					        $(`#accAuthPageTable input[type=checkbox]`).prop('disabled', false);
 | 
				
			||||||
        $.each($(`#accAuthPageTable input[type=checkbox]:checked`), function (i, v) {
 | 
					        $.each($(`#accAuthPageTable input[type=checkbox]:checked`), function (i, v) {
 | 
				
			||||||
            $(v).click();
 | 
					            $(v).click();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		pageAct.authCode = pageAct.authCode.filter(function (elem, index, self) {
 | 
					        pageAct.authCode = pageAct.authCode.filter(function (elem, index, self) {
 | 
				
			||||||
			return index === self.indexOf(elem);
 | 
					            return index === self.indexOf(elem);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $.each(pageAct.authCode, function (i, v) {
 | 
					        $.each(pageAct.authCode, function (i, v) {
 | 
				
			||||||
			$(`#accAuthPageTable input[id=${v}]`).click();
 | 
					            $(`#accAuthPageTable input[id=${v}]`).click();
 | 
				
			||||||
            $(`#accAuthPageTable input[id=${v}]`).attr('disabled', true);
 | 
					            $(`#accAuthPageTable input[id=${v}]`).attr('disabled', true);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    function getUsrDevSys(user_guid) {
 | 
				
			||||||
 | 
					        let url = baseApiUrl + "/User/GetUsrDevSys";
 | 
				
			||||||
 | 
					        let sendData = {
 | 
				
			||||||
 | 
					            userinfo_guid: user_guid
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        objSendData.Data = sendData;
 | 
				
			||||||
 | 
					        function success(res) {
 | 
				
			||||||
 | 
					            pageAct.usrDevSys = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $.each($(`#devSysTable input[type=checkbox]:checked`), function (i, v) {
 | 
				
			||||||
 | 
					                $(v).click();
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $.each(res.data, function (i, v) {
 | 
				
			||||||
 | 
					                $(`#devSysTable input[type=checkbox][id=${v}]`).click();
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            pageAct.usrDevSys = res.data;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        ytAjax = new YourTeam.Ajax(url, objSendData, success, null, "POST").send();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
@ -1463,62 +1463,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
 | 
				
			|||||||
                        </div>
 | 
					                        </div>
 | 
				
			||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    <div class="ml-auto d-flex">
 | 
					                    <div class="ml-auto d-flex" id="froLisPage">
 | 
				
			||||||
                        <div class="btn-group mx-4">
 | 
					 | 
				
			||||||
                            <a href="javascript:;" name="topFunBtn" data-page="dashboard" class="text-center">
 | 
					 | 
				
			||||||
                                <i class="fal fa-home fa-2x"></i><br>首頁
 | 
					 | 
				
			||||||
                            </a>
 | 
					 | 
				
			||||||
                            <!--<div class="dropdown-menu">
 | 
					 | 
				
			||||||
                                <button class="dropdown-item" type="button">Action</button>
 | 
					 | 
				
			||||||
                                <button class="dropdown-item" type="button">Another action</button>
 | 
					 | 
				
			||||||
                                <button class="dropdown-item" type="button">Something else here</button>
 | 
					 | 
				
			||||||
                            </div>-->
 | 
					 | 
				
			||||||
                        </div>
 | 
					 | 
				
			||||||
                        <div class="btn-group mx-4">
 | 
					 | 
				
			||||||
                            <a href="javascript:;" class="dropdown-toggle no-arrow text-center" data-toggle="dropdown"
 | 
					 | 
				
			||||||
                               aria-haspopup="true" aria-expanded="false">
 | 
					 | 
				
			||||||
                                <i class="fal fa-tv fa-2x"></i><br>系統監控
 | 
					 | 
				
			||||||
                            </a>
 | 
					 | 
				
			||||||
                            <div class="dropdown-menu dropdown-select-menu js-auto-close" id="sysMonBtnList">
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                            </div>
 | 
					 | 
				
			||||||
                        </div>
 | 
					 | 
				
			||||||
                        <div class="btn-group mx-4">
 | 
					 | 
				
			||||||
                            <a href="javascript:;" name="topFunBtn" class="dropdown-toggle no-arrow text-center"
 | 
					 | 
				
			||||||
                               data-page="energyManagement">
 | 
					 | 
				
			||||||
                                <i class="fal fa-chart-pie fa-2x"></i><br>能源管理
 | 
					 | 
				
			||||||
                            </a>
 | 
					 | 
				
			||||||
                        </div>
 | 
					 | 
				
			||||||
                        <div class="btn-group mx-4">
 | 
					 | 
				
			||||||
                            <a href="javascript:;" name="topFunBtn" class="dropdown-toggle no-arrow text-center"
 | 
					 | 
				
			||||||
                               data-page="historyData">
 | 
					 | 
				
			||||||
                                <i class="fal fa-chart-area fa-2x"></i><br>歷史資料
 | 
					 | 
				
			||||||
                            </a>
 | 
					 | 
				
			||||||
                        </div>
 | 
					 | 
				
			||||||
                        <div class="btn-group mx-4">
 | 
					 | 
				
			||||||
                            <a href="javascript:;" name="topFunBtn" class="dropdown-toggle no-arrow text-center"
 | 
					 | 
				
			||||||
                               data-page="alert">
 | 
					 | 
				
			||||||
                                <i class="fal fa-bell fa-2x"></i><br>即時告警
 | 
					 | 
				
			||||||
                            </a>
 | 
					 | 
				
			||||||
                        </div>
 | 
					 | 
				
			||||||
                        <div class="btn-group mx-4">
 | 
					 | 
				
			||||||
                            <a href="javascript:;" name="topFunBtn" class="no-arrow text-center"
 | 
					 | 
				
			||||||
                               data-page="operation">
 | 
					 | 
				
			||||||
                                <i class="fal fa-server fa-2x"></i><br>運維管理
 | 
					 | 
				
			||||||
                            </a>
 | 
					 | 
				
			||||||
                        </div>
 | 
					 | 
				
			||||||
                        <div class="btn-group mx-4">
 | 
					 | 
				
			||||||
                            <a href="javascript:;" name="topFunBtn" class="no-arrow text-center"
 | 
					 | 
				
			||||||
                               data-page="graphManagement">
 | 
					 | 
				
			||||||
                                <i class="fal fa-image fa-2x"></i><br>圖資管理
 | 
					 | 
				
			||||||
                            </a>
 | 
					 | 
				
			||||||
                        </div>
 | 
					 | 
				
			||||||
                        <div class="btn-group mx-4">
 | 
					 | 
				
			||||||
                            <a href="javascript:;" name="topFunBtn" class="no-arrow text-center"
 | 
					 | 
				
			||||||
                               data-page="accountManagement">
 | 
					 | 
				
			||||||
                                <i class="fal fa-user fa-2x"></i><br>帳號管理
 | 
					 | 
				
			||||||
                            </a>
 | 
					 | 
				
			||||||
                        </div>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
                    <div class="ml-auto d-flex">
 | 
					                    <div class="ml-auto d-flex">
 | 
				
			||||||
@ -2091,10 +2036,6 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
 | 
				
			|||||||
        var loadingTip = '';
 | 
					        var loadingTip = '';
 | 
				
			||||||
        var pageAct = {};  //記錄全頁面已選擇項目
 | 
					        var pageAct = {};  //記錄全頁面已選擇項目
 | 
				
			||||||
        pageAct.AreaTag = "TPE";
 | 
					        pageAct.AreaTag = "TPE";
 | 
				
			||||||
        if (localStorage.getItem("buiTag")) {
 | 
					 | 
				
			||||||
            pageAct.buiTag = localStorage.getItem("buiTag");
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (location.href.indexOf("ord") != -1) {
 | 
					        if (location.href.indexOf("ord") != -1) {
 | 
				
			||||||
            location.href = "/file/index.html"
 | 
					            location.href = "/file/index.html"
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -2194,38 +2135,12 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
 | 
				
			|||||||
            function isValidLogin() {
 | 
					            function isValidLogin() {
 | 
				
			||||||
                $("#app").load("_dashboard.html", loadCallback);
 | 
					                $("#app").load("_dashboard.html", loadCallback);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                iniFroList();
 | 
				
			||||||
                showMainSys();
 | 
					                showMainSys();
 | 
				
			||||||
                getBuiList();
 | 
					                getBuiList();
 | 
				
			||||||
                getSysMonBtnList();
 | 
					                getSysMonBtnList();
 | 
				
			||||||
                checkDevState();
 | 
					                checkDevState();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                function getSysMonBtnList() {
 | 
					 | 
				
			||||||
                    let url = baseApiUrl + "/api/Device/GetMainSub";
 | 
					 | 
				
			||||||
                    let sendData = {
 | 
					 | 
				
			||||||
                        building_tag: pageAct.buiTag,
 | 
					 | 
				
			||||||
                    };
 | 
					 | 
				
			||||||
                    objSendData.Data = sendData;
 | 
					 | 
				
			||||||
                    ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
 | 
					 | 
				
			||||||
                        if (!res || res.code != "0000" || !res.data) {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                        } else {
 | 
					 | 
				
			||||||
                            $("#sysMonBtnList").html("")
 | 
					 | 
				
			||||||
                            $.each(res.data.history_Main_Systems, (index, mainSysObj) => {
 | 
					 | 
				
			||||||
                                $.each(mainSysObj.history_Sub_systems, (index2, subSysObj) => {
 | 
					 | 
				
			||||||
                                    let page = "systemMonitor";
 | 
					 | 
				
			||||||
                                    if (subSysObj.sub_system_tag == "EL") {
 | 
					 | 
				
			||||||
                                        page = "sysElevator";
 | 
					 | 
				
			||||||
                                    }
 | 
					 | 
				
			||||||
                                    let btn = creBtn(subSysObj.full_name, `subSysBtn${subSysObj.sub_system_tag}`, "topFunBtn", ["dropdown-item"], { page: page });
 | 
					 | 
				
			||||||
                                    subSysObj.main_system_tag = mainSysObj.main_system_tag;
 | 
					 | 
				
			||||||
                                    btn.data("subSysObj", subSysObj);
 | 
					 | 
				
			||||||
                                    $("#sysMonBtnList").append(btn);
 | 
					 | 
				
			||||||
                                })
 | 
					 | 
				
			||||||
                            })
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                    }, null, "POST").send();
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                function getBuiList() {
 | 
					                function getBuiList() {
 | 
				
			||||||
                    let url = baseApiUrl + "/api/Device/GetBuild";
 | 
					                    let url = baseApiUrl + "/api/Device/GetBuild";
 | 
				
			||||||
                    ytAjax = new YourTeam.Ajax(url, null, function (res) {
 | 
					                    ytAjax = new YourTeam.Ajax(url, null, function (res) {
 | 
				
			||||||
@ -2234,11 +2149,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
 | 
				
			|||||||
                        } else {
 | 
					                        } else {
 | 
				
			||||||
                            let strHtml = ``;
 | 
					                            let strHtml = ``;
 | 
				
			||||||
                            $.each(res.data, (index, buiObj) => {
 | 
					                            $.each(res.data, (index, buiObj) => {
 | 
				
			||||||
                                let actStr = "";
 | 
					                                strHtml += `<a id="buiBtn${buiObj.building_tag}" data-urn="${buiObj.urn_3D}" class="dropdown-item" href="javascript:;">${buiObj.full_name}</a>`;
 | 
				
			||||||
                                if (pageAct.buiTag == buiObj.building_tag) {
 | 
					 | 
				
			||||||
                                    actStr = "active";
 | 
					 | 
				
			||||||
                                }
 | 
					 | 
				
			||||||
                                strHtml += `<a id="buiBtn${buiObj.building_tag}" data-urn="${buiObj.urn_3D}" class="dropdown-item ${actStr}" href="javascript:;">${buiObj.full_name}</a>`;
 | 
					 | 
				
			||||||
                            })
 | 
					                            })
 | 
				
			||||||
                            $("#buiList").append(strHtml).droSetItem();  //droSetItem 預設第一筆 active
 | 
					                            $("#buiList").append(strHtml).droSetItem();  //droSetItem 預設第一筆 active
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
@ -2330,9 +2241,9 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
 | 
				
			|||||||
                onEvent("active:change", "#buiList", function (e, actEle) {
 | 
					                onEvent("active:change", "#buiList", function (e, actEle) {
 | 
				
			||||||
                    if (actEle) {
 | 
					                    if (actEle) {
 | 
				
			||||||
                        pageAct.buiTag = $(actEle).prop("id").split("buiBtn")[1];
 | 
					                        pageAct.buiTag = $(actEle).prop("id").split("buiBtn")[1];
 | 
				
			||||||
                        localStorage.setItem("buiTag", pageAct.buiTag);
 | 
					 | 
				
			||||||
                        pageAct.urn = $(actEle).data("urn");
 | 
					                        pageAct.urn = $(actEle).data("urn");
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                })
 | 
					                })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                $(window).on("timeout:3s", function () {
 | 
					                $(window).on("timeout:3s", function () {
 | 
				
			||||||
@ -2425,7 +2336,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
 | 
				
			|||||||
            function drawErrRecTabBlo() {
 | 
					            function drawErrRecTabBlo() {
 | 
				
			||||||
                let strHtml = `<table id="errRecTable" class="table table-bordered table-striped text-center m-0 w-100">
 | 
					                let strHtml = `<table id="errRecTable" class="table table-bordered table-striped text-center m-0 w-100">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                                            </table>`
 | 
					                                                </table>`
 | 
				
			||||||
                return strHtml;
 | 
					                return strHtml;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -2433,7 +2344,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
 | 
				
			|||||||
            function drawOpeRecTabBlo() {
 | 
					            function drawOpeRecTabBlo() {
 | 
				
			||||||
                let strHtml = `<table id="opeRecTable" class="table table-bordered table-striped text-center m-0 w-100">
 | 
					                let strHtml = `<table id="opeRecTable" class="table table-bordered table-striped text-center m-0 w-100">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                                            </table>`
 | 
					                                                </table>`
 | 
				
			||||||
                return strHtml;
 | 
					                return strHtml;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -2446,37 +2357,37 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
 | 
				
			|||||||
                    $(ele).YTTooltip({
 | 
					                    $(ele).YTTooltip({
 | 
				
			||||||
                        html: `<div class="card m-1 border device-wrap">
 | 
					                        html: `<div class="card m-1 border device-wrap">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                                                <div class="card-header p-3">
 | 
					                                                    <div class="card-header p-3">
 | 
				
			||||||
 | 
					 | 
				
			||||||
                                                    <div class="position-absolute w-50" style="word-break: break-all;">
 | 
					 | 
				
			||||||
                                                        <label class="m-0 mt-2">${devName}</label>
 | 
					 | 
				
			||||||
                                                    </div>
 | 
					 | 
				
			||||||
                                                    <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="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="errRec-tab" class="btn btn-icon nav-link" role="tab" data-tabname="cardTab" data-target="#errRec"><i class="fas fa-exclamation-triangle"></i></button>
 | 
					 | 
				
			||||||
                                                        <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>
 | 
					 | 
				
			||||||
                                                        <button class="btn p-2"><i class="fas fa-times fs-1 text-white-50" data-close="yttooltip"></i></button>
 | 
					 | 
				
			||||||
                                                    </div>
 | 
					 | 
				
			||||||
                                                </div>
 | 
					 | 
				
			||||||
                                                <div class="card-body p-2 tab-content">
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                                                    <div id="state" class="show active" data-tabname="cardTab" data-tabrole="child">
 | 
					 | 
				
			||||||
                                                        ${drawStateTabBlo(devNum)}
 | 
					 | 
				
			||||||
                                                    </div>
 | 
					 | 
				
			||||||
                                                    <div id="info" data-tabname="cardTab" data-tabrole="child">
 | 
					 | 
				
			||||||
                                                        ${drawInfoTabBlo(devGuid)}
 | 
					 | 
				
			||||||
                                                    </div>
 | 
					 | 
				
			||||||
                                                    <div id="errRec" data-tabname="cardTab" data-tabrole="child">
 | 
					 | 
				
			||||||
                                                        ${drawErrRecTabBlo()}
 | 
					 | 
				
			||||||
                                                    </div>
 | 
					 | 
				
			||||||
                                                    <div id="opeRec" data-tabname="cardTab" data-tabrole="child">
 | 
					 | 
				
			||||||
                                                        ${drawOpeRecTabBlo()}
 | 
					 | 
				
			||||||
                                                    </div>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                                                        <div class="position-absolute w-50" style="word-break: break-all;">
 | 
				
			||||||
 | 
					                                                            <label class="m-0 mt-2">${devName}</label>
 | 
				
			||||||
                                                        </div>
 | 
					                                                        </div>
 | 
				
			||||||
                                                    </div>`,
 | 
					                                                        <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="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="errRec-tab" class="btn btn-icon nav-link" role="tab" data-tabname="cardTab" data-target="#errRec"><i class="fas fa-exclamation-triangle"></i></button>
 | 
				
			||||||
 | 
					                                                            <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>
 | 
				
			||||||
 | 
					                                                            <button class="btn p-2"><i class="fas fa-times fs-1 text-white-50" data-close="yttooltip"></i></button>
 | 
				
			||||||
 | 
					                                                        </div>
 | 
				
			||||||
 | 
					                                                    </div>
 | 
				
			||||||
 | 
					                                                    <div class="card-body p-2 tab-content">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                                                        <div id="state" class="show active" data-tabname="cardTab" data-tabrole="child">
 | 
				
			||||||
 | 
					                                                            ${drawStateTabBlo(devNum)}
 | 
				
			||||||
 | 
					                                                        </div>
 | 
				
			||||||
 | 
					                                                        <div id="info" data-tabname="cardTab" data-tabrole="child">
 | 
				
			||||||
 | 
					                                                            ${drawInfoTabBlo(devGuid)}
 | 
				
			||||||
 | 
					                                                        </div>
 | 
				
			||||||
 | 
					                                                        <div id="errRec" data-tabname="cardTab" data-tabrole="child">
 | 
				
			||||||
 | 
					                                                            ${drawErrRecTabBlo()}
 | 
				
			||||||
 | 
					                                                        </div>
 | 
				
			||||||
 | 
					                                                        <div id="opeRec" data-tabname="cardTab" data-tabrole="child">
 | 
				
			||||||
 | 
					                                                            ${drawOpeRecTabBlo()}
 | 
				
			||||||
 | 
					                                                        </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                                                            </div>
 | 
				
			||||||
 | 
					                                                        </div>`,
 | 
				
			||||||
                        group: "device",
 | 
					                        group: "device",
 | 
				
			||||||
                        onShow: function (tooltipEle, oriEle) {
 | 
					                        onShow: function (tooltipEle, oriEle) {
 | 
				
			||||||
                            var tab = new YT.Tab({ tabName: "cardTab" })
 | 
					                            var tab = new YT.Tab({ tabName: "cardTab" })
 | 
				
			||||||
@ -2484,7 +2395,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
 | 
				
			|||||||
                            //loadErrRecTable2($(oriEle).data("number"));
 | 
					                            //loadErrRecTable2($(oriEle).data("number"));
 | 
				
			||||||
                            //loadErrRecTable();
 | 
					                            //loadErrRecTable();
 | 
				
			||||||
                            loadErr($(oriEle).data("number"));
 | 
					                            loadErr($(oriEle).data("number"));
 | 
				
			||||||
                            typeof subDeviceSetTable != "undefined" ? subDeviceSetTable($(oriEle).data("number")) : ""
 | 
					                            subDeviceSetTable ? subDeviceSetTable($(oriEle).data("number")) : ""
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    })
 | 
					                    })
 | 
				
			||||||
                })
 | 
					                })
 | 
				
			||||||
@ -2670,6 +2581,85 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
 | 
				
			|||||||
                loadingTip = null;
 | 
					                loadingTip = null;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        function iniFroList() {
 | 
				
			||||||
 | 
					            url = baseApiUrl + '/api/GetUsrFroList'
 | 
				
			||||||
 | 
					            let hasMonitor = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            ytAjax = new YourTeam.Ajax(url, null, function (res) {
 | 
				
			||||||
 | 
					                if (!res || res.code != "0000" || !res.data) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    let strHtml = `<div class="btn-group mx-4">
 | 
				
			||||||
 | 
					                                            <a href="javascript:;" name="topFunBtn" data-page="dashboard" class="text-center">
 | 
				
			||||||
 | 
					                                                <i class="fal fa-home fa-2x"></i><br>首頁
 | 
				
			||||||
 | 
					                                            </a>
 | 
				
			||||||
 | 
					                                            <!--<div class="dropdown-menu">
 | 
				
			||||||
 | 
					                                                <button class="dropdown-item" type="button">Action</button>
 | 
				
			||||||
 | 
					                                                <button class="dropdown-item" type="button">Another action</button>
 | 
				
			||||||
 | 
					                                                <button class="dropdown-item" type="button">Something else here</button>
 | 
				
			||||||
 | 
					                                            </div>-->
 | 
				
			||||||
 | 
					                                        </div>`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    $.each(res.data, function (i, v) {
 | 
				
			||||||
 | 
					                        if (v.authCode == 'FL1') {
 | 
				
			||||||
 | 
					                            strHtml += `<div class="btn-group mx-4" >
 | 
				
			||||||
 | 
					                                                <a href="javascript:;" class="dropdown-toggle no-arrow text-center" data-toggle="dropdown"
 | 
				
			||||||
 | 
					                                                   aria-haspopup="true" aria-expanded="false">
 | 
				
			||||||
 | 
					                                                    <i class="fal fa-tv fa-2x"></i><br>${v.subName}
 | 
				
			||||||
 | 
					                                                </a>
 | 
				
			||||||
 | 
					                                                <div class="dropdown-menu dropdown-select-menu js-auto-close" id="${v.showView}">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                                                </div>
 | 
				
			||||||
 | 
					                                            </div>`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                            hasMonitor = true;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                        else {
 | 
				
			||||||
 | 
					                            let icon = v.authCode == 'FL2' ? 'fa-chart-pie' : v.authCode == 'FL3' ? 'fa-chart-area' : v.authCode == 'FL4' ? 'fa-bell' : v.authCode == 'FL5' ? 'fa-server' : v.authCode == 'FL6' ? 'fa-image' : v.authCode == 'FL7' ? 'fa-user' : '';
 | 
				
			||||||
 | 
					                            strHtml += `<div class="btn-group mx-4">
 | 
				
			||||||
 | 
					                                                <a href="javascript:;" name="topFunBtn" class="dropdown-toggle no-arrow text-center"
 | 
				
			||||||
 | 
					                                                   data-page="${v.showView}">
 | 
				
			||||||
 | 
					                                                    <i class="fal ${icon} fa-2x"></i><br>${v.subName}
 | 
				
			||||||
 | 
					                                                </a>
 | 
				
			||||||
 | 
					                                            </div>`;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    $('#froLisPage').html(strHtml);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }, null, "POST").send();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        function getSysMonBtnList() {
 | 
				
			||||||
 | 
					            let url = baseApiUrl + "/api/Device/GetMainSub";
 | 
				
			||||||
 | 
					            let sendData = {
 | 
				
			||||||
 | 
					                building_tag: pageAct.buiTag,
 | 
				
			||||||
 | 
					            };
 | 
				
			||||||
 | 
					            objSendData.Data = sendData;
 | 
				
			||||||
 | 
					            ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
 | 
				
			||||||
 | 
					                console.log(res);
 | 
				
			||||||
 | 
					                if (!res || res.code != "0000" || !res.data) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    $("#sysMonBtnList").html("")
 | 
				
			||||||
 | 
					                    $.each(res.data.history_Main_Systems, (index, mainSysObj) => {
 | 
				
			||||||
 | 
					                        $.each(mainSysObj.history_Sub_systems, (index2, subSysObj) => {
 | 
				
			||||||
 | 
					                            let page = "systemMonitor";
 | 
				
			||||||
 | 
					                            if (subSysObj.sub_system_tag == "EL") {
 | 
				
			||||||
 | 
					                                page = "sysElevator";
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                            let btn = creBtn(subSysObj.full_name, `subSysBtn${subSysObj.sub_system_tag}`, "topFunBtn", ["dropdown-item"], { page: page });
 | 
				
			||||||
 | 
					                            subSysObj.main_system_tag = mainSysObj.main_system_tag;
 | 
				
			||||||
 | 
					                            btn.data("subSysObj", subSysObj);
 | 
				
			||||||
 | 
					                            $("#sysMonBtnList").append(btn);
 | 
				
			||||||
 | 
					                        })
 | 
				
			||||||
 | 
					                    })
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }, null, "POST").send();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    </script>
 | 
					    </script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</body>
 | 
					</body>
 | 
				
			||||||
 | 
				
			|||||||
@ -69,8 +69,12 @@ namespace FrontendWebApi.ApiControllers
 | 
				
			|||||||
                        join userinfo c on c.role_guid = a.role_guid
 | 
					                        join userinfo c on c.role_guid = a.role_guid
 | 
				
			||||||
                        join variable v2 on b.ShowView = v2.id and v2.system_type = @sub_system_type
 | 
					                        join variable v2 on b.ShowView = v2.id and v2.system_type = @sub_system_type
 | 
				
			||||||
                        join variable v1 on v1.id = v2.system_parent_id and v1.system_type = @main_system_type
 | 
					                        join variable v1 on v1.id = v2.system_parent_id and v1.system_type = @main_system_type
 | 
				
			||||||
 | 
					                        join device d on v1.system_value = d.device_system_tag and v2.system_value = d.device_name_tag and d.deleted = 0
 | 
				
			||||||
                        left join device_kind dk on v1.system_value = dk.device_system_tag and v2.system_value = dk.device_name_tag and dk.device_building_tag = @building_tag
 | 
					                        left join device_kind dk on v1.system_value = dk.device_system_tag and v2.system_value = dk.device_name_tag and dk.device_building_tag = @building_tag
 | 
				
			||||||
                        -- left join device_item di on v2.system_value = di.device_name_tag and v1.system_value = di.device_system_tag and di.deleted = 0
 | 
					                        -- left join device_item di on v2.system_value = di.device_name_tag and v1.system_value = di.device_system_tag and di.deleted = 0
 | 
				
			||||||
 | 
					                        join (
 | 
				
			||||||
 | 
					                            select distinct main_system_tag, sub_system_tag from building_menu where building_tag = @building_tag
 | 
				
			||||||
 | 
					                        ) as bm on v2.system_value = bm.sub_system_tag and v1.system_value = bm.main_system_tag
 | 
				
			||||||
                        where c.account = @account
 | 
					                        where c.account = @account
 | 
				
			||||||
                        order by v1.system_priority, v2.system_priority", new { @account = myUser.account, @sub_system_type = sub_system_type, @main_system_type = main_system_type, @building_tag = fd.building_tag });
 | 
					                        order by v1.system_priority, v2.system_priority", new { @account = myUser.account, @sub_system_type = sub_system_type, @main_system_type = main_system_type, @building_tag = fd.building_tag });
 | 
				
			||||||
                var mains = dbsub.GroupBy(a => a.main_system_tag).ToList();
 | 
					                var mains = dbsub.GroupBy(a => a.main_system_tag).ToList();
 | 
				
			||||||
 | 
				
			|||||||
@ -204,7 +204,7 @@ namespace FrontendWebApi.ApiControllers
 | 
				
			|||||||
                        join userinfo c on c.role_guid = a.role_guid
 | 
					                        join userinfo c on c.role_guid = a.role_guid
 | 
				
			||||||
                        join variable v2 on b.ShowView = v2.id and v2.system_type = @sub_system_type
 | 
					                        join variable v2 on b.ShowView = v2.id and v2.system_type = @sub_system_type
 | 
				
			||||||
                        join variable v1 on v1.id = v2.system_parent_id and v1.system_type = @main_system_type
 | 
					                        join variable v1 on v1.id = v2.system_parent_id and v1.system_type = @main_system_type
 | 
				
			||||||
                        left join device d on v1.system_value = d.device_system_tag and v2.system_value = d.device_name_tag and d.deleted = 0
 | 
					                        join device d on v1.system_value = d.device_system_tag and v2.system_value = d.device_name_tag and d.deleted = 0
 | 
				
			||||||
                        where c.account = @account
 | 
					                        where c.account = @account
 | 
				
			||||||
                        order by v1.system_priority, v2.system_priority", new { @account = myUser.account, @sub_system_type = sub_system_type, @main_system_type = main_system_type });
 | 
					                        order by v1.system_priority, v2.system_priority", new { @account = myUser.account, @sub_system_type = sub_system_type, @main_system_type = main_system_type });
 | 
				
			||||||
                var dbbuilding = await frontendRepository.GetAllAsync<History_Build>(
 | 
					                var dbbuilding = await frontendRepository.GetAllAsync<History_Build>(
 | 
				
			||||||
 | 
				
			|||||||
@ -610,8 +610,6 @@ namespace FrontendWebApi.ApiControllers
 | 
				
			|||||||
                                };
 | 
					                                };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                            await backendRepository.AddOneByCustomTable(roleAuth, "role_auth");
 | 
					                            await backendRepository.AddOneByCustomTable(roleAuth, "role_auth");
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                            #endregion
 | 
					                            #endregion
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
@ -700,6 +698,90 @@ namespace FrontendWebApi.ApiControllers
 | 
				
			|||||||
            return apiResult;
 | 
					            return apiResult;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 即時趨勢條件過濾條件面板
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <param name="account"></param>
 | 
				
			||||||
 | 
					        /// <returns></returns>
 | 
				
			||||||
 | 
					        [HttpPost]
 | 
				
			||||||
 | 
					        public async Task<ActionResult<ApiResult<List<string>>>> GetUsrDevSys([FromBody] User u)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            ApiResult<List<string>> apiResult = new ApiResult<List<string>>();
 | 
				
			||||||
 | 
					            List<string> ss = new List<string>();
 | 
				
			||||||
 | 
					            try
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                var sqlString = $@"select ap.AuthCode
 | 
				
			||||||
 | 
					                                    from role_auth ra
 | 
				
			||||||
 | 
					                                    join auth_page ap on ra.AuthCode = ap.AuthCode
 | 
				
			||||||
 | 
					                                    join variable v on ap.ShowView = v.id
 | 
				
			||||||
 | 
					                                    join userinfo ui on ra.role_guid = ui.role_guid
 | 
				
			||||||
 | 
					                                    where v.system_type = 'device_system_category_layer3' and v.deleted = 0 and ui.userinfo_guid = @user_guid";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                ss = await backendRepository.GetAllAsync<string>(sqlString, new { @user_guid = u.userinfo_guid });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                apiResult.Data= ss;
 | 
				
			||||||
 | 
					                apiResult.Code = "0000";
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            catch (Exception exception)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                apiResult.Code = "9999";
 | 
				
			||||||
 | 
					                apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
 | 
				
			||||||
 | 
					                Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
 | 
				
			||||||
 | 
					                return Ok(apiResult);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            return Ok(apiResult);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 編輯 系統權限
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <param name="post"></param>
 | 
				
			||||||
 | 
					        /// <returns></returns>
 | 
				
			||||||
 | 
					        [HttpPost]
 | 
				
			||||||
 | 
					        public async Task<ApiResult<string>> DelDevSysRoleAuth([FromBody] PostSaveRoleAuth post)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            ApiResult<string> apiResult = new ApiResult<string>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            RoleManagerList roleManager = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            try
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                roleManager = await backendRepository.GetOneAsync<RoleManagerList>("role", $"role_guid='{post.SelectedRoleId}'");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (roleManager == null)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    apiResult.Code = "9994";
 | 
				
			||||||
 | 
					                    apiResult.Msg = "查無該角色";
 | 
				
			||||||
 | 
					                    return apiResult;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                else
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if (post.SaveCheckAuth.Count > 0)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        foreach (var item in post.SaveCheckAuth)
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            #region 刪除權限
 | 
				
			||||||
 | 
					                            await backendRepository.PurgeOneByGuidWithCustomDBNameAndTable("role_auth", $"role_guid = '{post.SelectedRoleId}' and AuthCode = '{item}'");
 | 
				
			||||||
 | 
					                            #endregion
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    apiResult.Code = "0000";
 | 
				
			||||||
 | 
					                    apiResult.Msg = "儲存成功";
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            catch (Exception exception)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                apiResult.Code = "9999";
 | 
				
			||||||
 | 
					                apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
 | 
				
			||||||
 | 
					                string json = System.Text.Json.JsonSerializer.Serialize(post);
 | 
				
			||||||
 | 
					                Logger.LogError("【" + controllerName + "/" + actionName + "】" + json);
 | 
				
			||||||
 | 
					                Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return apiResult;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [HttpPost]
 | 
					        [HttpPost]
 | 
				
			||||||
        [Route("api/getUser")]
 | 
					        [Route("api/getUser")]
 | 
				
			||||||
        public ActionResult GetUser()
 | 
					        public ActionResult GetUser()
 | 
				
			||||||
@ -710,5 +792,117 @@ namespace FrontendWebApi.ApiControllers
 | 
				
			|||||||
                data = myUser.userinfo_guid
 | 
					                data = myUser.userinfo_guid
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        [HttpPost]
 | 
				
			||||||
 | 
					        public async Task<ApiResult<string>> GetUsrRolId([FromBody] User post)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            ApiResult<string> apiResult = new ApiResult<string>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            User user = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            try
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                user = await backendRepository.GetOneAsync<User>("userinfo", $"userinfo_guid='{post.userinfo_guid}'");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (user == null)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    apiResult.Code = "9994";
 | 
				
			||||||
 | 
					                    apiResult.Msg = "查無該使用者";
 | 
				
			||||||
 | 
					                    return apiResult;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                else
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    apiResult.Code = "0000";
 | 
				
			||||||
 | 
					                    apiResult.Data = await backendRepository.GetOneAsync<string>($@"select role_guid from userinfo where userinfo_guid = @userinfo_guid", new { @userinfo_guid = post.userinfo_guid });
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            catch (Exception exception)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                apiResult.Code = "9999";
 | 
				
			||||||
 | 
					                apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
 | 
				
			||||||
 | 
					                string json = System.Text.Json.JsonSerializer.Serialize(post);
 | 
				
			||||||
 | 
					                Logger.LogError("【" + controllerName + "/" + actionName + "】" + json);
 | 
				
			||||||
 | 
					                Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return apiResult;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 即時趨勢條件過濾條件面板
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <param name="account"></param>
 | 
				
			||||||
 | 
					        /// <returns></returns>
 | 
				
			||||||
 | 
					        [HttpPost]
 | 
				
			||||||
 | 
					        public async Task<ActionResult<ApiResult<History_MainSubBuildFloor>>> GetMainSub([FromBody] HistoryFind hf)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            ApiResult<History_MainSubBuildFloor> apiResult = new ApiResult<History_MainSubBuildFloor>(jwt_str);
 | 
				
			||||||
 | 
					            if (!jwtlife)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                apiResult.Code = "5000";
 | 
				
			||||||
 | 
					                return BadRequest(apiResult);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            else if (string.IsNullOrEmpty(hf.building_tag))
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                apiResult.Code = "0002";
 | 
				
			||||||
 | 
					                apiResult.Msg = "必須選擇東別";
 | 
				
			||||||
 | 
					                return apiResult;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            try
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                var dbsub = await frontendRepository.GetAllAsync<HistoryDBMainSub>(
 | 
				
			||||||
 | 
					                    @$"select distinct v1.system_key main_name, v1.system_value main_system_tag, v2.system_key sub_name, v2.system_value sub_system_tag, v1.system_priority, v2.system_priority,
 | 
				
			||||||
 | 
					                                       d.device_number, d.full_name as device_full_name, d.device_serial_tag, b.AuthCode
 | 
				
			||||||
 | 
					                        from role_auth a
 | 
				
			||||||
 | 
					                        join auth_page b on a.AuthCode = b.AuthCode
 | 
				
			||||||
 | 
					                        join userinfo c on c.role_guid = a.role_guid
 | 
				
			||||||
 | 
					                        join variable v2 on b.ShowView = v2.id and v2.system_type = @sub_system_type
 | 
				
			||||||
 | 
					                        join variable v1 on v1.id = v2.system_parent_id and v1.system_type = @main_system_type
 | 
				
			||||||
 | 
					                        join device d on v1.system_value = d.device_system_tag and v2.system_value = d.device_name_tag and d.deleted = 0
 | 
				
			||||||
 | 
					                        where c.account = @account
 | 
				
			||||||
 | 
					                        order by v1.system_priority, v2.system_priority", new { @account = myUser.account, @sub_system_type = sub_system_type, @main_system_type = main_system_type });
 | 
				
			||||||
 | 
					                var dbbuilding = await frontendRepository.GetAllAsync<History_Build>(
 | 
				
			||||||
 | 
					                    @$"select distinct d.building_guid,d.full_name,d.priority from role_auth a
 | 
				
			||||||
 | 
					                        join auth_page b on a.AuthCode = b.AuthCode
 | 
				
			||||||
 | 
					                        join userinfo c on c.role_guid = a.role_guid
 | 
				
			||||||
 | 
					                        join building d on d.building_tag = b.building_tag
 | 
				
			||||||
 | 
					                        where c.account = @account and d.building_tag = @building_tag
 | 
				
			||||||
 | 
					                        order by d.priority 
 | 
				
			||||||
 | 
					                        ", new { @account = myUser.account, @building_tag = hf.building_tag });
 | 
				
			||||||
 | 
					                var mains = dbsub.GroupBy(a => a.main_system_tag).ToList();
 | 
				
			||||||
 | 
					                apiResult.Data = new History_MainSubBuildFloor();
 | 
				
			||||||
 | 
					                apiResult.Data.history_Main_Systems = new List<History_Main_system>();
 | 
				
			||||||
 | 
					                foreach (var main in mains)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    History_Main_system history_Main_System = new History_Main_system();
 | 
				
			||||||
 | 
					                    history_Main_System.main_system_tag = main.Select(a => a.main_system_tag).FirstOrDefault();
 | 
				
			||||||
 | 
					                    history_Main_System.full_name = main.Select(a => a.main_name).FirstOrDefault();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    var subs = dbsub.Where(x => x.main_system_tag == main.Select(m => m.main_system_tag).FirstOrDefault()).GroupBy(x => x.sub_system_tag).ToList();
 | 
				
			||||||
 | 
					                    history_Main_System.History_Sub_systems = subs.Count > 0 ? new List<History_Sub_system>() : null;
 | 
				
			||||||
 | 
					                    foreach (var sub in subs)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        History_Sub_system history_Sub_System = new History_Sub_system();
 | 
				
			||||||
 | 
					                        history_Sub_System.full_name = sub.Select(x => x.sub_name).FirstOrDefault();
 | 
				
			||||||
 | 
					                        history_Sub_System.sub_system_tag = sub.Select(x => x.sub_system_tag).FirstOrDefault();
 | 
				
			||||||
 | 
					                        history_Sub_System.auth_code = sub.Select(x => x.AuthCode).FirstOrDefault();
 | 
				
			||||||
 | 
					                        history_Main_System.History_Sub_systems.Add(history_Sub_System);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    apiResult.Data.history_Main_Systems.Add(history_Main_System);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                apiResult.Data.history_Builds = dbbuilding;
 | 
				
			||||||
 | 
					                apiResult.Code = "0000";
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            catch (Exception exception)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                apiResult.Code = "9999";
 | 
				
			||||||
 | 
					                apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
 | 
				
			||||||
 | 
					                Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
 | 
				
			||||||
 | 
					                return Ok(apiResult);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            return Ok(apiResult);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -84,7 +84,7 @@ namespace FrontendWebApi.ApiControllers
 | 
				
			|||||||
                        join userinfo c on c.role_guid = a.role_guid
 | 
					                        join userinfo c on c.role_guid = a.role_guid
 | 
				
			||||||
                        join variable v2 on b.ShowView = v2.id and v2.system_type = @sub_system_type
 | 
					                        join variable v2 on b.ShowView = v2.id and v2.system_type = @sub_system_type
 | 
				
			||||||
                        join variable v1 on v1.id = v2.system_parent_id and v1.system_type = @main_system_type
 | 
					                        join variable v1 on v1.id = v2.system_parent_id and v1.system_type = @main_system_type
 | 
				
			||||||
                        left join device d on v1.system_value = d.device_system_tag and v2.system_value = d.device_name_tag and d.deleted = 0
 | 
					                        join device d on v1.system_value = d.device_system_tag and v2.system_value = d.device_name_tag and d.deleted = 0
 | 
				
			||||||
                        where c.account = @account
 | 
					                        where c.account = @account
 | 
				
			||||||
                        order by v1.system_priority, v2.system_priority", new { @account = myUser.account, @sub_system_type = sub_system_type, @main_system_type = main_system_type });
 | 
					                        order by v1.system_priority, v2.system_priority", new { @account = myUser.account, @sub_system_type = sub_system_type, @main_system_type = main_system_type });
 | 
				
			||||||
                var dbbuilding = await frontendRepository.GetAllAsync<History_Build>(
 | 
					                var dbbuilding = await frontendRepository.GetAllAsync<History_Build>(
 | 
				
			||||||
@ -127,5 +127,33 @@ namespace FrontendWebApi.ApiControllers
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
            return Ok(apiResult);
 | 
					            return Ok(apiResult);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        [HttpPost]
 | 
				
			||||||
 | 
					        [Route("api/GetUsrFroList")]
 | 
				
			||||||
 | 
					        public async Task<ApiResult<List<AuthPage>>> UsrAuthPageList()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            ApiResult<List<AuthPage>> apiResult = new ApiResult<List<AuthPage>>();
 | 
				
			||||||
 | 
					            List<AuthPage> authPage = new List<AuthPage>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            try
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                var sqlString = $@"select ap.* from auth_page ap
 | 
				
			||||||
 | 
					                                    join role_auth ra on ap.AuthCode = ra.AuthCode
 | 
				
			||||||
 | 
					                                    join userinfo ui on ra.role_guid = ui.role_guid
 | 
				
			||||||
 | 
					                                    where ap.AuthCode like 'FL%' and ui.userinfo_guid = @userinfo_guid
 | 
				
			||||||
 | 
					                                    order by ap.AuthCode";
 | 
				
			||||||
 | 
					                authPage = await backendRepository.GetAllAsync<AuthPage>(sqlString, new { @userinfo_guid = myUser.userinfo_guid });
 | 
				
			||||||
 | 
					                apiResult.Code = "0000";
 | 
				
			||||||
 | 
					                apiResult.Data = authPage;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            catch (Exception exception)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                apiResult.Code = "9999";
 | 
				
			||||||
 | 
					                apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
 | 
				
			||||||
 | 
					                Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return apiResult;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -73,10 +73,10 @@ namespace FrontendWebApi.Models
 | 
				
			|||||||
        public byte device_item_is_controll { get; set; }
 | 
					        public byte device_item_is_controll { get; set; }
 | 
				
			||||||
        public byte device_item_is_bool { get; set; }
 | 
					        public byte device_item_is_bool { get; set; }
 | 
				
			||||||
        public byte device_item_is_link { get; set; }
 | 
					        public byte device_item_is_link { get; set; }
 | 
				
			||||||
 | 
					 | 
				
			||||||
        public string device_normal_flashing { get; set; }
 | 
					        public string device_normal_flashing { get; set; }
 | 
				
			||||||
        public string device_close_flashing { get; set; }
 | 
					        public string device_close_flashing { get; set; }
 | 
				
			||||||
        public string device_error_flashing { get; set; }
 | 
					        public string device_error_flashing { get; set; }
 | 
				
			||||||
 | 
					        public string AuthCode { get; set; }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public class HistoryFind
 | 
					    public class HistoryFind
 | 
				
			||||||
@ -126,6 +126,7 @@ namespace FrontendWebApi.Models
 | 
				
			|||||||
        public string device_normal_flashing { get; set; }
 | 
					        public string device_normal_flashing { get; set; }
 | 
				
			||||||
        public string device_close_flashing { get; set; }
 | 
					        public string device_close_flashing { get; set; }
 | 
				
			||||||
        public string device_error_flashing { get; set; }
 | 
					        public string device_error_flashing { get; set; }
 | 
				
			||||||
 | 
					        public string auth_code { get; set; }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    public class History_PostDevice
 | 
					    public class History_PostDevice
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
				
			|||||||
@ -140,6 +140,7 @@ namespace FrontendWebApi.Models
 | 
				
			|||||||
        public string AuthCode { get; set; }
 | 
					        public string AuthCode { get; set; }
 | 
				
			||||||
        public string MainName { get; set; }
 | 
					        public string MainName { get; set; }
 | 
				
			||||||
        public string SubName { get; set; }
 | 
					        public string SubName { get; set; }
 | 
				
			||||||
 | 
					        public string ShowView { get; set; }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public class PostSaveRoleAuth
 | 
					    public class PostSaveRoleAuth
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user