first commit
This commit is contained in:
464
WebRoot/jsp/visit/visitApplyEdit.jsp
Normal file
464
WebRoot/jsp/visit/visitApplyEdit.jsp
Normal file
@ -0,0 +1,464 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%>
|
||||
<%@page import="com.sipai.entity.visit.VisitCommString"%>
|
||||
<%request.setAttribute("START", VisitCommString.STATUS_VISIT_START); %>
|
||||
<%request.setAttribute("AUDIT", VisitCommString.STATUS_VISIT_AUDIT); %>
|
||||
<%request.setAttribute("REJECT", VisitCommString.STATUS_VISIT_REJECT); %>
|
||||
<%request.setAttribute("EXECUTE", VisitCommString.STATUS_VISIT_EXECUTE); %>
|
||||
<%request.setAttribute("FINISH", VisitCommString.STATUS_VISIT_FINISH); %>
|
||||
<%request.setAttribute("REVOKE", VisitCommString.STATUS_VISIT_REVOKE); %>
|
||||
<%request.setAttribute("VISIT", VisitCommString.STATUS_VISIT); %>
|
||||
<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 doupdate() {
|
||||
if($("#unitId").val()==null || $("#unitId").val()==''){
|
||||
$("#unitId").val(unitId);
|
||||
}
|
||||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/visit/visitApply/update.do", $("#subForm").serialize(), function(data) {
|
||||
if (data.res == 1){
|
||||
closeModal('subModal');
|
||||
$("#table").bootstrapTable('refresh');
|
||||
}else if(data.res == 0){
|
||||
showAlert('d','保存失败');
|
||||
}else{
|
||||
showAlert('d',data.res);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
}
|
||||
//输入框验证
|
||||
$("#subForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
number: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '编号不能为空'
|
||||
},
|
||||
},
|
||||
},
|
||||
visitUnits: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '来访参观单位不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
leadUnits: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '来访参观牵头单位不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
leaderName: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '领队名称不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
contactInformation: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '联系方式不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
visitTime: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '来访时间不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
visitorsNumber: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '来访人数不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
var showUser4SelectsFun = function(hiddenId,textId) {
|
||||
var userIds= $("#"+hiddenId).val();
|
||||
$.post(ext.contextPath + '/user/userForSelectByStructure.do', {formId:"subForm",hiddenId:hiddenId,textId:textId,userIds:userIds} , function(data) {
|
||||
$("#user4SelectDiv").html(data);
|
||||
openModal("user4SelectModal");
|
||||
});
|
||||
};
|
||||
|
||||
//提交时先验证审核人不能为空,保存时审核人可以为空
|
||||
function submitFun(){
|
||||
//新增的输入框添加验证
|
||||
$("#subForm").data('bootstrapValidator').addField('auditMan',{
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '审核人不能为空'
|
||||
},
|
||||
}
|
||||
});
|
||||
dosubmit();
|
||||
}
|
||||
|
||||
function dosubmit(){
|
||||
$("#state").val('${AUDIT}');
|
||||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/visit/visitApply/startProcess.do", $("#subForm").serialize(), function(data) {
|
||||
if (data.res == 1){
|
||||
closeModal('subModal');
|
||||
$("#table").bootstrapTable('refresh');
|
||||
}else if(data.res == 2){
|
||||
showAlert('d','未检测到审核流程,请先部署流程!');
|
||||
}else if(data.res == 0){
|
||||
showAlert('d','保存失败');
|
||||
}else{
|
||||
showAlert('d',data.res);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
}
|
||||
var addDetailFun = function() {
|
||||
var applyId = $("#id").val();
|
||||
$.post(ext.contextPath + '/visit/visitVisitors/doadd.do',{applyId:applyId},
|
||||
function(data) {
|
||||
$("#subDetailDiv").html(data);
|
||||
openModal('subDetailModal');
|
||||
});
|
||||
}
|
||||
|
||||
var deletesDetailFun = function(id) {
|
||||
var datas="";
|
||||
if(id!=null && id!=undefined && id!=''){
|
||||
datas = id;
|
||||
}else{
|
||||
var checkedItems = $("#table_Detail").bootstrapTable('getSelections');
|
||||
$.each(checkedItems, function(index, item){
|
||||
datas+=item.id+",";
|
||||
});
|
||||
}
|
||||
if(datas==""){
|
||||
showAlert('d','请先选择记录','alertDiv');
|
||||
}else{
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
dangerMode: true,
|
||||
buttons: {
|
||||
cancel: {
|
||||
text: "取消",
|
||||
value: null,
|
||||
visible: true,
|
||||
className: "btn btn-default btn-sm",
|
||||
closeModal: true,
|
||||
},
|
||||
confirm: {
|
||||
text: "确定",
|
||||
value: true,
|
||||
visible: true,
|
||||
className: "btn btn-danger btn-sm",
|
||||
closeModal: true
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(function(willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/visit/visitVisitors/dodeletes.do', {ids:datas} , function(data) {
|
||||
if(data>0){
|
||||
$("#table_Detail").bootstrapTable('refresh');
|
||||
}else{
|
||||
showAlert('d','删除失败','alertDiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
$(function(){
|
||||
$("#visitTime").datetimepicker({
|
||||
language: 'zh-CN',
|
||||
format: 'yyyy-mm-dd',
|
||||
startView: "month", //初始化视图
|
||||
minView: 2,
|
||||
maxView: "year",
|
||||
todayBtn: true,
|
||||
clearBtn: true,
|
||||
autoclose: true,
|
||||
todayHighlight: 1,//今天高亮
|
||||
})
|
||||
$('#table_Detail').bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/visit/visitVisitors/getList.do', // 获取表格数据的url
|
||||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20,50], // 设置页面可以显示的数据条数
|
||||
pageSize: 10, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
showFooter: false,//添加页脚
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||||
return {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order,
|
||||
applyID:'${visitApply.id}',
|
||||
}
|
||||
},
|
||||
sortName: 'morder', // 要排序的字段
|
||||
sortOrder: 'asc', // 排序规则
|
||||
columns: [
|
||||
{
|
||||
checkbox: true, // 显示一个勾选框
|
||||
},{
|
||||
field: 'morder', // 返回json数据中的name
|
||||
title: '序号', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
editable: { //编辑列元素
|
||||
type: 'text',
|
||||
title: '序号',
|
||||
validate: function (v) {
|
||||
if (!v) return '不能为空';
|
||||
}
|
||||
}
|
||||
},{
|
||||
field: 'fullName', // 返回json数据中的name
|
||||
title: '姓名', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
editable: { //编辑列元素
|
||||
type: 'text',
|
||||
title: '姓名',
|
||||
validate: function (v) {
|
||||
if (!v) return '不能为空';
|
||||
}
|
||||
}
|
||||
},{
|
||||
field: 'gender', // 返回json数据中的name
|
||||
title: '性别', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
editable: { //编辑列元素
|
||||
type: 'text',
|
||||
title: '性别',
|
||||
validate: function (v) {
|
||||
if (!v) return '不能为空';
|
||||
}
|
||||
}
|
||||
},{
|
||||
field: 'age', // 返回json数据中的name
|
||||
title: '年龄', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
editable: { //编辑列元素
|
||||
type: 'number',
|
||||
title: '年龄',
|
||||
validate: function (v) {
|
||||
if (!v) return '不能为空';
|
||||
}
|
||||
}
|
||||
},{
|
||||
field: 'remark', // 返回json数据中的name
|
||||
title: '备注', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
editable: { //编辑列元素
|
||||
type: 'text',
|
||||
title: '备注',
|
||||
validate: function (v) {
|
||||
if (!v) return '不能为空';
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'state',
|
||||
title: "操作",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: 50, // 定义列的宽度,单位为像素px
|
||||
formatter: function (value, row, index) {
|
||||
if(value!=1){
|
||||
return '<div class="btn-group">'+
|
||||
'<button class="btn btn-default btn-sm" onclick="deletesDetailFun(\''+row.id+'\')" title="删除"><i class="fa fa-trash-o"></i></button>'+
|
||||
'</div>';
|
||||
}else{
|
||||
return '不可删除';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
],
|
||||
//保存列修改后的数据
|
||||
onEditableSave: function (field, row, oldValue, $el) {
|
||||
var url = ext.contextPath + "/visit/visitVisitors/doupdate.do";
|
||||
$.post(url, {id:row.id,remark:row.remark,age:row.age,gender:row.gender,fullName:row.fullName,morder : row.morder
|
||||
}, function(data) {
|
||||
if (data.res == 1){
|
||||
$("#table_Detail").bootstrapTable('refresh');
|
||||
}else if(data.res == 0){
|
||||
showAlert('d','编辑失败');
|
||||
}else{
|
||||
showAlert('d',data.res);
|
||||
}
|
||||
},'json');
|
||||
},
|
||||
onLoadSuccess: function(){ //加载成功时执行
|
||||
adjustBootstrapTableView("table_Detail");
|
||||
},
|
||||
onLoadError: function(){ //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
|
||||
});
|
||||
})
|
||||
</script>
|
||||
<div class="modal fade" id="subModal">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<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">
|
||||
<input id="id" name="id" type="hidden" value="${visitApply.id}"/>
|
||||
<input id="unitId" name="unitId" type="hidden" value="${visitApply.unitId}"/>
|
||||
<!-- 界面提醒div强制id为alertDiv -->
|
||||
<div id="alertDiv"></div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">*编号</label>
|
||||
<div class="col-sm-3">
|
||||
<input type="text" class="form-control" id="number" name ="number" placeholder="编号"
|
||||
value="${visitApply.number}"/>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label">顺序</label>
|
||||
<div class="col-sm-3">
|
||||
<input type="number" class="form-control" id="morder" name ="morder" placeholder="顺序"
|
||||
value="${visitApply.morder}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">*来访参观单位</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" id="visitUnits" name ="visitUnits" placeholder="来访参观单位"
|
||||
value="${visitApply.visitUnits}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">*来访参观牵头单位</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" id="leadUnits" name ="leadUnits" placeholder="来访参观牵头单位"
|
||||
value="${visitApply.leadUnits}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">陪同来访参观单位</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" id="organizationalUnit" name ="organizationalUnit"
|
||||
placeholder="陪同来访参观单位" value="${visitApply.organizationalUnit}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">*领队名称</label>
|
||||
<div class="col-sm-3">
|
||||
<input type="text" class="form-control" id="leaderName" name ="leaderName" placeholder="领队名称"
|
||||
value="${visitApply.leaderName}"/>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label">领队职务</label>
|
||||
<div class="col-sm-3">
|
||||
<input type="text" class="form-control" id="leaderPosition" name ="leaderPosition" placeholder="领队职务"
|
||||
value="${visitApply.leaderPosition}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">*联系方式</label>
|
||||
<div class="col-sm-3">
|
||||
<input type="text" class="form-control" id="contactInformation" name ="contactInformation" placeholder="联系方式"
|
||||
value="${visitApply.contactInformation}"/>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label">状态</label>
|
||||
<div class="col-sm-3">
|
||||
<p class="form-control-static">${visitApply.stateName}</p>
|
||||
<input id="state" name="state" type="hidden" value="${visitApply.state}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">*来访时间</label>
|
||||
<div class="col-sm-3">
|
||||
<div class="input-group date">
|
||||
<div class="input-group-addon">
|
||||
<i class="fa fa-calendar"></i>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="visitTime" name ="visitTime" placeholder="来访时间"
|
||||
value="${visitApply.visitTime.substring(0,10)}"/>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label">*来访人数</label>
|
||||
<div class="col-sm-3">
|
||||
<input type="number" class="form-control" id="visitorsNumber" name ="visitorsNumber" placeholder="来访人数"
|
||||
value="${visitApply.visitorsNumber}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">*审核人</label>
|
||||
<div class="col-sm-3">
|
||||
<input type="text" class="form-control" id="auditMan" name ="auditMan" placeholder="请选择审核人"
|
||||
onclick="showUser4SelectsFun('auditManId','auditMan');" value="${visitApply.auditMan}">
|
||||
<input id="auditManId" name="auditManId" type="hidden" value="${visitApply.auditManId}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">来访参观目的及主要内容</label>
|
||||
<div class="col-sm-9">
|
||||
<textarea class="form-control" rows="3" id ="purposeContent" name ="purposeContent"
|
||||
placeholder="来访参观目的及主要内容">${visitApply.purposeContent}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">备注</label>
|
||||
<div class="col-sm-9">
|
||||
<textarea class="form-control" rows="2" id ="remark" name ="remark" placeholder="备注...">${visitApply.remark}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="box box-primary" style="margin-top:20px">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">参观人员信息</h3>
|
||||
<div class="box-tools pull-right">
|
||||
<a class="btn btn-box-tool" onclick="addDetailFun()" data-toggle="tooltip" title="新增"><i class="glyphicon glyphicon-plus"></i></a>
|
||||
<a class="btn btn-box-tool" onclick="deletesDetailFun()" data-toggle="tooltip" title="删除"><i class="glyphicon glyphicon-minus"></i></a>
|
||||
<a class="btn btn-default btn-sm" onclick="importDetailFun();" ><i class="fa fa-cloud-upload"></i>导入人员信息</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
<div class="box-body ">
|
||||
<table id="table_Detail"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
<button type="button" class="btn btn-info" onclick="submitFun()" id="btn_submit">提交审核</button>
|
||||
<button type="button" class="btn btn-primary" onclick="doupdate()" id="btn_update">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
Reference in New Issue
Block a user