修改部门

main
tamguo 7 years ago
parent 95841b0ad4
commit 134ba92a2a

@ -58,8 +58,8 @@ public class ShiroConfiguration {
public ShiroFilterFactoryBean getShiroFilterFactoryBean() {
ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
shiroFilterFactoryBean.setSecurityManager(getDefaultWebSecurityManager());
shiroFilterFactoryBean.setLoginUrl("/sysLogin");
shiroFilterFactoryBean.setSuccessUrl("/sysIndex");
shiroFilterFactoryBean.setLoginUrl("/login");
shiroFilterFactoryBean.setSuccessUrl("/index");
filterChainDefinitionMap.put("/jquery/**", "anon");
filterChainDefinitionMap.put("/adminlte/**", "anon");
filterChainDefinitionMap.put("/bootstrap/**", "anon");

@ -25,4 +25,7 @@ public interface ISysRoleService extends IService<SysRoleEntity>{
/** 角色树形结构*/
List<SysRoleEntity> treeDate(String userType);
/** 修改角色*/
void update(SysRoleEntity role);
}

@ -1,5 +1,6 @@
package com.tamguo.modules.sys.service.impl;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -23,6 +24,7 @@ import com.tamguo.modules.sys.model.SysRoleEntity;
import com.tamguo.modules.sys.model.SysRoleMenuEntity;
import com.tamguo.modules.sys.model.condition.SysRoleCondition;
import com.tamguo.modules.sys.service.ISysRoleService;
import com.tamguo.modules.sys.utils.ShiroUtils;
@Service
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRoleEntity> implements ISysRoleService {
@ -127,4 +129,20 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRoleEntity
public List<SysRoleEntity> treeDate(String userType) {
return sysRoleMapper.selectList(Condition.create().eq("user_type", userType));
}
@Transactional(readOnly=false)
@Override
public void update(SysRoleEntity role) {
SysRoleEntity entity = sysRoleMapper.selectById(role.getRoleCode());
entity.setRoleName(role.getRoleName());
entity.setRoleSort(role.getRoleSort());
entity.setUserType(role.getUserType());
entity.setIsSys(role.getIsSys());
entity.setRoleType(role.getRoleType());
entity.setUpdateBy(ShiroUtils.getUserCode());
entity.setUpdateDate(new Date());
entity.setRemarks(role.getRemarks());
sysRoleMapper.updateById(entity);
}
}

@ -7,9 +7,9 @@ import org.springframework.web.servlet.ModelAndView;
@Controller
public class IndexController {
@RequestMapping(path="sysIndex")
@RequestMapping(path="index")
public String sysLogin(ModelAndView model) {
return "sysIndex";
return "index";
}
}

@ -26,6 +26,8 @@ public class SysRoleController {
private final String ROLE_MENU_INDEX_PAGE = "modules/sys/role/menu";
// 数据权限
private final String ROLE_DATA_INDEX_PAGE = "modules/sys/role/dataScope";
// 修改角色
private final String ROLE_MENU_UPDATE_PAGE = "modules/sys/role/update";
@Autowired
private ISysRoleService iSysRoleService;
@ -40,6 +42,14 @@ public class SysRoleController {
return model;
}
/** 修改角色*/
@RequestMapping(path="update")
public ModelAndView update(String roleCode , ModelAndView model) {
model.addObject("role", iSysRoleService.selectById(roleCode));
model.setViewName(ROLE_MENU_UPDATE_PAGE);
return model;
}
/** 数据权限 */
@SuppressWarnings("unchecked")
@RequestMapping(path="dataScope")
@ -122,6 +132,18 @@ public class SysRoleController {
ExceptionSupport.resolverResult("角色树", this.getClass(), e);
return null;
}
}
/** 修改角色*/
@RequestMapping(path="update",method=RequestMethod.POST)
@ResponseBody
public Result update(SysRoleEntity role) {
try {
iSysRoleService.update(role);
return Result.result(0, null, "角色【"+role.getRoleName()+"】修改成功!");
} catch (Exception e) {
return ExceptionSupport.resolverResult("修改角色", this.getClass(), e);
}
}

@ -15,7 +15,7 @@ $("#loginForm").validate({
js.ajaxSubmitForm($(c), function(f, e, g) {
if (f.result.code != 0) {
js.loading($("#btnSubmit").data("loading"));
location = ctx + "sysIndex"
location = ctx + "index"
} else {
js.showMessage(f.message)
}

@ -117,7 +117,7 @@ $('#dataGrid').dataGrid({
}},
{header:'操作', name:'actions', width:130, sortable:false, title:false, formatter: function(val, obj, row, act){
var actions = [];
actions.push('<a href="/js/a/sys/role/form?roleCode='+row.roleCode+'&op=edit" class="btnList" title="编辑角色"><i class="fa fa-pencil"></i></a>&nbsp;');
actions.push('<a href="sys/role/update?roleCode='+row.roleCode+'&op=edit" class="btnList" title="编辑角色"><i class="fa fa-pencil"></i></a>&nbsp;');
if (row.status == Global.STATUS_NORMAL){
actions.push('<a href="/js/a/sys/role/disable?roleCode='+row.roleCode+'" class="btnList" title="停用角色" data-confirm="确认要停用该角色吗?"><i class="glyphicon glyphicon-ban-circle"></i></a>&nbsp;');
}

@ -0,0 +1,164 @@
<!DOCTYPE html><html><head><meta charset="utf-8"><meta content="webkit" name="renderer"/><meta http-equiv="X-UA-Compatible"
content="IE=edge"><meta name="keywords" content="PoweredByJeeSiteV4.0"/><meta http-equiv="Cache-Control"
content="no-cache, no-store, must-revalidate"/><meta name="description" content="PoweredByJeeSiteV4.0"/><meta
content="no-cache" http-equiv="Pragma"/><meta http-equiv="Expires" content="0"/><meta
content="width=device-width, initial-scale=1, user-scalable=1" name="viewport"/>
<title>角色管理 - JeeSite Demo</title>
<script th:src="${setting.domain + 'global.min.js'}"></script>
<script th:src="${setting.domain + 'jquery/jquery-1.12.4.min.js'}"></script>
<script th:src="${setting.domain + 'jquery/jquery-migrate-1.4.1.min.js'}"></script>
<!--[if lt IE 9]><script src="/js/static/common/h5fix.min.js"></script><![endif]-->
<link rel="stylesheet" th:href="${setting.domain + 'fonts/font-icons.min.css'}">
<link rel="stylesheet" th:href="${setting.domain + 'bootstrap/css/bootstrap.min.css'}">
<link rel="stylesheet" th:href="${setting.domain + 'select2/4.0/select2.css'}">
<link rel="stylesheet" th:href="${setting.domain + 'icheck/1.0/minimal/grey.css'}">
<link rel="stylesheet" th:href="${setting.domain + 'jquery-ztree/3.5/css/metro/zTreeStyle.css'}">
<link rel="stylesheet" th:href="${setting.domain + 'adminlte/css/AdminLTE.min.css'}">
<link rel="stylesheet" th:href="${setting.domain + 'common/jeesite.css'}">
<link rel="stylesheet" th:href="${setting.domain + 'common/common.css'}">
</head><body class="hold-transition ">
<div class="wrapper"><div class="main-content">
<div class="box box-main">
<div class="box-header">
<div class="box-title">
<i class="fa icon-people"></i> 编辑角色
</div>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
</div>
</div>
<form id="inputForm" th:action="${setting.domain + 'sys/role/update'}" method="post" class="form-horizontal">
<input type="hidden" id="op" name="op" value="edit"/>
<div class="box-body">
<div class="form-unit">基本信息</div>
<div class="row">
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required ">*</span> 角色名称:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<input type="text" id="roleName" name="roleName" th:value="${role.roleName}" maxlength="100" class="form-control required "/>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required ">*</span> 角色编码:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<input type="hidden" id="isNewRecord" name="isNewRecord" value="false"/>
<input type="text" id="roleCode" name="roleCode" th:value="${role.roleCode}" maxlength="64" readonly="true" class="form-control required abc"/>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required ">*</span> 排序号:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<input type="text" id="roleSort" name="roleSort" th:value="${role.roleSort}" maxlength="10" class="form-control required digits"/>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 用户类型:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<select id="userType" name="userType" class="form-control ">
<option value="">&nbsp;</option>
<option value="employee" th:selected="${role.userType == 'employee'} ? true : false">员工</option>
<option value="member" th:selected="${role.userType == 'member'} ? true : false">会员</option>
<option value="btype" th:selected="${role.userType == 'btype'} ? true : false">单位</option>
<option value="persion" th:selected="${role.userType == 'persion'} ? true : false">个人</option>
<option value="expert" th:selected="${role.userType == 'expert'} ? true : false">专家</option>
</select>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required ">*</span> 系统内置:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<span id="isSys" class="icheck">
<label><input type="radio" id="isSys1" name="isSys" value="1" class="form-control required " th:checked="${role.isSys == '1'} ? true : false"></label>
<label><input type="radio" id="isSys2" name="isSys" value="0" class="form-control required " th:checked="${role.isSys == '0'} ? true : false"></label>
</span>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 角色分类:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<select id="roleType" name="roleType" class="form-control ">
<option value="">&nbsp;</option>
<option value="1" th:selected="${role.roleType == '1'} ? true : false">高管</option>
<option value="2" th:selected="${role.roleType == '2'} ? true : false">中层</option>
<option value="3" th:selected="${role.roleType == '3'} ? true : false">基层</option>
<option value="4" th:selected="${role.roleType == '4'} ? true : false">其它</option>
</select>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label class="control-label col-sm-2" title="">
<span class="required hide">*</span> 备注信息:<i class="fa icon-question hide"></i></label>
<div class="col-sm-10">
<textarea id="remarks" name="remarks" rows="4" maxlength="500" class="form-control " th:utext="${role.remarks}">部门经理</textarea>
</div>
</div>
</div>
</div>
</div>
<div class="box-footer">
<div class="row">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> 保 存</button>&nbsp;
<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> 关 闭</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<a id="scroll-up" href="#" class="btn btn-sm"><i class="fa fa-angle-double-up"></i></a>
<script th:src="${setting.domain + 'bootstrap/js/bootstrap.min.js'}"></script>
<script th:src="${setting.domain + 'select2/4.0/select2.js'}"></script>
<script th:src="${setting.domain + 'select2/4.0/i18n/zh_CN.js'}"></script>
<script th:src="${setting.domain + 'layer/3.1/layer.js'}"></script>
<script th:src="${setting.domain + 'my97/WdatePicker.js'}"></script>
<script th:src="${setting.domain + 'jquery-ztree/3.5/js/jquery.ztree.all-3.5.js'}"></script>
<script th:src="${setting.domain + 'jquery-validation/1.16/jquery.validate.js'}"></script>
<script th:src="${setting.domain + 'jquery-validation/1.16/localization/messages_zh_CN.js'}"></script>
<script th:src="${setting.domain + 'jquery-validation/1.16/jquery.validate.extend.js'}"></script>
<script th:src="${setting.domain + 'common/jeesite.js'}"></script>
<script th:src="${setting.domain + 'common/i18n/jeesite_zh_CN.js'}"></script>
<script th:src="${setting.domain + 'common/common.js'}"></script>
<script>
$("#inputForm").validate({
submitHandler: function(form){
// 提交表单数据
js.ajaxSubmitForm($(form), function(data){
js.showMessage(data.message);
if(data.code == 0){
js.closeCurrentTabPage(function(contentWindow){
contentWindow.page();
});
}
}, "json");
}
});
</script>
Loading…
Cancel
Save