Commit 2c334d6c authored by 李家智's avatar 李家智
Browse files

role test

parent af7608e0
...@@ -14,7 +14,7 @@ public class RoleQuery extends PageParam { ...@@ -14,7 +14,7 @@ public class RoleQuery extends PageParam {
@Query(name = "名称", display = true) @Query(name = "名称", display = true)
private String name; private String name;
@Query(name = "业务角色类型", type = Query.TYPE_DICT,dict=CoreDictType.ROLE_TYPE) @Query(name = "业务角色类型", type = Query.TYPE_DICT,dict=CoreDictType.ROLE_TYPE)
private Integer type; private String type;
public String getCode() { public String getCode() {
...@@ -33,13 +33,15 @@ public class RoleQuery extends PageParam { ...@@ -33,13 +33,15 @@ public class RoleQuery extends PageParam {
this.name = name; this.name = name;
} }
public Integer getType() { public String getType() {
return type; return type;
} }
public void setType(Integer type) { public void setType(String type) {
this.type = type; this.type = type;
} }
} }
...@@ -8,7 +8,7 @@ layui.define([ 'form', 'laydate', 'table','roleApi'], function(exports) { ...@@ -8,7 +8,7 @@ layui.define([ 'form', 'laydate', 'table','roleApi'], function(exports) {
this.initSubmit(); this.initSubmit();
}, },
initSubmit:function(){ initSubmit:function(){
$("#addButton").click(function(){ $("#addButton").click($("#addForm"),function(){
roleApi.addRole(function(){ roleApi.addRole(function(){
parent.window.dataReload(); parent.window.dataReload();
Common.info("添加成功"); Common.info("添加成功");
......
...@@ -8,8 +8,8 @@ layui.define([ 'form', 'laydate', 'table','roleApi'], function(exports) { ...@@ -8,8 +8,8 @@ layui.define([ 'form', 'laydate', 'table','roleApi'], function(exports) {
this.initSubmit(); this.initSubmit();
}, },
initSubmit:function(){ initSubmit:function(){
$("#addButton").click(function(){ $("#updateButton").click(function(){
roleApi.updateRole(function(){ roleApi.updateRole($("#updateForm"),function(){
parent.window.dataReload(); parent.window.dataReload();
Common.info("更新成功"); Common.info("更新成功");
Lib.closeFrame(); Lib.closeFrame();
...@@ -18,7 +18,7 @@ layui.define([ 'form', 'laydate', 'table','roleApi'], function(exports) { ...@@ -18,7 +18,7 @@ layui.define([ 'form', 'laydate', 'table','roleApi'], function(exports) {
}); });
$("#addButton-cancel").click(function(){ $("#updateButton-cancel").click(function(){
Lib.closeFrame(); Lib.closeFrame();
}); });
} }
......
...@@ -21,7 +21,7 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) { ...@@ -21,7 +21,7 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) {
height : 'full-280', height : 'full-280',
method : 'post', method : 'post',
url : Common.CTX + '/admin/role/list.json' //数据接口 url : Common.CTX + '/admin/role/list.json' //数据接口
,page : {"layout":['count','prev', 'page', 'next']} //开启分页 ,page : Lib.tablePage //开启分页
,limit : 10, ,limit : 10,
cols : [ [ //表头 cols : [ [ //表头
{ {
......
/*访问后台的代码*/ /*访问后台的代码*/
layui.define([], function(exports) { layui.define([], function(exports) {
var api={ var api={
updateRole:function(callback){ updateRole:function(form,callback){
Lib.submitForm($('#updateForm'),{},callback) Lib.submitForm("/admin/role/update.json",form,{},callback)
}, },
addRole:function(callback){ addRole:function(form,callback){
Lib.submitForm($('#addForm'),{},callback) Lib.submitForm("/admin/role/add.json",form,{},callback)
}, },
del:function(ids,callback){ del:function(ids,callback){
Common.post("/admin/role/delete.json",{"ids":ids},function(){ Common.post("/admin/role/delete.json",{"ids":ids},function(){
......
...@@ -56,7 +56,6 @@ layui.define([ 'form', 'laydate', 'table','roleApi'], function(exports) { ...@@ -56,7 +56,6 @@ layui.define([ 'form', 'laydate', 'table','roleApi'], function(exports) {
roleApi.queryFunctionByRole(roleId,function(fnIds){ roleApi.queryFunctionByRole(roleId,function(fnIds){
for(var i=0;i<fnIds.length;i++){ for(var i=0;i<fnIds.length;i++){
var node = zTreeObj.getNodesByParam("id",fnIds[i]); var node = zTreeObj.getNodesByParam("id",fnIds[i]);
// zTreeObj.selectNode(node[0]);
zTreeObj.checkNode(node[0], true, true); zTreeObj.checkNode(node[0], true, true);
} }
}); });
......
...@@ -7,21 +7,22 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) { ...@@ -7,21 +7,22 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) {
init:function(roleId){ init:function(roleId){
this.initTable(roleId); this.initTable(roleId);
this.initSearchForm();
this.initClose(); this.initClose();
}, },
initClose:function(){ initClose:function(){
$("#close").click(function(){ $("#close").click(function(){
Lib.closeFrame(); Lib.closeFrame();
}); });
}, },
initTable:function(roleId){ initTable:function(roleId){
userTable = table.render({ userTable = table.render({
elem : '#userTable', elem : '#userTable',
height : 'full-180', height : 'full-180',
method : 'post', method : 'post',
url : Common.CTX + '/admin/role/user/list.json?roleId='+roleId //数据接口 url : Common.CTX + '/admin/role/user/list.json?roleId='+roleId //数据接口
,page : {"layout":['count','prev', 'page', 'next']} //开启分页 ,page : Lib.tablePage //开启分页
,limit : 10, ,limit : 10,
cols : [ [ //表头 cols : [ [ //表头
{ {
......
<!--# layout("/common/layout.html",{"jsBase":"/js/admin/role/"}){ --> <!--# layout("/common/layout.html",{"jsBase":"/js/admin/role/"}){ -->
<form class="layui-form layui-form-pane" id="addForm" <form class="layui-form layui-form-pane" id="addForm">
action="/admin/role/add.json">
<div class="layui-row"> <div class="layui-row">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">角色名称</label> <label class="layui-form-label">角色名称</label>
......
<!--# layout("/common/layout.html",{"jsBase":"/js/admin/role/"}){ --> <!--# layout("/common/layout.html",{"jsBase":"/js/admin/role/"}){ -->
<form class="layui-form layui-form-pane" id="updateForm" <form class="layui-form layui-form-pane" id="updateForm">
action="/admin/role/update.json">
<div class="layui-row"> <div class="layui-row">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">角色名称</label> <label class="layui-form-label">角色名称</label>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment