This commit is contained in:
dev01 2022-12-22 14:34:26 +08:00
commit 3e49ef1943
13 changed files with 335 additions and 143 deletions

View File

@ -40,13 +40,16 @@ namespace Backend.Controllers
try try
{ {
List<Device_value> ds; List<Device_value> ds;
string url_slot = "slot:/TPE/B1|"; string url_slot = "slot:/TPE/B1|";//三菱
//string url_slot = "slot:/NTPC/B1|";//wsp
string top100 = "";//" top 100 "; string top100 = "";//" top 100 ";
webRequestService svc = new webRequestService(); webRequestService svc = new webRequestService();
string bql = url_slot + "bql:select " + top100 + " * from control:ControlPoint "; string bql = url_slot + "bql:select " + top100 + " * from control:ControlPoint ";
//ds = svc.obixQuery("http://192.168.0.136:8080/obix/config/Arena/Program/ObixQuery/query/", bql); //ds = svc.obixQuery("http://192.168.0.136:8080/obix/config/Arena/Program/ObixQuery/query/", bql);
//ds = svc.obixQuery("http://localhost:8080/obix/config/Program/ObixQuery/query/", bql); //ds = svc.obixQuery("http://localhost:8080/obix/config/Program/ObixQuery/query/", bql);
ds = svc.obixQuery("http://192.168.0.136:8080/obix/config/Program/ObixQuery/query/", bql); ds = svc.obixQuery("http://192.168.0.136:8080/obix/config/Program/ObixQuery/query/", bql);//三菱
//ds = svc.obixQuery("http://192.168.0.136:8081/obix/config/Program/ObixQuery/query/", bql);//wsp
apiResult.Code = "0000"; apiResult.Code = "0000";
apiResult.Data = ds; apiResult.Data = ds;

View File

@ -17,6 +17,7 @@
"Server": "FYlY+w0XDIz+jmF2rlZWJw==", //0.201 "Server": "FYlY+w0XDIz+jmF2rlZWJw==", //0.201
"Port": "js2LutKe+rdjzdxMPQUrvQ==", "Port": "js2LutKe+rdjzdxMPQUrvQ==",
"Database": "VJB2XC+lAtzuHObDGMVOAA==", //30 "Database": "VJB2XC+lAtzuHObDGMVOAA==", //30
//"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp
"Root": "SzdxEgaJJ7tcTCrUl2zKsA==", "Root": "SzdxEgaJJ7tcTCrUl2zKsA==",
"Password": "FVAPxztxpY4gJJKQ/se4bQ==" "Password": "FVAPxztxpY4gJJKQ/se4bQ=="
} }

View File

@ -16,7 +16,8 @@
"MySqlDBConfig": { "MySqlDBConfig": {
"Server": "FYlY+w0XDIz+jmF2rlZWJw==", //0.201 "Server": "FYlY+w0XDIz+jmF2rlZWJw==", //0.201
"Port": "js2LutKe+rdjzdxMPQUrvQ==", "Port": "js2LutKe+rdjzdxMPQUrvQ==",
"Database": "VJB2XC+lAtzuHObDGMVOAA==", //30 "Database": "VJB2XC+lAtzuHObDGMVOAA==", //
//"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp
"Root": "SzdxEgaJJ7tcTCrUl2zKsA==", "Root": "SzdxEgaJJ7tcTCrUl2zKsA==",
"Password": "FVAPxztxpY4gJJKQ/se4bQ==" "Password": "FVAPxztxpY4gJJKQ/se4bQ=="
} }

View File

