190 lines
8.3 KiB
Plaintext
190 lines
8.3 KiB
Plaintext
<%@ page language="java" pageEncoding="UTF-8"%>
|
||
<%@page import="com.sipai.entity.accident.AccidentCommString"%>
|
||
<%request.setAttribute("START", AccidentCommString.STATUS_RA_START); %>
|
||
<%request.setAttribute("AUDIT", AccidentCommString.STATUS_RA_AUDIT); %>
|
||
<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').data('bootstrapValidator')
|
||
.updateStatus('solvername', 'NOT_VALIDATED',null)
|
||
.validateField('happenDate');
|
||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/accident/reasonableAdvice/dosave.do", $("#subForm").serialize(), function(data) {
|
||
if (data.code == 1){
|
||
showAlert('s','保存成功');
|
||
closeModal('subModal')
|
||
$("#table").bootstrapTable('refresh');
|
||
|
||
}else if(data.code == 0){
|
||
showAlert('d','保存失败');
|
||
}else{
|
||
showAlert('d',data.res);
|
||
}
|
||
},'json');
|
||
}
|
||
|
||
}
|
||
|
||
function dosubmit(){
|
||
$("#takeFlag").val('${AUDIT}');
|
||
$('#subForm').data('bootstrapValidator')
|
||
.updateStatus('auditManName', 'NOT_VALIDATED',null)
|
||
.validateField('auditManName');
|
||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath +"/accident/reasonableAdvice/startProcess.do", $("#subForm").serialize(), function(data) {
|
||
if (data.res == 1) {
|
||
$("#table").bootstrapTable('refresh');
|
||
closeModal('subModal');
|
||
}else if(data.res == 0){
|
||
showAlert('d','保存失败');
|
||
}else if(data.res == 2){
|
||
showAlert('d','未检测到合理化建议审核流程,请先部署合理化建议审核流程!');
|
||
}else{
|
||
showAlert('d',data.res);
|
||
}
|
||
},'json');
|
||
}
|
||
}
|
||
//提交时先验证审核人不能为空,保存时审核人可以为空
|
||
function submitFun(){
|
||
//新增的输入框添加验证
|
||
$("#subForm").data('bootstrapValidator').addField('auditManName',{
|
||
validators: {
|
||
notEmpty: {
|
||
message: '审核人不能为空'
|
||
},
|
||
}
|
||
});
|
||
dosubmit();
|
||
}
|
||
$("#subForm").bootstrapValidator({
|
||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||
fields: {
|
||
name: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '名称不能为空'
|
||
}
|
||
}
|
||
},
|
||
solvername: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '建议人不能为空'
|
||
}
|
||
}
|
||
}
|
||
}
|
||
});
|
||
|
||
$(function(){
|
||
|
||
});
|
||
|
||
var showUser4SelectsFun = function() {
|
||
var userIds= $("#userLead").val();
|
||
$.post(ext.contextPath + '/user/userForSelectByStructure.do', {formId:"subForm",hiddenId:"userLead",textId:"solvername",userIds:userIds} , function(data) {
|
||
$("#user4SelectDiv").html(data);
|
||
openModal("user4SelectModal");
|
||
});
|
||
};
|
||
var showUser4SelectsFun1 = function() {
|
||
var userIds= $("#usersHelp").val();
|
||
$.post(ext.contextPath + '/user/userForSelectByStructure.do', {formId:"subForm",hiddenId:"usersHelp",textId:"solvername1",userIds:userIds} , function(data) {
|
||
$("#user4SelectDiv").html(data);
|
||
openModal("user4SelectModal");
|
||
});
|
||
};
|
||
|
||
//选择审核人
|
||
var showUser4AuditSelectsFun = function() {
|
||
var userIds= $("#auditManId").val();
|
||
$.post(ext.contextPath + '/user/userForSelectByStructure.do', {formId:"subForm",hiddenId:"auditManId",textId:"auditManName",userIds:userIds} , function(data) {
|
||
$("#user4SelectDiv").html(data);
|
||
openModal("user4SelectModal");
|
||
});
|
||
};
|
||
</script>
|
||
<div class="modal fade" id="subModal">
|
||
<div class="modal-dialog">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||
<span aria-hidden="true">×</span></button>
|
||
<h4 class="modal-title">新增合理化建议</h4>
|
||
</div>
|
||
<div class="modal-body">
|
||
<!-- 新增界面formid强制为subForm -->
|
||
<form class="form-horizontal" id="subForm">
|
||
<!-- 界面提醒div强制id为alertDiv -->
|
||
<div id="alertDiv"></div>
|
||
<input type="hidden" class="form-control" id="id" name ="id" value ="${reasonableAdvice.id}">
|
||
<input type="hidden" class="form-control" id="unitId" name ="unitId" value ="${param.unitId}">
|
||
<input type="hidden" class="form-control" id="takeFlag" name ="takeFlag" value ="${START}">
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*建议名称</label>
|
||
<div class="col-sm-10">
|
||
<input class="form-control" type="text" id="name" name ="name" placeholder="名称" value="${reasonableAdvice.name}">
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">建议类型</label>
|
||
<div class="col-sm-10">
|
||
<input class="form-control" type="text" id="adviceType" name ="adviceType" placeholder="类型" value="${reasonableAdvice.adviceType}">
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">建议内容</label>
|
||
<div class="col-sm-10">
|
||
<textarea class="form-control" rows="5" id ="content" name ="content" placeholder="不超过500字">${reasonableAdvice.content}</textarea>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*建议人</label>
|
||
<div class="col-sm-10">
|
||
<input type="text" class="form-control" id="solvername" name ="solvername" placeholder="请选择建议人" onclick="showUser4SelectsFun();" value="${userName}">
|
||
<input id="userLead" name="userLead" type="hidden" value="${userId}" />
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">辅议人</label>
|
||
<div class="col-sm-10">
|
||
<input type="text" class="form-control" id="solvername1" name ="solvername1" placeholder="请选择辅议人" onclick="showUser4SelectsFun1();">
|
||
<input id="usersHelp" name="usersHelp" type="hidden" />
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">审核人</label>
|
||
<div class="col-sm-10">
|
||
<input type="text" class="form-control" id="auditManName" name="auditManName" placeholder="点击选择" onclick="showUser4AuditSelectsFun();">
|
||
<input id="auditManId" name="auditManId" type="hidden" />
|
||
</div>
|
||
</div>
|
||
|
||
</form>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||
<button type="button" class="btn btn-primary" onclick="dosave()" id="btn_save">保存</button>
|
||
<button type="button" class="btn btn-primary" onclick="submitFun()" id="btn_submit">提交</button>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div>
|