diff --git a/Frontend/_accountManagement.html b/Frontend/_accountManagement.html index 73e8f97..3f573c1 100644 --- a/Frontend/_accountManagement.html +++ b/Frontend/_accountManagement.html @@ -191,59 +191,19 @@ @@ -368,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" })); + 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(); } @@ -487,6 +447,7 @@ "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(); @@ -513,28 +474,61 @@ 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; } }, { - "title": "功能名稱", - "data": "subName", + "title": "存取權限", + "data": "subName" } ]; 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 `
+ + +
`; + } + } + ]; + + devSysTable = new YourTeam.JqDataTables.getTableByStatic(tag, data, columns, column_defs, null, null, null, null, "tpi"); + } + function getRoleSel() { let url = baseApiUrl + "/User/RoleManagerList"; @@ -562,7 +556,10 @@ function events() { onEvent("change", "#roleSel", function () { let roleGuid = $(this).val(); + pageAct.selRolAuth = $(this).val(); dtAjaxResetSendData(rolAuthTable, { SelectedRoleId: roleGuid }) + loadRolAuthTable(); + setAuthPage(); }) onEvent("click", "[data-target*=accManModal]", function () { @@ -735,12 +732,6 @@ }, null, "POST").send(); }); - onEvent("change", "#roleSel", function () { - pageAct.selRolAuth = $(this).val(); - loadRolAuthTable(); - setAuthPage(); - }); - onEvent("click", "[id*=rolAuthDelBtn]", function () { pageAct.authCode = $(this).data('authcode'); pageAct.authUsrId = $(this).data('id'); @@ -769,6 +760,89 @@ } }, 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() { @@ -779,11 +853,10 @@ pageAct.rolManId = null; pageAct.selRolAuth = null; pageAct.authCode = []; + pageAct.useDevSys = []; } function setAuthPage() { - pageAct.authCode = $('[id*=rolAuthDelBtn]').map(function (i, v) { return $(v).data('authcode'); }).toArray(); - $(`#accAuthPageTable input[type=checkbox]`).prop('disabled', false); $.each($(`#accAuthPageTable input[type=checkbox]:checked`), function (i, v) { $(v).click(); @@ -798,4 +871,26 @@ $(`#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(); + } \ No newline at end of file diff --git a/Frontend/index.html b/Frontend/index.html index 44799d0..517328f 100644 --- a/Frontend/index.html +++ b/Frontend/index.html @@ -1463,62 +1463,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li -
-
- -
首頁 -
- -
-
- - -
-
- -
能源管理 -
-
-
- -
歷史資料 -
-
-
- -
即時告警 -
-
-
- -
運維管理 -
-
-
- -
圖資管理 -
-
-
- -
帳號管理 -
-
+
@@ -2190,38 +2135,12 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li function isValidLogin() { $("#app").load("_dashboard.html", loadCallback); + iniFroList(); showMainSys(); getBuiList(); getSysMonBtnList(); 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() { let url = baseApiUrl + "/api/Device/GetBuild"; ytAjax = new YourTeam.Ajax(url, null, function (res) { @@ -2417,7 +2336,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li function drawErrRecTabBlo() { let strHtml = ` -
` + ` return strHtml; } @@ -2425,7 +2344,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li function drawOpeRecTabBlo() { let strHtml = ` -
` + ` return strHtml; } @@ -2438,37 +2357,37 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li $(ele).YTTooltip({ html: `
-
- -
- -
- -
-
- -
- ${drawStateTabBlo(devNum)} -
-
- ${drawInfoTabBlo(devGuid)} -
-
- ${drawErrRecTabBlo()} -
-
- ${drawOpeRecTabBlo()} -
- +
+
+
-
`, + +
+
+ +
+ ${drawStateTabBlo(devNum)} +
+
+ ${drawInfoTabBlo(devGuid)} +
+
+ ${drawErrRecTabBlo()} +
+
+ ${drawOpeRecTabBlo()} +
+ + +
+
`, group: "device", onShow: function (tooltipEle, oriEle) { var tab = new YT.Tab({ tabName: "cardTab" }) @@ -2662,6 +2581,86 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li 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 = ``; + + $.each(res.data, function (i, v) { + if (v.authCode == 'FL1') { + strHtml += ``; + + 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 += ``; + } + + }); + + $('#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) { + console.log('aaaaa'); + } else { + console.log('bbbbb'); + $("#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(); + } diff --git a/FrontendWebApi/ApiControllers/DeviceManageController.cs b/FrontendWebApi/ApiControllers/DeviceManageController.cs index dd0f597..7675fbe 100644 --- a/FrontendWebApi/ApiControllers/DeviceManageController.cs +++ b/FrontendWebApi/ApiControllers/DeviceManageController.cs @@ -69,8 +69,12 @@ namespace FrontendWebApi.ApiControllers 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 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 + 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 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(); diff --git a/FrontendWebApi/ApiControllers/HistoryController.cs b/FrontendWebApi/ApiControllers/HistoryController.cs index b085655..dbc1bfa 100644 --- a/FrontendWebApi/ApiControllers/HistoryController.cs +++ b/FrontendWebApi/ApiControllers/HistoryController.cs @@ -204,7 +204,7 @@ namespace FrontendWebApi.ApiControllers 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 - 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 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( diff --git a/FrontendWebApi/ApiControllers/UserController.cs b/FrontendWebApi/ApiControllers/UserController.cs index 37d414c..85a8280 100644 --- a/FrontendWebApi/ApiControllers/UserController.cs +++ b/FrontendWebApi/ApiControllers/UserController.cs @@ -610,8 +610,6 @@ namespace FrontendWebApi.ApiControllers }; await backendRepository.AddOneByCustomTable(roleAuth, "role_auth"); - - #endregion } } @@ -700,6 +698,90 @@ namespace FrontendWebApi.ApiControllers return apiResult; } + /// + /// 即時趨勢條件過濾條件面板 + /// + /// + /// + [HttpPost] + public async Task>>> GetUsrDevSys([FromBody] User u) + { + ApiResult> apiResult = new ApiResult>(); + List ss = new List(); + 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(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); + } + + /// + /// 編輯 系統權限 + /// + /// + /// + [HttpPost] + public async Task> DelDevSysRoleAuth([FromBody] PostSaveRoleAuth post) + { + ApiResult apiResult = new ApiResult(); + + RoleManagerList roleManager = null; + + try + { + roleManager = await backendRepository.GetOneAsync("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] [Route("api/getUser")] public ActionResult GetUser() @@ -710,5 +792,117 @@ namespace FrontendWebApi.ApiControllers data = myUser.userinfo_guid }); } + + [HttpPost] + public async Task> GetUsrRolId([FromBody] User post) + { + ApiResult apiResult = new ApiResult(); + + User user = null; + + try + { + user = await backendRepository.GetOneAsync("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($@"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; + + } + + /// + /// 即時趨勢條件過濾條件面板 + /// + /// + /// + [HttpPost] + public async Task>> GetMainSub([FromBody] HistoryFind hf) + { + ApiResult apiResult = new ApiResult(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( + @$"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( + @$"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(); + 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() : 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); + } } } diff --git a/FrontendWebApi/ApiControllers/UtilityController.cs b/FrontendWebApi/ApiControllers/UtilityController.cs index 58bd7b4..6487a1b 100644 --- a/FrontendWebApi/ApiControllers/UtilityController.cs +++ b/FrontendWebApi/ApiControllers/UtilityController.cs @@ -84,7 +84,7 @@ namespace FrontendWebApi.ApiControllers 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 - 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 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( @@ -127,5 +127,33 @@ namespace FrontendWebApi.ApiControllers } return Ok(apiResult); } + + [HttpPost] + [Route("api/GetUsrFroList")] + public async Task>> UsrAuthPageList() + { + ApiResult> apiResult = new ApiResult>(); + List authPage = new List(); + + 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(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; + } } } diff --git a/FrontendWebApi/Models/HistoryClass.cs b/FrontendWebApi/Models/HistoryClass.cs index fd71eec..76d5252 100644 --- a/FrontendWebApi/Models/HistoryClass.cs +++ b/FrontendWebApi/Models/HistoryClass.cs @@ -73,10 +73,10 @@ namespace FrontendWebApi.Models public byte device_item_is_controll { get; set; } public byte device_item_is_bool { get; set; } public byte device_item_is_link { get; set; } - public string device_normal_flashing { get; set; } public string device_close_flashing { get; set; } public string device_error_flashing { get; set; } + public string AuthCode { get; set; } } public class HistoryFind @@ -126,6 +126,7 @@ namespace FrontendWebApi.Models public string device_normal_flashing { get; set; } public string device_close_flashing { get; set; } public string device_error_flashing { get; set; } + public string auth_code { get; set; } } public class History_PostDevice { diff --git a/FrontendWebApi/Models/User.cs b/FrontendWebApi/Models/User.cs index f96acbb..4437472 100644 --- a/FrontendWebApi/Models/User.cs +++ b/FrontendWebApi/Models/User.cs @@ -140,6 +140,7 @@ namespace FrontendWebApi.Models public string AuthCode { get; set; } public string MainName { get; set; } public string SubName { get; set; } + public string ShowView { get; set; } } public class PostSaveRoleAuth