From 94714af765326bc0567a336952b0811667b7be92 Mon Sep 17 00:00:00 2001
From: lyfO_o <764716047@qq.com>
Date: 星期三, 27 十月 2021 16:59:27 +0800
Subject: [PATCH] 货柜预警接口:alarm 字典:alarm_type 01 主电掉电,备电工作 显示:名称+地点+柜号+内容
---
src/main/java/com/nanometer/smartlab/controller/RoleMngController.java | 106 +++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 94 insertions(+), 12 deletions(-)
diff --git a/src/main/java/com/nanometer/smartlab/controller/RoleMngController.java b/src/main/java/com/nanometer/smartlab/controller/RoleMngController.java
index 46cc2e2..a19fb88 100644
--- a/src/main/java/com/nanometer/smartlab/controller/RoleMngController.java
+++ b/src/main/java/com/nanometer/smartlab/controller/RoleMngController.java
@@ -14,6 +14,7 @@
import org.springframework.stereotype.Controller;
import javax.annotation.Resource;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -61,6 +62,34 @@
RequestContext.getCurrentInstance().execute("PF('dialog').show()");
}
+ public void btnPermissionClick() {
+ if (this.selectedList == null
+ || this.selectedList.size() == 0) {
+ FacesUtils.warn("请选择数据。");
+ return;
+ }
+ if (this.selectedList.size() > 1) {
+ FacesUtils.warn("只能选择一个数据进行修改。");
+ return;
+ }
+ this.baseRole = this.baseRoleService.getBaseRole(this.selectedList.get(0).getId());
+ RequestContext.getCurrentInstance().execute("PF('btnDialog').show()");
+ }
+
+ public void userPermissionClick() {
+ if (this.selectedList == null
+ || this.selectedList.size() == 0) {
+ FacesUtils.warn("请选择数据。");
+ return;
+ }
+ if (this.selectedList.size() > 1) {
+ FacesUtils.warn("只能选择一个数据进行修改。");
+ return;
+ }
+ this.baseRole = this.baseRoleService.getBaseRole(this.selectedList.get(0).getId());
+ RequestContext.getCurrentInstance().execute("PF('userDialog').show()");
+ }
+
public void onSaveBtnClick() {
try {
// 新建
@@ -79,7 +108,8 @@
FacesUtils.warn("请选择角色权限。");
return;
}
-
+ baseRole.setUserPermission("自己");
+ baseRole.setBtnPermission("新增,修改,删除,导入");
this.baseRoleService.insertBaseRole(this.baseRole);
FacesUtils.info("新建成功。");
@@ -106,6 +136,57 @@
FacesUtils.info("修改成功。");
RequestContext.getCurrentInstance().execute("PF('dialog').hide()");
}
+ } catch (Exception e) {
+ logger.error("操作失败。", e);
+ FacesUtils.warn("操作失败。");
+ }
+ }
+ /**
+ * 人员管理按钮权限修改
+ */
+ public void onSaveBtnPermission() {
+ try {
+ if (this.baseRole == null) {
+ FacesUtils.warn("修改对象为空。");
+ return;
+ }
+
+
+ if (this.baseRole.getBtnPermissions() == null || this.baseRole.getBtnPermissions().size() == 0) {
+ FacesUtils.warn("请选择功能。");
+ return;
+ }
+
+ this.baseRoleService.updateUserMngPageBtn(this.baseRole);
+
+ FacesUtils.info("修改成功。");
+ RequestContext.getCurrentInstance().execute("PF('btnDialog').hide()");
+ } catch (Exception e) {
+ logger.error("操作失败。", e);
+ FacesUtils.warn("操作失败。");
+ }
+ }
+
+ /**
+ * 人员管理人员可见权限修改
+ */
+ public void onSaveUserPermission() {
+ try {
+ if (this.baseRole == null) {
+ FacesUtils.warn("修改对象为空。");
+ return;
+ }
+
+
+ if (this.baseRole.getUserPermission() == null) {
+ FacesUtils.warn("请选择可见范围。");
+ return;
+ }
+
+ this.baseRoleService.updateUserMngPageBtn(this.baseRole);
+
+ FacesUtils.info("修改成功。");
+ RequestContext.getCurrentInstance().execute("PF('userDialog').hide()");
} catch (Exception e) {
logger.error("操作失败。", e);
FacesUtils.warn("操作失败。");
@@ -141,6 +222,7 @@
if (count > 0) {
list = baseRoleService.getBaseRoleList(null, null, first, pageSize);
}
+ selectedList = new ArrayList<>();
} catch (Exception e) {
logger.error(e);
}
@@ -149,17 +231,17 @@
@Override
public BaseRole getRowData(String rowKey) {
- Iterator<BaseRole> iterator = this.iterator();
- if (iterator != null) {
- BaseRole br = null;
- while (iterator.hasNext()) {
- br = iterator.next();
- if (rowKey.equals(br.getId())) {
- return br;
- }
- }
- }
- return null;
+// Iterator<BaseRole> iterator = this.iterator();
+// if (iterator != null) {
+// BaseRole br = null;
+// while (iterator.hasNext()) {
+// br = iterator.next();
+// if (rowKey.equals(br.getId())) {
+// return br;
+// }
+// }
+// }
+ return baseRoleService.getBaseRole(rowKey);
}
};
}
--
Gitblit v1.9.2