-
-
-
- 類別代號
- 類別名稱
- 存取權限
-
-
-
-
- 0220100010
- 電錶
-
-
-
- 啟用
-
-
-
-
- 0220100010
- 照明設備
-
-
-
- 啟用
-
-
-
-
- 0220100010
- 環境感測
-
-
-
- 啟用
-
-
-
-
+
@@ -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();
+ }