Skip to content

Commit

Permalink
add department view files
Browse files Browse the repository at this point in the history
  • Loading branch information
hcc authored and doubleview committed Nov 23, 2016
1 parent 21be87d commit 1a71c25
Show file tree
Hide file tree
Showing 4 changed files with 535 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public ResponseResult<Department> getDepartment(String id) {
@RequestMapping("tree-data")
@ResponseBody
public ResponseResult<List<TreeDataResult>> treeData() {
List<Department> menuList = SystemCacheUtils.getDepartmentList();
List<TreeDataResult> treeDataResultList = toTreeDataResult(menuList);
List<Department> departmentList = SystemCacheUtils.getDepartmentList();
List<TreeDataResult> treeDataResultList = toTreeDataResult(departmentList);
return success(treeDataResultList);
}

Expand Down
101 changes: 101 additions & 0 deletions src/main/webapp/WEB-INF/view/system/dept.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>部门管理</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1" name="viewport"/>
<meta content="" name="description"/>
<meta content="" name="author"/>
<%@ include file="/WEB-INF/view/global/head-lib.jsp"%>
<link href="${staticPath}/global/plugins/sweet-alert/css/sweet-alert.css" rel="stylesheet" type="text/css" />
<link href="${staticPath}/global/plugins/jstree/dist/themes/default/style.min.css" rel="stylesheet" type="text/css"/>
<script src="${staticPath}/global/plugins/sweet-alert/js/sweet-alert.min.js" type="text/javascript"></script>
<script src="${staticPath}/global/plugins/jstree/dist/jstree.min.js" type="text/javascript"></script>
</head>
<body>
<div class="page-inner-container" style="padding: 0px 15px">
<div class="row">

<div class="col-md-3">
<div class="portlet light bordered">
<div class="portlet-title">
<div class="caption">

<i class="icon-social-dribbble font-blue-sharp"></i>
<span class="caption-subject font-blue-sharp bold uppercase">部门结构</span>
</div>
<div class="actions">
<a href="javascript:;">
<i class="fa fa-refresh" id="tree-refresh"></i>
</a>
</div>
</div>
<div class="portlet-body">
<div id="dept-tree">
</div>
</div>
</div>
</div>

<div class="col-md-9">
<iframe id="deptFrame" src="${adminPath}/system/dept/show?parentId=0" width="100%" height="500px" frameborder="0"></iframe>
</div>
</div>

</div>
</div>

<script>
var Dept = function(){
//刷新菜单树
var refreshDeptTree = function () {
$('#dept-tree').data('jstree', false);
loadDeptTree();
};
var loadDeptTree = function(){
$.getJSON("${adminPath}/system/dept/tree-data",function(result){
if(result.code == "0"){
console.log("success");
$("#dept-tree").jstree({
"core": {
"themes": {
"responsive": false
},
"data": result.data
},
"plugins": ["types"]
});
}
});
};
var bindDeptTree = function(){
$('#dept-tree').bind("activate_node.jstree", function (obj, e) {
// 获取当前节点
var currentNode = e.node;
$("#deptFrame").attr("src","${adminPath}/system/dept/show?parentId=" + currentNode.id);
});
$("#tree-refresh").click(function(){
refreshDeptTree();
});
};
return {
init: function(){
loadDeptTree();
bindDeptTree();
},
}
}();
$(document).ready(function () {
Dept.init();
});
</script>
</body>
</html>
252 changes: 252 additions & 0 deletions src/main/webapp/WEB-INF/view/system/dept_edit.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,252 @@
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>部门编辑</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1" name="viewport"/>
<meta content="" name="description"/>
<meta content="" name="author"/>
<%@ include file="/WEB-INF/view/global/head-lib.jsp"%>
<link href="${staticPath}/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css" rel="stylesheet" type="text/css" />
<script src="${staticPath}/global/plugins/bootstrap-switch/js/bootstrap-switch.min.js" type="text/javascript"></script>
<script src="${staticPath}/global/plugins/jquery-validation/js/jquery.validate.min.js" type="text/javascript"></script>
<script src="${staticPath}/global/plugins/jquery-validation/js/additional-methods.min.js" type="text/javascript"></script>
</head>
<body>

<div class="page-inner-container" style="padding: 0px 15px">
<div class="row">
<div class="portlet light bordered">
<div class="portlet-title">
<div class="caption">
<i class="icon-bubble font-green"></i>
<span class="caption-subject font-blue-sharp bold uppercase">部门编辑</span>
</div>
</div>
<div class="portlet-body">
<form:form modelAttribute="dept" action="${adminPath}/system/dept/save" method="post" id="dept-form" class="form-horizontal">
<form:hidden path="id"/>
<form:hidden path="parent.id"/>
<div class="form-body">
<div class="alert alert-danger display-hide">
<button class="close" data-close="alert"></button>请保证表单信息填写正确</div>
<div class="form-group margin-top-20">
<label class="control-label col-xs-3" style="text-align: right; padding-top:7px">名称
<span class="required"> * </span>
</label>
<div class="col-xs-4">
<div class="input-icon right">
<i class="fa"></i>
<form:input path="name" cssClass="form-control" htmlEscape="false"/>
</div>
</div>
</div>

<div class="form-group margin-top-20">
<label class="control-label col-xs-3" style="text-align: right; padding-top:7px">编码
<span class="required"> </span>
</label>
<div class="col-xs-4">
<div class="input-icon right">
<i class="fa"></i>
<form:input path="href" cssClass="form-control" htmlEscape="false"/>
</div>
</div>
</div>

<div class="form-group margin-top-20">
<label class="control-label col-xs-3" style="text-align: right; padding-top:7px">地址
<span class="required"> </span>
</label>
<div class="col-xs-4">
<div class="input-icon right">
<i class="fa"></i>
<form:input path="icon" cssClass="form-control" htmlEscape="false"/>
</div>
</div>
</div>

<div class="form-group margin-top-20">
<label class="control-label col-xs-3" style="text-align: right; padding-top:7px">上级部门
<span class="required"> * </span>
</label>
<div class="col-xs-4">
<div class="input-icon right">
<i class="fa"></i>
<form:input path="parent.name" cssClass="form-control" htmlEscape="false" disabled="true"/>
</div>
</div>
</div>

<div class="form-group margin-top-20">
<label class="control-label col-xs-3" style="text-align: right; padding-top:7px">邮政编码
<span class="required"> * </span>
</label>
<div class="col-xs-4">
<div class="input-icon right">
<i class="fa"></i>
<form:input path="sort" cssClass="form-control" htmlEscape="false"/>
</div>
</div>
</div>

<div class="form-group margin-top-20">
<label class="control-label col-xs-3" style="text-align: right; padding-top:7px">电话
<span class="required"> * </span>
</label>
<div class="col-xs-4">
<div class="input-icon right">
<i class="fa"></i>
<form:input path="sort" cssClass="form-control" htmlEscape="false"/>
</div>
</div>
</div>

<div class="form-group margin-top-20">
<label class="control-label col-xs-3" style="text-align: right; padding-top:7px">传真
<span class="required"> * </span>
</label>
<div class="col-xs-4">
<div class="input-icon right">
<i class="fa"></i>
<form:input path="sort" cssClass="form-control" htmlEscape="false"/>
</div>
</div>
</div>
<div class="form-group margin-top-20">
<label class="control-label col-xs-3" style="text-align: right; padding-top:7px">邮箱
<span class="required"> * </span>
</label>
<div class="col-xs-4">
<div class="input-icon right">
<i class="fa"></i>
<form:input path="sort" cssClass="form-control" htmlEscape="false"/>
</div>
</div>
</div>

<div class="form-group margin-top-20">
<label class="control-label col-xs-3" style="text-align: right; padding-top:7px">所属区域
<span class="required"> * </span>
</label>
<div class="col-xs-4">
<div class="input-icon right">
<i class="fa"></i>
<form:input path="sort" cssClass="form-control" htmlEscape="false"/>
</div>
</div>
</div>

<div class="form-group margin-top-20">
<label class="control-label col-xs-3" style="text-align: right; padding-top:7px">负责人
<span class="required"> * </span>
</label>
<div class="col-xs-4">
<div class="input-icon right">
<i class="fa"></i>
<form:input path="sort" cssClass="form-control" htmlEscape="false"/>
</div>
</div>
</div>

<div class="form-group margin-top-20">
<label class="control-label col-xs-3" style="text-align: right; padding-top:7px">是否可用
<span class="required"></span>
</label>
<div class="col-xs-4">
<div class="input-icon right">
<i class="fa"></i>
<form:checkbox path="useable" value="1" cssClass="make-switch form-control" data-size="small"/>
</div>
</div>
</div>
<div class="form-group margin-top-20">
<label class="control-label col-xs-3" style="text-align: right; padding-top:7px">备注
<span class="required"> </span>
</label>
<div class="col-xs-4">
<div class="input-icon right">
<i class="fa"></i>
<form:textarea path="remarks" cssClass="form-control" htmlEscape="false"/>
</div>
</div>
</div>
<div class="form-actions">
<div class="row">
<div class="col-xs-offset-3 col-xs-9">
<input type="submit" class="btn green" value="保存"/>
<input type="button" class="btn default" value="返回" onclick="location.href='${adminPath}/system/dept/show?parentId=${dept.parent.id}'"/>
</div>
</div>
</div>
</form:form>
</div>
</div>
</div>
</div>
</div>

<script>
var FormValidation = function () {
var handleValidation = function () {
var deptForm = $('#dept-form');
var error = $('.alert-danger', deptForm);
deptForm.validate({
errorElement: 'span',
errorClass: 'help-block help-block-error',
focusInvalid: false,
ignore: "",
rules: {
name: {
minlength: 2,
required: true
},
sort:{
required: true,
number: true,
min : 0
}
},
invalidHandler: function (event, validator) {
error.show();
},
errorPlacement: function (error, element) {
var icon = $(element).parent('.input-icon').children('i');
icon.removeClass('fa-check').addClass("fa-warning");
},
highlight: function (element) {
$(element).closest('.form-group').removeClass("has-success").addClass('has-error');
},
success: function (label, element) {
var icon = $(element).parent('.input-icon').children('i');
$(element).closest('.form-group').removeClass('has-error').addClass('has-success');
icon.removeClass("fa-warning").addClass("fa-check");
},
submitHandler: function (form) {
form.submit();
}
});
}
return {
init: function () {
handleValidation();
}
}
}();
$(document).ready(function () {
FormValidation.init();
});
</script>
</body>
</html>
Loading

0 comments on commit 1a71c25

Please sign in to comment.