first commit
This commit is contained in:
178
WebRoot/jsp/process/testIndexManageForSelectMethods.jsp
Normal file
178
WebRoot/jsp/process/testIndexManageForSelectMethods.jsp
Normal file
@ -0,0 +1,178 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<!DOCTYPE html>
|
||||
<script type="text/javascript">
|
||||
var doSearchPatrolPoint = function() {
|
||||
$("#SelectMethods_table").bootstrapTable('refresh');
|
||||
};
|
||||
|
||||
function doSelect(dialog,grid) {
|
||||
var checkedItems = $("#SelectMethods_table").bootstrapTable('getAllSelections');
|
||||
var ids="";
|
||||
var names="";
|
||||
$.each(checkedItems, function(index, item){
|
||||
if(ids!=""){
|
||||
ids+=",";
|
||||
}
|
||||
ids+=item.id;
|
||||
if(names!=""){
|
||||
names+=",";
|
||||
}
|
||||
names+=item.name;
|
||||
});
|
||||
// console.log(checkedItems.id);
|
||||
$('#${param.formId} #${param.hiddenId}' ).val(ids);
|
||||
$('#${param.formId} #${param.textId}').val(names);
|
||||
closeModal('subMethodsModal');
|
||||
|
||||
};
|
||||
|
||||
var $table;
|
||||
var switchStatus=false;
|
||||
var selectionIds = [];
|
||||
|
||||
function queryParams(params) {
|
||||
var temp={
|
||||
rows: params.limit,
|
||||
page: params.offset/params.limit+1,
|
||||
sort: params.sort,
|
||||
order: params.order,
|
||||
// search_name: $('#search_name').val()
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
|
||||
$(function() {
|
||||
// $(".select2-selection--single").css({'height':'30px','paddingTop':'4px'});
|
||||
|
||||
$table=$("#SelectMethods_table").bootstrapTable({
|
||||
url: ext.contextPath + '/process/testMethods/getListForSelect.do',
|
||||
striped: true,
|
||||
pagination: true,
|
||||
pageList: [10, 20],
|
||||
pageSize: 20,
|
||||
pageNumber: 1,
|
||||
sidePagination: 'server',
|
||||
clickToSelect:true,
|
||||
responseHandler:responseHandler,
|
||||
queryParams: queryParams,
|
||||
queryParamsType: "limit",
|
||||
sortName: 'name',
|
||||
sortOrder: 'asc',
|
||||
columns: [
|
||||
{
|
||||
checkbox: true,
|
||||
formatter: function (i,row) {
|
||||
if($.inArray(row.id,Array.from(selectionIds))!=-1){
|
||||
return {
|
||||
checked : true
|
||||
}
|
||||
}
|
||||
}
|
||||
},{
|
||||
field: 'name', // 返回json数据中的name
|
||||
title: '方法名称', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle'
|
||||
},{
|
||||
field: 'indexitem', // 返回json数据中的name
|
||||
title: '检验指标', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle'
|
||||
},{
|
||||
field: 'matters', // 返回json数据中的name
|
||||
title: '注意事项', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle'
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function(){
|
||||
adjustBootstrapTableView("SelectMethods_table");
|
||||
},
|
||||
onLoadError: function(){
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
});
|
||||
|
||||
$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");
|
||||
}
|
||||
});
|
||||
});
|
||||
//选中事件操作数组
|
||||
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;
|
||||
});
|
||||
return res;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="modal fade" id="subMethodsModal">
|
||||
<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 " style="width:100%">
|
||||
<div id="alertDiv"></div>
|
||||
|
||||
<div class="form-group " style="margin-bottom:10px;">
|
||||
<input id="search_code" name="search_code" type="hidden" />
|
||||
<span id="company" style="height:31px;color:#000000;border-top-left-radius: 4px;border-bottom-left-radius: 4px;font-weight:bold"></span>
|
||||
</div>
|
||||
|
||||
<div class="form-group pull-right form-inline" >
|
||||
|
||||
<div class="form-group pull-left form-inline" style="float: left;width: 250px;margin-top: 5px;">
|
||||
<!-- <div class="input-group input-group-sm " style="width: 230px;">
|
||||
<input type="text" id="search_mpointcode" name="search_mpointcode" class="form-control pull-right" placeholder="点位查询">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" onclick="doSearchPatrolPoint();"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-scrollable">
|
||||
<table class="table table-bordered table-striped" style="overflow:auto;width:100%" id="SelectMethods_table"></table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default pull-left" 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