提交 26d429c7 编写于 作者: laizhilong's avatar laizhilong

菜单分配及权限分配树多选,一起生成角色权限关系

上级 d358d064
......@@ -32,7 +32,7 @@
line-height: 1.6;
font-weight: bold;
word-spacing: 10px;
height: 100%;
//height: 100%;
overflow: auto;
}
.mpicker-select > div {
......@@ -58,7 +58,7 @@
width: calc(100% - 380px);
.pickupviewpanel {
width: 100%;
height: 100%;
//height: 100%;
}
}
}
......@@ -106,7 +106,7 @@
margin-top:30px;margin-bottom:20px;margin-left:40px;
}
.roll{
height:680px;overflow:hidden;overflow-x: hidden;overflow-y: auto;
height:590px;overflow:hidden;overflow-x: hidden;overflow-y: auto;
}
.tre{
margin-left:20px;
......
......@@ -4,7 +4,7 @@
<div class="content-container pickup-view">
<div class="translate-contant">
<!--菜单分配-->
<div class="center" :style="{width : '50%' }">
<div class="center" :style="{width : '50%',border:'0px solid red' }">
<context-menu-container class='design-tree-container' >
<div >
<div class="text">菜单分配</div>
......@@ -26,7 +26,7 @@
</context-menu-container>
</div>
<!--权限分配-->
<div class="center" :style="{width : '50%' }">
<div class="center" :style="{width : '50%',border:'0px solid red' }">
<context-menu-container class='design-tree-container' >
<div >
<div class="text">权限分配</div>
......@@ -48,15 +48,17 @@
</context-menu-container>
</div>
</div>
<div>
<!--操作按钮-->
<card :dis-hover="true" :bordered="false" class="footer">
<row :style="{ textAlign: 'right' }">
<row :style="{ textAlign: 'right',border:'0px solid red' }">
<i-button type="primary" :disabled="this.selectData.length > 0 ? false : true" @click="onClickOk">{{this.containerModel.view_okbtn.text}}</i-button>
&nbsp;&nbsp;
<i-button @click="onClickCancel">{{this.containerModel.view_cancelbtn.text}}</i-button>
</row>
</card>
</div>
</div>
</card>
</div>
</template>
......@@ -127,7 +129,7 @@
}
if(_this.parentData && _this.parentData.srfparentkey){
_this.srfparentkey = _this.parentData.srfparentkey;
console.log("父主键:" + _this.srfparentkey);
// console.log("父主键:" + _this.srfparentkey);
}
}
......@@ -153,15 +155,20 @@
// 给树赋值,数据结构在后台已经按照eltree格式化
_this.CDdata = response.data[0];
_this.QXdata = response.data[1];
console.log(this.CDdata)
// 树视图默认展开一级节点
if (_this.CDdata && _this.CDdata.length>0){
_this.CDdata.forEach((item:any, index:any)=> {
if (item[index].id){
_this.CDdataexpandedKeys.push(item[index].id);
}
})
}
if (_this.QXdata && _this.QXdata.length>0){
_this.QXdata.forEach((item:any, index:any)=> {
if (item[index].id){
_this.QXdataexpandedKeys.push(item[index]);
}
})
}
}
......@@ -180,8 +187,8 @@
const QXtree: any = this.$refs.QXtree;
// 获取选中状态的节点
const arr = CDtree.getCheckedNodes().concat(QXtree.getCheckedNodes());
// console.group("选中的node:" + arr);
this.selectData = arr;
console.log("选中的node:" + arr);
}
/**
......@@ -201,6 +208,16 @@
this.selectData.forEach((item: any) => {
let _itemTemp: any = JSON.parse(JSON.stringify(item));
let _item:any = {};
if (_itemTemp.sys_permissionId) {// 一级菜单
_item.srfdataaccaction = _itemTemp.sys_permissionId;
_item.srfkey = _itemTemp.sys_permissionId;
_item.sys_permission = _itemTemp.sys_permissionId;
_item.sys_permissionid = _itemTemp.sys_permissionId;
_item.srfmajortext = _itemTemp.label;
_item.sys_permissionname = _itemTemp.label;
Object.assign(_item, { _select: false })
this.viewSelections.push(_item);
}else{
if(!_itemTemp.children){// 是末节点则为库中存在的权限数据,添加到viewSelections
_item.srfdataaccaction = _itemTemp.id;
_item.srfkey = _itemTemp.id;
......@@ -211,6 +228,7 @@
Object.assign(_item, { _select: false })
this.viewSelections.push(_item);
}
}
});
}
......
......@@ -2,6 +2,7 @@ package cn.ibizlab.core.extensions.service;
import cn.ibizlab.core.uaa.service.ISYS_PERMISSIONService;
import cn.ibizlab.core.uaa.service.ISYS_PSAPPMENUITEMService;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
......@@ -20,7 +21,8 @@ import java.util.Set;
public class UAACoreService {
@Autowired
private ISYS_PERMISSIONService isys_permissionService;
@Autowired
private ISYS_PSAPPMENUITEMService isys_psappmenuitemService;
/**
* 获取用户菜单
*
......@@ -35,8 +37,10 @@ public class UAACoreService {
nPermissionSQL.append("SELECT ");
nPermissionSQL.append(" t.SYS_PERMISSIONID as sys_permissionid, ");
nPermissionSQL.append(" t.SYS_PERMISSIONNAME as sys_permissionname, ");
nPermissionSQL.append(" t1.PERMISSIONID as permissionid, ");
nPermissionSQL.append(" t1.P_PERMISSIONID as p_permissionid, ");
// nPermissionSQL.append(" t1.PERMISSIONID as permissionid, ");
nPermissionSQL.append(" t1.PSAPPMENUITEMID as permissionid, ");
// nPermissionSQL.append(" t1.P_PERMISSIONID as p_permissionid, ");
nPermissionSQL.append(" t1.PSAPPPMENUITEMID as p_permissionid, ");
nPermissionSQL.append(" t1.PSAPPID as psappid, ");
nPermissionSQL.append(" t1.PSAPPNAME as psappname, ");
nPermissionSQL.append(" t1.PSAPPMENUID as psappmenuid, ");
......@@ -49,8 +53,10 @@ public class UAACoreService {
permissionSQL.append("SELECT ");
permissionSQL.append(" t.SYS_PERMISSIONID as sys_permissionid,");
permissionSQL.append(" t.SYS_PERMISSIONNAME as sys_permissionname,");
permissionSQL.append(" t1.PERMISSIONID as permissionid,");
permissionSQL.append(" t1.P_PERMISSIONID as p_permissionid,");
// permissionSQL.append(" t1.PERMISSIONID as permissionid, ");
permissionSQL.append(" t1.PSAPPMENUITEMID as psappmenuitemid, ");
// permissionSQL.append(" t1.P_PERMISSIONID as p_permissionid, ");
permissionSQL.append(" t1.PSAPPPMENUITEMID as psapppmenuitemid, ");
permissionSQL.append(" t1.PSAPPID as psappid,");
permissionSQL.append(" t1.PSAPPNAME as psappname,");
permissionSQL.append(" t1.PSAPPMENUID as psappmenuid,");
......@@ -62,9 +68,9 @@ public class UAACoreService {
List<JSONObject> permissions;
if (StringUtils.isEmpty(systemid)) {
permissions = isys_permissionService.select(nPermissionSQL.toString(),null);
permissions = isys_psappmenuitemService.select(nPermissionSQL.toString(),null);
} else {
permissions = isys_permissionService.select(permissionSQL.toString(),null);
permissions = isys_psappmenuitemService.select(permissionSQL.toString(),null);
}
JSONArray treeNode = new JSONArray();
......@@ -105,11 +111,14 @@ public class UAACoreService {
String str_appMenuName = String.format("%s", obj.get("psappmenuname"));
String systemId = String.format("%s", obj.get("systemid"));
String sys_permissionId = DigestUtils.md5DigestAsHex(String.format("%s%s", systemId, obj.get("permissionid")).getBytes());
// String sys_permissionId = DigestUtils.md5DigestAsHex(String.format("%s%s", systemId, obj.get("permissionid")).getBytes());
String permissionId = String.format("%s", obj.get("permissionid"));
String sys_permissionId = String.format("%s", obj.get("sys_permissionid"));
String p_sys_permissionId = "";
if (!StringUtils.isEmpty(obj.get("p_permissionid"))) {
p_sys_permissionId = DigestUtils.md5DigestAsHex(String.format("%s%s", systemId, obj.get("p_permissionid")).getBytes());
// p_sys_permissionId = DigestUtils.md5DigestAsHex(String.format("%s%s", systemId, obj.get("p_permissionid")).getBytes());
p_sys_permissionId = String.format("%s",obj.get("p_permissionid"));
}
JSONObject cur_app = new JSONObject();
......@@ -122,7 +131,8 @@ public class UAACoreService {
cur_app_menu = cur_app.getJSONArray(str_appMenu);
JSONObject permission = new JSONObject();
permission.put("id", sys_permissionId);
permission.put("id", permissionId);
permission.put("sys_permissionId", sys_permissionId);
permission.put("pid", p_sys_permissionId);
permission.put("label", obj.get("sys_permissionname"));
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册