137 lines
5.4 KiB
Plaintext
137 lines
5.4 KiB
Plaintext
|
|
<%@ page language="java" pageEncoding="UTF-8" %>
|
|||
|
|
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
|
|||
|
|
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
|
|||
|
|
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
|
|||
|
|
<%@ page import="com.sipai.entity.base.ServerObject" %>
|
|||
|
|
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security" %>
|
|||
|
|
<%@page import="com.sipai.entity.work.GroupContent" %>
|
|||
|
|
<% request.setAttribute("Type_Point", GroupContent.Type_Point); %>
|
|||
|
|
<% request.setAttribute("Type_Content", GroupContent.Type_Content); %>
|
|||
|
|
|
|||
|
|
<style type="text/css">
|
|||
|
|
.select2-container .select2-selection--single {
|
|||
|
|
height: 34px;
|
|||
|
|
line-height: 34px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.select2-selection__arrow {
|
|||
|
|
margin-top: 3px;
|
|||
|
|
}
|
|||
|
|
</style>
|
|||
|
|
<script type="text/javascript">
|
|||
|
|
|
|||
|
|
function dosave() {
|
|||
|
|
$("#subForm").bootstrapValidator('validate');//提交验证
|
|||
|
|
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
|||
|
|
$.post(ext.contextPath + "/work/groupContent/dosave.do", $("#subForm").serialize(), function (result) {
|
|||
|
|
var data = $.parseJSON(result);
|
|||
|
|
if (data.code == 1) {
|
|||
|
|
initTreeView();
|
|||
|
|
// showAlert('s','保存成功');
|
|||
|
|
} else {
|
|||
|
|
showAlert('d', data.msg);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$("#subForm").bootstrapValidator({
|
|||
|
|
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
|||
|
|
fields: {
|
|||
|
|
name: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '名称不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
morder: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '顺序不能为空'
|
|||
|
|
},
|
|||
|
|
regexp: {
|
|||
|
|
regexp: /^[0-9]*$/,
|
|||
|
|
message: '顺序必须为数字'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
$(function () {
|
|||
|
|
$.post(ext.contextPath + "/work/groupType/getGroupTypeTree.do", function (data) {
|
|||
|
|
//console.log("sdata",data);
|
|||
|
|
var select = $("#grouptypeid").select2({
|
|||
|
|
data: data,
|
|||
|
|
placeholder: '请选择',//默认文字提示
|
|||
|
|
allowClear: true,//允许清空
|
|||
|
|
escapeMarkup: function (markup) {
|
|||
|
|
return markup;
|
|||
|
|
}, // 自定义格式化防止xss注入
|
|||
|
|
language: "zh-CN",
|
|||
|
|
minimumInputLength: 0,
|
|||
|
|
minimumResultsForSearch: 10,//数据超过十个启用搜索框
|
|||
|
|
formatResult: function formatRepo(repo) {
|
|||
|
|
return repo.text;
|
|||
|
|
}, // 函数用来渲染结果
|
|||
|
|
formatSelection: function formatRepoSelection(repo) {
|
|||
|
|
return repo.text;
|
|||
|
|
} // 函数用于呈现当前的选择
|
|||
|
|
});
|
|||
|
|
$("#grouptypeid").on("select2:select", function (e) {
|
|||
|
|
});
|
|||
|
|
$(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'});//选中元素上下居中
|
|||
|
|
if (data.length != 0) {
|
|||
|
|
select.val(data[0].id).trigger("change");//设置选中
|
|||
|
|
} else {
|
|||
|
|
select.val("").trigger("change");//设置选中
|
|||
|
|
}
|
|||
|
|
}, 'json');
|
|||
|
|
});
|
|||
|
|
</script>
|
|||
|
|
<div class="box box-primary">
|
|||
|
|
<div class="box-header with-border">
|
|||
|
|
<h3 class="box-title">新增</h3>
|
|||
|
|
|
|||
|
|
<div class="box-tools pull-right">
|
|||
|
|
<a onclick="dosave()" class="btn btn-box-tool" data-toggle="tooltip" title="保存"><i
|
|||
|
|
class="glyphicon glyphicon-floppy-disk"></i></a>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<!-- /.box-header -->
|
|||
|
|
<div class="box-body ">
|
|||
|
|
<form class="form-horizontal " id="subForm">
|
|||
|
|
<input id="unitId" name="unitId" type="hidden" value="${param.unitId}"/>
|
|||
|
|
<input id="pid" name="pid" type="hidden" value="${param.pid}"/>
|
|||
|
|
<input id="type" name="type" type="hidden" value="${param.type}"/>
|
|||
|
|
|
|||
|
|
<!-- 界面提醒div强制id为alertDiv -->
|
|||
|
|
<div id="alertDiv"></div>
|
|||
|
|
<div id="menu4SelectDiv"></div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">名称</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input type="text" class="form-control" id="name" name="name" placeholder="名称"
|
|||
|
|
value="${groupContent.name }">
|
|||
|
|
</div>
|
|||
|
|
<label class="col-sm-2 control-label">顺序</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input type="text" class="form-control" id="morder" name="morder" placeholder="顺序"
|
|||
|
|
value="${groupContent.morder}">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<c:if test="${param.type==Type_Content}">
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">班组类型</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<select class="form-control select2 " id="grouptypeid" name="grouptypeid"
|
|||
|
|
style="width: 220px;"></select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</c:if>
|
|||
|
|
</form>
|
|||
|
|
</div>
|
|||
|
|
</div>
|