first commit
This commit is contained in:
228
WebRoot/jsp/visit/visitApplyForSelect.jsp
Normal file
228
WebRoot/jsp/visit/visitApplyForSelect.jsp
Normal file
@ -0,0 +1,228 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@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); %>
|
||||
<!DOCTYPE html>
|
||||
<style type="text/css">
|
||||
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
var doSearchApply = function() {
|
||||
$("#table_visitApply").bootstrapTable('refresh');
|
||||
};
|
||||
|
||||
function stateFormatter(value, row, index) {
|
||||
var flag=false;
|
||||
//单选
|
||||
if(row.id==hiddenId){
|
||||
flag=true;
|
||||
}
|
||||
if (flag)
|
||||
return {
|
||||
checked : true//设置选中
|
||||
};
|
||||
return value;
|
||||
}
|
||||
var $table;
|
||||
var switchStatus=false;
|
||||
var selectionIds = []; //保存选中ids
|
||||
function initialSelectionIds(){
|
||||
//单选
|
||||
selectionIds =new Array(1);
|
||||
selectionIds[0]=hiddenId;
|
||||
}
|
||||
function getCheckedIds(){
|
||||
var ids=hiddenId;
|
||||
return ids;
|
||||
}
|
||||
var hiddenId ;
|
||||
var companyId = "";
|
||||
$(function() {
|
||||
companyId = unitId;
|
||||
hiddenId = $('#${param.formId} #${param.hiddenId}').val();
|
||||
$("#search_name_visitApply").keyup(function () {
|
||||
if (event.keyCode == 13) {
|
||||
event.preventDefault();
|
||||
//回车执行查询
|
||||
doSearchApply();
|
||||
event.stopPropagation();
|
||||
}
|
||||
});
|
||||
initialSelectionIds();
|
||||
$table=$("#table_visitApply").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/visit/visitApply/getList.do', // 获取表格数据的url
|
||||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20,50], // 设置页面可以显示的数据条数
|
||||
pageSize: 10, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||||
return {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order,
|
||||
search_name: $('#search_name_visitApply').val(),
|
||||
search_code: companyId,
|
||||
state:'${EXECUTE}'
|
||||
}
|
||||
},
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
columns: [
|
||||
{
|
||||
radio:true, // 显示一个单选框
|
||||
formatter: function (i,row) { // 每次加载 checkbox 时判断当前 row 的 id 是否已经存在全局 Set() 里
|
||||
if($.inArray(row.id,Array.from(selectionIds))!=-1){ // 因为 Set是集合,需要先转换成数组
|
||||
return {
|
||||
checked : true // 存在则选中
|
||||
}
|
||||
}
|
||||
}
|
||||
},{
|
||||
field: 'number', // 返回json数据中的name
|
||||
title: '编号', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},{
|
||||
field: 'visitUnits', // 返回json数据中的name
|
||||
title: '来访参观单位', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},{
|
||||
field: 'leaderName', // 返回json数据中的name
|
||||
title: '领队名称', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},{
|
||||
field: 'visitTime', // 返回json数据中的name
|
||||
title: '来访时间', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
formatter:function (value, row, index){
|
||||
return value.substring(0,10);
|
||||
}
|
||||
},{
|
||||
field: 'visitorsNumber', // 返回json数据中的name
|
||||
title: '来访人数', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},{
|
||||
field: 'contactInformation', // 返回json数据中的name
|
||||
title: '联系方式', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},{
|
||||
field: 'remark', // 返回json数据中的name
|
||||
title: '备注', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function(){ //加载成功时执行
|
||||
adjustBootstrapTableView("table_visitApply");
|
||||
},
|
||||
onLoadError: function(){ //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
},
|
||||
onCheck:function(row, $element){
|
||||
|
||||
$('#${param.formId} #${param.hiddenId}').val(row.id);
|
||||
$('#${param.formId} #visitUnits').val(row.visitUnits);
|
||||
$('#${param.formId} #leaderName').val(row.leaderName);
|
||||
$('#${param.formId} #contactInformation').val(row.contactInformation);
|
||||
$('#${param.formId} #visitorsNumber').val(row.visitorsNumber);
|
||||
$('#${param.formId} #visitTime').val(row.visitTime.substring(0,10));
|
||||
|
||||
closeModal("apply4SelectModal");
|
||||
dosearchDetail();
|
||||
}
|
||||
})
|
||||
|
||||
//绑定选中事件、取消事件、全部选中、全部取消
|
||||
$table.on('check.bs.table check-all.bs.table uncheck.bs.table uncheck-all.bs.table', function (e,rows, obj) {
|
||||
var ids = $.map(!$.isArray(rows) ? [rows] : rows, function (row) {
|
||||
return row.id;
|
||||
});
|
||||
func = $.inArray(e.type, ['check', 'check-all']) > -1 ? 'union' : 'difference';
|
||||
selectionIds = _[func](selectionIds, ids);
|
||||
if('check'==e.type){
|
||||
obj.parent().addClass("checked");
|
||||
}else{
|
||||
obj.parent().removeClass("checked");
|
||||
}
|
||||
//adjustBootstrapTableView("table_visitApply");
|
||||
});
|
||||
});
|
||||
//选中事件操作数组
|
||||
var union = function(array,ids){
|
||||
$.each(ids, function (i, id) {
|
||||
if($.inArray(id,array)==-1){
|
||||
array[array.length] = id;
|
||||
}
|
||||
});
|
||||
return array;
|
||||
};
|
||||
//取消选中事件操作数组
|
||||
var difference = function(array,ids){
|
||||
$.each(ids, function (i, id) {
|
||||
var index = $.inArray(id,array);
|
||||
if(index!=-1){
|
||||
array.splice(index, 1);
|
||||
}
|
||||
});
|
||||
return array;
|
||||
};
|
||||
var _ = {"union":union,"difference":difference};
|
||||
|
||||
//表格分页之前处理多选框数据
|
||||
function responseHandler(res) {
|
||||
$.each(res.rows, function (i, row) {
|
||||
row.checkStatus = $.inArray(row.id, selectionIds) != -1; //判断当前行的数据id是否存在与选中的数组,存在则将多选框状态变为true
|
||||
});
|
||||
return res;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="modal fade" id="apply4SelectModal">
|
||||
<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 " style="width:100%;">
|
||||
<div id="visitApplyAlertDiv"></div>
|
||||
|
||||
<div class="form-group" style="padding:0;">
|
||||
<div class="form-group pull-right form-inline" >
|
||||
<div class="input-group input-group-sm" style="width: 250px;">
|
||||
<input type="text" id="search_name_visitApply" name="search_name_visitApply" class="form-control pull-right" placeholder="公司、领队名称">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" onclick="doSearchApply();"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<table id="table_visitApply" ></table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
<button type="button" class="btn btn-primary" onclick="doSelect()">确认</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
Reference in New Issue
Block a user