@ -4,12 +4,18 @@
<h1 class="p-2 mb-0">帳號與權限管理</h1> <h1 class="p-2 mb-0">帳號與權限管理</h1>
<div class="row mt-5"> <div class="row mt-5">
<ul class="nav nav-tabs w-100" role="tablist"> <ul class="nav nav-tabs w-100" role="tablist">
<li class="nav-item"> <a class="nav-link active" data-toggle="tab" href="#tab_borders_icons-1" <li class="nav-item">
role="tab"><i class="fal fa-user mr-1"></i> 帳號管理</a> </li> <a class="nav-link active" data-toggle="tab" href="#tab_borders_icons-1"
<li class="nav-item"> <a class="nav-link" data-toggle="tab" href="#tab_borders_icons-2" role="tab"><i class="fal fa-user mr-1"></i> 帳號管理</a>
role="tab"><i class="fal fa-users mr-1"></i> 群組管理</a> </li> </li>
<li class="nav-item"> <a class="nav-link" data-toggle="tab" href="#tab_borders_icons-3" <li class="nav-item">
role="tab"><i class="fal fa-cog mr-1"></i> 群組權限</a> </li> <a class="nav-link" data-toggle="tab" href="#tab_borders_icons-2"
role="tab"><i class="fal fa-users mr-1"></i> 群組管理</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#tab_borders_icons-3"
role="tab"><i class="fal fa-cog mr-1"></i> 群組權限</a>
</li>
</ul> </ul>
<div class="tab-content border border-top-0 p-3 w-100"> <div class="tab-content border border-top-0 p-3 w-100">
<div class="tab-pane fade show active" id="tab_borders_icons-1" role="tabpanel" data-id="accMan"> <div class="tab-pane fade show active" id="tab_borders_icons-1" role="tabpanel" data-id="accMan">
@ -38,8 +44,10 @@
<div class="col-auto"> <a href="#" class="btn btn-info" id="acc_searchBtn">搜尋</a> </div> <div class="col-auto"> <a href="#" class="btn btn-info" id="acc_searchBtn">搜尋</a> </div>
</div> </div>
<div class="frame-wrap"> <div class="frame-wrap">
<div class="mb-3"> <a href="#" class="btn btn-success" data-toggle="modal" <div class="mb-3">
data-target="#accManModal">+ 新增</a> </div> <a href="#" class="btn btn-success" data-toggle="modal"
data-target="#accManModal">+ 新增</a>
</div>
<table id="accManTable" class="table table-bordered table-striped text-center m-0 w-100"> <table id="accManTable" class="table table-bordered table-striped text-center m-0 w-100">
</table> </table>
</div> </div>
@ -48,15 +56,17 @@
<div class="row mb-5 align-items-end"> <div class="row mb-5 align-items-end">
<div class="col-auto"> <div class="col-auto">
<div class="form-group"> <div class="form-group">
<label class="form-label" for="simpleinput">角色</label> <label class="form-label" for="seaRolName">角色</label>
<input type="text" id="simpleinput" class="form-control"> <input type="text" id="seaRolName" class="form-control">
</div> </div>
</div> </div>
<div class="col-auto"> <a href="#" class="btn btn-info">搜尋</a> </div> <div class="col-auto"> <a href="#" class="btn btn-info" id="rol_searchBtn">搜尋</a> </div>
</div> </div>
<div class="frame-wrap"> <div class="frame-wrap">
<div class="mb-3"> <a href="#" class="btn btn-success" data-toggle="modal" <div class="mb-3">
data-target="#groupModal">+ 新增</a> </div> <a href="#" class="btn btn-success" data-toggle="modal"
data-target="#groupModal">+ 新增</a>
</div>
<table id="rolManTable" class="table table-bordered table-striped text-center m-0 w-100"> <table id="rolManTable" class="table table-bordered table-striped text-center m-0 w-100">
</table> </table>
</div> </div>
@ -72,8 +82,10 @@
</div> </div>
</div> </div>
<div class="frame-wrap"> <div class="frame-wrap">
<div class="mb-3"> <a href="#" class="btn btn-success" data-toggle="modal" <div class="mb-3">
data-target="#modal-center-users">+ 加入可用功能</a> </div> <a href="#" class="btn btn-success" data-toggle="modal"
data-target="#authPageModal">+ 加入可用功能</a>
</div>
<table id="rolAuthTable" class="table table-bordered table-striped text-center m-0 w-100"> <table id="rolAuthTable" class="table table-bordered table-striped text-center m-0 w-100">
</table> </table>
</div> </div>
@ -166,8 +178,8 @@
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" id="" data-dismiss="modal">關閉</button> <button type="button" class="btn btn-secondary" id="accRolCanBtn" data-dismiss="modal">關閉</button>
<button type="button" class="btn btn-primary" id="" e-prevent>儲存</button> <button type="button" class="btn btn-primary" id="accRolSavBtn" e-prevent>儲存</button>
</div> </div>
</form> </form>
</div> </div>
@ -175,7 +187,7 @@
</div> </div>
<!-- Modal center 設備權限 --> <!-- Modal center 設備權限 -->
<div class="modal fade" id="modal-center-cog" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false"> <div class="modal fade" id="accManSysModal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
<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">
@ -187,7 +199,7 @@
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<table class="table table-bordered table-striped text-center m-0"> <table class="table table-bordered table-striped text-center m-0 w-100">
<thead class="thead-themed"> <thead class="thead-themed">
<tr> <tr>
<th>類別代號</th> <th>類別代號</th>
@ -231,14 +243,14 @@
</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 type="button" class="btn btn-primary">儲存</button> <button id="accManSysRolSavBtn" type="button" class="btn btn-primary">儲存</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- Modal center 設備權限 --> <!-- Modal center 頁面權限 -->
<div class="modal fade" id="modal-center-users" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false"> <div class="modal fade" id="authPageModal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
<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">
@ -250,56 +262,12 @@
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<table class="table table-bordered table-striped text-center m-0"> <table id="accAuthPageTable" 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><input type="checkbox"></td>
<td>1</td>
<td>系統監控</td>
</tr>
<tr>
<td><input type="checkbox"></td>
<td>2</td>
<td>歷史資料</td>
</tr>
<tr>
<td><input type="checkbox"></td>
<td>3</td>
<td>異常記錄</td>
</tr>
<tr>
<td><input type="checkbox"></td>
<td>4</td>
<td>即時告警</td>
</tr>
<tr>
<td><input type="checkbox"></td>
<td>5</td>
<td>運維管理</td>
</tr>
<tr>
<td><input type="checkbox"></td>
<td>6</td>
<td>圖資管理</td>
</tr>
<tr>
<td><input type="checkbox"></td>
<td>7</td>
<td>帳號管理</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 type="button" class="btn btn-primary">儲存</button> <button type="button" id="authPageSavBtn" class="btn btn-primary">儲存</button>
</div> </div>
</div> </div>
</div> </div>
@ -329,7 +297,9 @@
getRoleSel(); getRoleSel();
loadAccManTable(); loadAccManTable();
loadRolManTable(); loadRolManTable();
loadAuthPageTable();
loadRolAuthTable(); loadRolAuthTable();
setAuthPage();
events(); events();
}) })
@ -350,13 +320,13 @@
ajaxObj.data = sendData; ajaxObj.data = sendData;
let column_defs = [ let column_defs = [
{ "targets": [0], "width": "6%", "sortable": true }, { "targets": [0], "width": "6%", "sortable": true },
{ "targets": [1], "width": "12%", "sortable": true }, { "targets": [1], "width": "10%", "sortable": true },
{ "targets": [2], "width": "14%", "sortable": true }, { "targets": [2], "width": "14%", "sortable": true },
{ "targets": [3], "width": "12%", "sortable": true }, { "targets": [3], "width": "10%", "sortable": true },
{ "targets": [4], "width": "14%", "sortable": true }, { "targets": [4], "width": "14%", "sortable": true },
{ "targets": [5], "width": "14%", "sortable": true }, { "targets": [5], "width": "10%", "sortable": true },
{ "targets": [6], "width": "14%", "sortable": true }, { "targets": [6], "width": "14%", "sortable": true },
{ "targets": [7], "width": "14%", "sortable": true }, { "targets": [7], "width": "22%", "sortable": true },
]; ];
let columns = [ let columns = [
@ -398,6 +368,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("刪除", "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();
} }
@ -411,8 +382,14 @@
let ajaxObj = { let ajaxObj = {
url: baseApiUrl + "/User/RoleManagerList", url: baseApiUrl + "/User/RoleManagerList",
method: "POST", method: "POST",
data: { post: 0 },
} }
let sendData = {};
sendData.Layer = 0;
if (pageAct.rolName != null)
sendData.Full_name = pageAct.rolName;
ajaxObj.data = sendData;
let tag = "#rolManTable"; let tag = "#rolManTable";
let column_defs = [ let column_defs = [
@ -443,8 +420,8 @@
"data": "layer", "data": "layer",
"render": function (data, type, row, meta) { "render": function (data, type, row, meta) {
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("修改", "rolManEdiBtn" + data, null, ["btn", "btn-info"], { "toggle": "modal", "target": "#groupModal" })); btnDiv.append(creBtnHtml("修改", "rolManEdiBtn" + data, null, ["btn", "btn-info"], { "toggle": "modal", "target": "#groupModal", "name": row.full_name, "id": row.role_guid }));
btnDiv.append(creBtnHtml("刪除", "rolManDelBtn" + data, null, ["btn", "btn-danger"], { "toggle": "modal", "target": "#delModal" })); btnDiv.append(creBtnHtml("刪除", "rolManDelBtn" + data, null, ["btn", "btn-danger"], { "toggle": "modal", "target": "#delModal", "id": row.role_guid }));
return btnDiv.outerHtml(); return btnDiv.outerHtml();
} }
}, },
@ -454,10 +431,12 @@
} }
function loadRolAuthTable() { function loadRolAuthTable() {
pageAct.authCode = [];
let ajaxObj = { let ajaxObj = {
url: baseApiUrl + "/User/RoleAuthList", url: baseApiUrl + "/User/RoleAuthList",
method: "POST", method: "POST",
data: { SelectedRoleId: "882b7e2c-1205-4d7c-81dc-818b8d1c1b33" }, data: { SelectedRoleId: pageAct.selRolAuth },
} }
let tag = "#rolAuthTable"; let tag = "#rolAuthTable";
@ -475,7 +454,7 @@
let columns = [ let columns = [
{ {
"title": "編號", "title": "編號",
"data": null, "data": "authCode",
"render": function (data, type, row, meta) { "render": function (data, type, row, meta) {
return meta.row + 1; return meta.row + 1;
} }
@ -506,10 +485,10 @@
}, },
{ {
"title": "功能", "title": "功能",
"data": "userinfo_guid", "data": "role_guid",
"render": function (data, type, row, meta) { "render": function (data, type, row, meta) {
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("刪除", "rolAuthDelBtn", null, ["btn", "btn-danger"], { "toggle": "modal", "target": "#delModal" })); btnDiv.append(creBtnHtml("刪除", "rolAuthDelBtn" + data, null, ["btn", "btn-danger"], { "toggle": "modal", "target": "#delModal", "id": data, "authcode": row.authCode }));
return btnDiv.outerHtml(); return btnDiv.outerHtml();
} }
}, },
@ -518,6 +497,44 @@
rolAuthTable = new YourTeam.JqDataTables.getTableByAjax(ajaxObj, tag, null, columns, column_defs); rolAuthTable = new YourTeam.JqDataTables.getTableByAjax(ajaxObj, tag, null, columns, column_defs);
} }
function loadAuthPageTable() {
let ajaxObj = {
url: baseApiUrl + "/User/AuthPageList",
method: "POST"
}
let tag = "#accAuthPageTable";
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": 'authCode',
"render": function (data, type, row, meta) {
return `<td><input id='${data}' type="checkbox"></td>`
}
},
{
"title": "編號",
"data": null,
"render": function (data, type, row, meta) {
return meta.row + 1;
}
},
{
"title": "功能名稱",
"data": "subName",
}
];
accAuthPageTable = new YourTeam.JqDataTables.getTableByAjax(ajaxObj, tag, null, columns, column_defs);
}
function getRoleSel() { function getRoleSel() {
let url = baseApiUrl + "/User/RoleManagerList"; let url = baseApiUrl + "/User/RoleManagerList";
@ -529,11 +546,14 @@
if (!res || res.code != "0000" || !res.data) { if (!res || res.code != "0000" || !res.data) {
} else { } else {
$("#roleSel").html(); $("#roleSel").html('');
$("#selRolAuth").html(); $("#selRolAuth").html('');
$.each(res.data, (index, roleObj) => { $.each(res.data, (index, roleObj) => {
$("#roleSel").append(creOption(roleObj.full_name, roleObj.role_guid)); $("#roleSel").append(creOption(roleObj.full_name, roleObj.role_guid));
$("#selRolAuth").append(creOption(roleObj.full_name, roleObj.role_guid)); $("#selRolAuth").append(creOption(roleObj.full_name, roleObj.role_guid));
if (index == 0)
pageAct.selRolAuth = roleObj.role_guid
}) })
} }
}, null, "POST").send(); }, null, "POST").send();
@ -573,8 +593,9 @@
}, null, "POST").send(); }, null, "POST").send();
} }
}); });
onEvent("click", "[data-target*=delModal]", function () {
pageAct.accManId = $(this).prop('id').split('Btn')[1] onEvent("click", "[id*=accManDelBtn]", function () {
pageAct.accManId = $(this).prop('id').split('Btn')[1];
}); });
onEvent("click", "#accManSendBtn", function () { onEvent("click", "#accManSendBtn", function () {
@ -622,28 +643,42 @@
pageAct.accRolName = $(this).val() || null; pageAct.accRolName = $(this).val() || null;
}); });
onEvent("click", "#acc_searchBtn", function () { onEvent("change", "#seaRolName", function () {
pageAct.rolName = $(this).val() || null;
});
onEvent("click", "#acc_searchBtn, #rol_searchBtn", function () {
let acc_table = $('div.tab-pane.fade.show.active').data('id'); let acc_table = $('div.tab-pane.fade.show.active').data('id');
if (acc_table == "accMan") if (acc_table == "accMan")
loadAccManTable(); loadAccManTable();
else if (acc_table == "rolMan") else if (acc_table == "rolMan")
loadRolManTable(); loadRolManTable();
else if (acc_table == "rolAuth") else if (acc_table == "rolAuth") {
loadRolAuthTable(); loadRolAuthTable();
setAuthPage();
}
}); });
onEvent("change", ".tab-pane.fade", function () { onEvent("click", "li.nav-item", function () {
console.log('aaa'); pageAct.rolManId = null;
pageAct.accManId = null;
$('#roleSel').html('');
$("#selRolAuth").html('');
getRoleSel();
}); });
onEvent("click", "#confirmDelBtn", function () { onEvent("click", "#confirmDelBtn", function () {
let url = baseApiUrl + "/User/DeleteOneUser"; let url = baseApiUrl + "/User/" + (pageAct.accManId != null ? "DeleteOneUser" : (pageAct.rolManId != null ? "DeleteOneRole" : (pageAct.authUsrId != null ? "DeleteOneRoleAuth" : null)));
let sendData = { let sendData = {
Id: pageAct.accManId, Id: pageAct.accManId ?? pageAct.rolManId ?? pageAct.authUsrId,
}; };
if (pageAct.authUsrId != null)
sendData.AuthCode = pageAct.authCode;
objSendData.Data = sendData; objSendData.Data = sendData;
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) { ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
if (!res || res.code != "0000" || !res.msg) { if (!res || res.code != "0000" || !res.msg) {
@ -651,16 +686,116 @@
toast_ok(common.DelSuc); toast_ok(common.DelSuc);
//$("#accManModal").modal("hide"); //$("#accManModal").modal("hide");
$("#closeDelBtn").click(); $("#closeDelBtn").click();
if (pageAct.accManId) {
pageAct.accManId = null; pageAct.accManId = null;
loadAccManTable(); loadAccManTable();
} }
else if (pageAct.rolManId) {
pageAct.rolManId = null;
loadRolManTable();
}
else if (pageAct.authUsrId) {
pageAct.authUsrId = null;
pageAct.authCode = null;
loadRolAuthTable();
setAuthPage();
}
}
}, null, "POST").send(); }, null, "POST").send();
}) })
onEvent("click", "[id*=rolManEdiBtn]", function () {
pageAct.rolManId = $(this).data('id');
$('#groupName').val($(this).data('name'));
})
onEvent("click", "[id*=rolManDelBtn]", function () {
pageAct.rolManId = $(this).data('id');
})
onEvent("click", "#accRolSavBtn", function () {
let url = baseApiUrl + "/User/SaveRole";
let sendData = {
Name: $('#groupName').val(),
};
sendData.Id = pageAct.rolManId ?? "0";
objSendData.Data = sendData;
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
if (!res || res.code != "0000" || !res.msg) {
} else {
toast_ok(common.DelSuc);
//$("#groupModal").modal("hide");
$('#accRolCanBtn').click();
pageAct.rolManId = null;
loadRolManTable();
}
}, 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');
});
onEvent("click", "#authPageSavBtn", function () {
pageAct.authCode = [];
pageAct.authCode = $(`#accAuthPageTable input[type=checkbox]:checked:not(:disabled)`).map(function (i, v) { return $(v).prop('id').toString(); }).toArray();
let url = baseApiUrl + "/User/SaveRoleAuth";
let sendData = {
SelectedRoleId: $('#roleSel option:selected').val(),
SaveCheckAuth: pageAct.authCode,
};
objSendData.Data = sendData;
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
if (!res || res.code != "0000" || !res.msg) {
} else {
toast_ok(common.EditSuc);
$("#authPageModal").modal("hide");
pageAct.authCode = [];
loadRolAuthTable();
setAuthPage();
}
}, null, "POST").send();
});
} }
function clearPagSes() { function clearPagSes() {
pageAct.accManId = null; pageAct.accManId = null;
pageAct.accManName = null; pageAct.accManName = null;
pageAct.accRolName = null; pageAct.accRolName = null;
pageAct.rolName = null;
pageAct.rolManId = null;
pageAct.selRolAuth = null;
pageAct.authCode = [];
}
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();
});
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}]`).attr('disabled', true);
});
} }
</script> </script>

View File

@ -295,6 +295,7 @@
selUser(); selUser();
selDevice(); selDevice();
selOpeFir(); selOpeFir();
getUser();
$('#inpFixDoCode option[data-sub=' + alr_tableData.alarmClass.toString().split('_')[1] + '][data-main=' + alr_tableData.alarmClass.toString().split('_')[0] + ']').attr('hidden', false); $('#inpFixDoCode option[data-sub=' + alr_tableData.alarmClass.toString().split('_')[1] + '][data-main=' + alr_tableData.alarmClass.toString().split('_')[0] + ']').attr('hidden', false);
$('#inpFixDoCode option[data-sub!=' + alr_tableData.alarmClass.toString().split('_')[1] + '][data-main!=' + alr_tableData.alarmClass.toString().split('_')[0] + ']').attr('hidden', true); $('#inpFixDoCode option[data-sub!=' + alr_tableData.alarmClass.toString().split('_')[1] + '][data-main!=' + alr_tableData.alarmClass.toString().split('_')[0] + ']').attr('hidden', true);
@ -727,4 +728,14 @@
} }
}); });
} }
function getUser() {
ytAjax = new YourTeam.Ajax(baseApiUrl + "/api/getUser", null, function (res) {
if (!res || res.code != "0000" || !res.data) {
} else {
$(pageAct.work_type == '1' ? '#inpWorPerId' : '#inpWorPerId_2').val(res.data);
}
}, null, "POST").send();
}
</script> </script>

View File

@ -1129,6 +1129,7 @@
}); });
onEvent('click', '#opeFirmEdiBtn', function () { onEvent('click', '#opeFirmEdiBtn', function () {
selSysMain();
$('#opeFirmTitle').html('編輯廠商資料'); $('#opeFirmTitle').html('編輯廠商資料');
let url = baseApiUrl + "/operation/OpeFirRead"; let url = baseApiUrl + "/operation/OpeFirRead";
pageAct.opeFirmId = $(this).parent().data('id') pageAct.opeFirmId = $(this).parent().data('id')

View File

@ -2,6 +2,7 @@
using FrontendWebApi.Models; using FrontendWebApi.Models;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using Repository.BackendRepository.Interface; using Repository.BackendRepository.Interface;
@ -9,6 +10,7 @@ using Repository.BaseRepository.Interface;
using Repository.FrontendRepository.Interface; using Repository.FrontendRepository.Interface;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data.SqlTypes;
using System.IdentityModel.Tokens.Jwt; using System.IdentityModel.Tokens.Jwt;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
@ -90,21 +92,26 @@ namespace FrontendWebApi.ApiControllers
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public async Task<ApiResult<List<RoleManagerList>>> RoleManagerList(int post) //是否判斷layer 0:否 1:是 public async Task<ApiResult<List<RoleManagerList>>> RoleManagerList([FromBody] RoleManagerList post) //是否判斷layer 0:否 1:是
{ {
ApiResult<List<RoleManagerList>> apiResult = new ApiResult<List<RoleManagerList>>(); ApiResult<List<RoleManagerList>> apiResult = new ApiResult<List<RoleManagerList>>();
List<RoleManagerList> roleList = new List<RoleManagerList>(); List<RoleManagerList> roleList = new List<RoleManagerList>();
try try
{ {
var layersql = ""; var whereSql = "";
if (post == 1) if (post.Layer == 1)
{ {
layersql = "and A.layer = 1 "; whereSql += " and A.layer = 1 ";
}
if (post.Full_name != null)
{
whereSql += $@" and A.full_name like '%{post.Full_name}%'";
} }
var sqlString = @$"SELECT * var sqlString = @$"SELECT *
FROM role A FROM role A
WHERE A.deleted = 0 {layersql} WHERE A.deleted = 0 {whereSql}
ORDER BY A.created_at DESC"; ORDER BY A.created_at DESC";
roleList = await backendRepository.GetAllAsync<RoleManagerList>(sqlString); roleList = await backendRepository.GetAllAsync<RoleManagerList>(sqlString);
@ -505,7 +512,7 @@ namespace FrontendWebApi.ApiControllers
INNER JOIN auth_page C ON A.AuthCode=C.AuthCode INNER JOIN auth_page C ON A.AuthCode=C.AuthCode
LEFT JOIN building D ON C.building_tag=D.building_tag AND D.deleted=0 LEFT JOIN building D ON C.building_tag=D.building_tag AND D.deleted=0
WHERE A.role_guid='{post.SelectedRoleId}' WHERE A.role_guid='{post.SelectedRoleId}'
ORDER BY A.created_at DESC"; ORDER BY A.AuthCode ASC";
roleAuthList = await backendRepository.GetAllAsync<RoleAuthList>(sqlString); roleAuthList = await backendRepository.GetAllAsync<RoleAuthList>(sqlString);
apiResult.Code = "0000"; apiResult.Code = "0000";
@ -638,7 +645,7 @@ namespace FrontendWebApi.ApiControllers
try try
{ {
roleManager = await backendRepository.GetOneAsync<RoleManagerList>("role", $"role_guid='{post.RoleId}'"); roleManager = await backendRepository.GetOneAsync<RoleManagerList>("role", $"role_guid='{post.Id}'");
if (roleManager == null) if (roleManager == null)
{ {
@ -647,7 +654,7 @@ namespace FrontendWebApi.ApiControllers
return apiResult; return apiResult;
} }
await backendRepository.PurgeOneByGuidWithCustomDBNameAndTable("role_auth", $"role_guid='{post.RoleId}' AND AuthCode='{post.AuthCode}'"); await backendRepository.PurgeOneByGuidWithCustomDBNameAndTable("role_auth", $"role_guid='{post.Id}' AND AuthCode='{post.AuthCode}'");
apiResult.Code = "0000"; apiResult.Code = "0000";
apiResult.Msg = "刪除成功"; apiResult.Msg = "刪除成功";
@ -665,6 +672,34 @@ namespace FrontendWebApi.ApiControllers
return apiResult; return apiResult;
} }
/// <summary>
/// 前台頁面列表
/// </summary>
/// <param name="post"></param>
/// <returns></returns>
[HttpPost]
public async Task<ApiResult<List<AuthPage>>> AuthPageList()
{
ApiResult<List<AuthPage>> apiResult = new ApiResult<List<AuthPage>>();
List<AuthPage> authPage = new List<AuthPage>();
try
{
var sqlString = $@"select * from auth_page where AuthCode like 'FL%' order by AuthCode";
authPage = await backendRepository.GetAllAsync<AuthPage>(sqlString);
apiResult.Code = "0000";
apiResult.Data = authPage;
}
catch (Exception exception)
{
apiResult.Code = "9999";
apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
}
return apiResult;
}
[HttpPost] [HttpPost]
[Route("api/getUser")] [Route("api/getUser")]
public ActionResult GetUser() public ActionResult GetUser()

View File

@ -151,7 +151,7 @@ namespace FrontendWebApi.Models
public class PostDeleteRoleAuth public class PostDeleteRoleAuth
{ {
public string RoleId { get; set; } public string Id { get; set; }
public string AuthCode { get; set; } public string AuthCode { get; set; }
} }
@ -167,6 +167,7 @@ namespace FrontendWebApi.Models
public string MainName { get; set; } public string MainName { get; set; }
public string SubName { get; set; } public string SubName { get; set; }
public string building_guid { get; set; } public string building_guid { get; set; }
public string building_tag { get; set; }
public string ShowView { get; set; } public string ShowView { get; set; }
public string created_at { get; set; } public string created_at { get; set; }
} }

View File

@ -22,7 +22,8 @@
"MySqlDBConfig": { "MySqlDBConfig": {
"Server": "FYlY+w0XDIz+jmF2rlZWJw==", //0.201 "Server": "FYlY+w0XDIz+jmF2rlZWJw==", //0.201
"Port": "js2LutKe+rdjzdxMPQUrvQ==", "Port": "js2LutKe+rdjzdxMPQUrvQ==",
"Database": "VJB2XC+lAtzuHObDGMVOAA==", //30 "Database": "VJB2XC+lAtzuHObDGMVOAA==", //
//"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp
"Root": "SzdxEgaJJ7tcTCrUl2zKsA==", "Root": "SzdxEgaJJ7tcTCrUl2zKsA==",
"Password": "FVAPxztxpY4gJJKQ/se4bQ==" "Password": "FVAPxztxpY4gJJKQ/se4bQ=="
}, },

View File

@ -62,7 +62,7 @@ namespace Repository.Helper
var passwordStr = ed.AESDecrypt(_mySqlDBConfig.Password); // var passwordStr = ed.AESDecrypt(_mySqlDBConfig.Password); //
//var serverStr = ed.AESEncrypt("192.168.0.201"); //192.168.0.201 //var serverStr = ed.AESEncrypt("192.168.0.201"); //192.168.0.201
//var portStr = ed.AESEncrypt("33306"); // 33306 //var portStr = ed.AESEncrypt("33306"); // 33306
//var databaseStr = ed.AESEncrypt("bims_mitsubishi"); // bims_mitsubishi //var databaseStr = ed.AESEncrypt("bims_mitsubishi"); // bims_wsp: IgYBsgG2VLKKxFb64j7LOA== ; bims_mitsubishi
//var rootStr = ed.AESEncrypt("bims"); // bims //var rootStr = ed.AESEncrypt("bims"); // bims
//var passwordStr = ed.AESEncrypt("mjmdev_BIMS2022"); // mjmdev_BIMS2022 //var passwordStr = ed.AESEncrypt("mjmdev_BIMS2022"); // mjmdev_BIMS2022
var connStr = $"server={serverStr};port={portStr};database={databaseStr};user={rootStr};password={passwordStr};charset=utf8;Allow User Variables=True;"; var connStr = $"server={serverStr};port={portStr};database={databaseStr};user={rootStr};password={passwordStr};charset=utf8;Allow User Variables=True;";

View File

@ -9,7 +9,7 @@
connectionString="Data Source=192.168.0.201:33306;Initial Catalog=bims_mitsubishi;Persist Security Info=True;User ID=bims;Password=mjmdev_BIMS2022" connectionString="Data Source=192.168.0.201:33306;Initial Catalog=bims_mitsubishi;Persist Security Info=True;User ID=bims;Password=mjmdev_BIMS2022"
providerName="MySql.Data.MySqlClient" />--> providerName="MySql.Data.MySqlClient" />-->
<add name="dbConStr" connectionString="server=192.168.0.201;user=bims;Database=bims_mitsubishi;Port=33306;password=mjmdev_BIMS2022;charset='utf8';pooling=true;sslmode=none;;Connection Timeout=6000" providerName="MySql.Data.MySqlClient" /> <add name="dbConStr" connectionString="server=192.168.0.201;user=bims;Database=bims_wsp;Port=33306;password=mjmdev_BIMS2022;charset='utf8';pooling=true;sslmode=none;;Connection Timeout=6000" providerName="MySql.Data.MySqlClient" />
</connectionStrings> </connectionStrings>
</configuration> </configuration>

View File

@ -149,24 +149,24 @@ namespace tpDomeWinAPP.Service
String encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(username + ":" + password)); String encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(username + ":" + password));
String API_Url = urlString; String API_Url = urlString;
//HttpWebRequest Postrequest = (HttpWebRequest)WebRequest.Create(API_Url); HttpWebRequest Postrequest = (HttpWebRequest)WebRequest.Create(API_Url);
//Postrequest.Method = "POST"; Postrequest.Method = "POST";
//Postrequest.Headers.Add("Authorization", "Basic " + encoded); Postrequest.Headers.Add("Authorization", "Basic " + encoded);
//Postrequest.PreAuthenticate = true; Postrequest.PreAuthenticate = true;
//using (var streamWriter = new StreamWriter(Postrequest.GetRequestStream())) using (var streamWriter = new StreamWriter(Postrequest.GetRequestStream()))
//{ {
// string json = "<str val='" + bql + "'/>"; string json = "<str val='" + bql + "'/>";
// streamWriter.Write(json); streamWriter.Write(json);
//} }
//HttpWebResponse response = (HttpWebResponse)Postrequest.GetResponse(); HttpWebResponse response = (HttpWebResponse)Postrequest.GetResponse();
//var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd(); var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
XmlDocument xmlDoc = new XmlDocument(); XmlDocument xmlDoc = new XmlDocument();
//xmlDoc.LoadXml(responseString); xmlDoc.LoadXml(responseString);
xmlDoc.Load("N4v1021.xml");//N4v1021 //xmlDoc.Load("N4v1021.xml");//N4v1021
//xmlDoc.Save("N4.xml"); //xmlDoc.Save("N4.xml");

View File

@ -166,8 +166,11 @@ namespace tpDomeWinAPP
if (tabControl1.SelectedIndex == 0) if (tabControl1.SelectedIndex == 0)
{ {
webRequestSvc svc = new webRequestSvc(); webRequestSvc svc = new webRequestSvc();
string bql = url_slot + "bql:select " + top100 + " * from control:ControlPoint "; string url_slot2 = "slot:/NTPC/B1|";//wsp
ds = svc.obixQuery("http://60.251.164.125:8080/obix/config/Arena/Program/ObixQuery/query/", bql); string bql = url_slot2 + "bql:select " + top100 + " * from control:ControlPoint ";//三菱: url_slot; wsp: url_slot2
//ds = svc.obixQuery("http://60.251.164.125:8080/obix/config/Arena/Program/ObixQuery/query/", bql);
//ds = svc.obixQuery("http://192.168.0.136:8080/obix/config/Program/ObixQuery/query/", bql);//三菱
ds = svc.obixQuery("http://192.168.0.136:8081/obix/config/Program/ObixQuery/query/", bql);//wsp
//ds = svc.obixQuery("http://localhost:8080/obix/config/Program/ObixQuery/query/", bql); //ds = svc.obixQuery("http://localhost:8080/obix/config/Program/ObixQuery/query/", bql);
dataGridView1.DataSource = ds; dataGridView1.DataSource = ds;
dataGridView1.Columns[0].Visible = false; dataGridView1.Columns[0].Visible = false;