From a671bc2a555a90ea825c6fb63e723ac46bb03159 Mon Sep 17 00:00:00 2001 From: dev02 Date: Thu, 22 Dec 2022 18:01:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9authcode=E5=85=A8=E5=9F=9F?= =?UTF-8?q?=E8=AE=8A=E6=95=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frontend/_accountManagement.html | 163 +++++++++++++++++-------------- Frontend/index.html | 17 +--- 2 files changed, 91 insertions(+), 89 deletions(-) diff --git a/Frontend/_accountManagement.html b/Frontend/_accountManagement.html index 3f573c1..eb1af14 100644 --- a/Frontend/_accountManagement.html +++ b/Frontend/_accountManagement.html @@ -328,7 +328,7 @@ 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("設備權限", "accManSysRolEdiBtn" + data, null, ["btn", "btn-info"], { "toggle": "modal", "target": "#accManSysModal", "fullname": row.full_name })); + 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" })); return btnDiv.outerHtml(); } @@ -392,7 +392,7 @@ function loadRolAuthTable() { pageAct.authCode = []; - + let ajaxObj = { url: baseApiUrl + "/User/RoleAuthList", method: "POST", @@ -447,7 +447,6 @@ "title": "功能", "data": "role_guid", "render": function (data, type, row, meta) { - pageAct.authCode.push(row.authCode); let btnDiv = creDiv(["row", "m-0", "justify-content-center"], { "style": "gap:10px" }); btnDiv.append(creBtnHtml("刪除", "rolAuthDelBtn" + data, null, ["btn", "btn-danger"], { "toggle": "modal", "target": "#delModal", "id": data, "authcode": row.authCode })); return btnDiv.outerHtml(); @@ -456,6 +455,18 @@ ]; 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() { @@ -474,14 +485,14 @@ let columns = [ { - "title": "選擇", + "title": "選擇", "data": 'authCode', "render": function (data, type, row, meta) { return `` } }, { - "title": "編號", + "title": "編號", "data": null, "render": function (data, type, row, meta) { return meta.row + 1; @@ -489,7 +500,7 @@ }, { "title": "存取權限", - "data": "subName" + "data": "subName" } ]; @@ -497,37 +508,37 @@ } function loadDevSysTable(data) { - let tag = "#devSysTable"; + 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 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": "功能名稱", + let columns = [ + { + "title": "類別代號", + "data": 'sub_system_tag', + }, + { + "title": "類別名稱", + "data": "full_name", + }, + { + "title": "功能名稱", "data": null, - "render": function (data, type, row, meta) { - return `
+ "render": function (data, type, row, meta) { + return `
`; - } - } - ]; + } + } + ]; - devSysTable = new YourTeam.JqDataTables.getTableByStatic(tag, data, columns, column_defs, null, null, null, null, "tpi"); - } + devSysTable = new YourTeam.JqDataTables.getTableByStatic(tag, data, columns, column_defs, null, null, null, null, "tpi"); + } function getRoleSel() { @@ -556,10 +567,10 @@ function events() { onEvent("change", "#roleSel", function () { let roleGuid = $(this).val(); - pageAct.selRolAuth = $(this).val(); + pageAct.selRolAuth = $(this).val(); dtAjaxResetSendData(rolAuthTable, { SelectedRoleId: roleGuid }) - loadRolAuthTable(); - setAuthPage(); + loadRolAuthTable(); + setAuthPage(); }) onEvent("click", "[data-target*=accManModal]", function () { @@ -654,7 +665,7 @@ else if (acc_table == "rolAuth") { loadRolAuthTable(); setAuthPage(); - } + } }); onEvent("click", "li.nav-item", function () { @@ -767,11 +778,11 @@ 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; + 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); @@ -785,41 +796,41 @@ if (data.length > 0) { loadDevSysTable(data); getUsrDevSys(id); - } - } - ytAjax = new YourTeam.Ajax(url, objSendData, success, null, "POST").send(); + } + } + 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.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); - } + 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.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); - } - } + 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; + 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"; @@ -831,16 +842,16 @@ 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; + 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"); - } + + $("#accManSysModal").modal("hide"); + } ytAjax = new YourTeam.Ajax(url, objSendData, success, null, "POST").send(); }); } @@ -862,22 +873,22 @@ $(v).click(); }); - pageAct.authCode = pageAct.authCode.filter(function (elem, index, self) { - return index === self.indexOf(elem); + pageAct.authCode = pageAct.authCode.filter(function (elem, index, self) { + return index === self.indexOf(elem); }); $.each(pageAct.authCode, function (i, v) { - $(`#accAuthPageTable input[id=${v}]`).click(); + $(`#accAuthPageTable input[id=${v}]`).click(); $(`#accAuthPageTable input[id=${v}]`).attr('disabled', true); }); } function getUsrDevSys(user_guid) { - let url = baseApiUrl + "/User/GetUsrDevSys"; + let url = baseApiUrl + "/User/GetUsrDevSys"; let sendData = { userinfo_guid: user_guid - } - objSendData.Data = sendData; + } + objSendData.Data = sendData; function success(res) { pageAct.usrDevSys = []; @@ -886,11 +897,11 @@ }); $.each(res.data, function (i, v) { - $(`#devSysTable input[type=checkbox][id=${v}]`).click(); + $(`#devSysTable input[type=checkbox][id=${v}]`).click(); }); pageAct.usrDevSys = res.data; - } - ytAjax = new YourTeam.Ajax(url, objSendData, success, null, "POST").send(); + } + ytAjax = new YourTeam.Ajax(url, objSendData, success, null, "POST").send(); } \ No newline at end of file diff --git a/Frontend/index.html b/Frontend/index.html index c22888b..9e481f4 100644 --- a/Frontend/index.html +++ b/Frontend/index.html @@ -2036,10 +2036,6 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li var loadingTip = ''; var pageAct = {}; //記錄全頁面已選擇項目 pageAct.AreaTag = "TPE"; - if (localStorage.getItem("buiTag")) { - pageAct.buiTag = localStorage.getItem("buiTag"); - } - if (location.href.indexOf("ord") != -1) { location.href = "/file/index.html" } @@ -2153,11 +2149,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li } else { let strHtml = ``; $.each(res.data, (index, buiObj) => { - let actStr = ""; - if (pageAct.buiTag == buiObj.building_tag) { - actStr = "active"; - } - strHtml += `${buiObj.full_name}`; + strHtml += `${buiObj.full_name}`; }) $("#buiList").append(strHtml).droSetItem(); //droSetItem 預設第一筆 active } @@ -2249,9 +2241,9 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li onEvent("active:change", "#buiList", function (e, actEle) { if (actEle) { pageAct.buiTag = $(actEle).prop("id").split("buiBtn")[1]; - localStorage.setItem("buiTag", pageAct.buiTag); pageAct.urn = $(actEle).data("urn"); } + }) $(window).on("timeout:3s", function () { @@ -2403,7 +2395,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li //loadErrRecTable2($(oriEle).data("number")); //loadErrRecTable(); loadErr($(oriEle).data("number")); - typeof subDeviceSetTable != "undefined" ? subDeviceSetTable($(oriEle).data("number")) : "" + subDeviceSetTable ? subDeviceSetTable($(oriEle).data("number")) : "" } }) }) @@ -2650,9 +2642,8 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li ytAjax = new YourTeam.Ajax(url, objSendData, function (res) { console.log(res); if (!res || res.code != "0000" || !res.data) { - console.log('aaaaa'); + } else { - console.log('bbbbb'); $("#sysMonBtnList").html("") $.each(res.data.history_Main_Systems, (index, mainSysObj) => { $.each(mainSysObj.history_Sub_systems, (index2, subSysObj) => {