244 lines
8.7 KiB
Plaintext
244 lines
8.7 KiB
Plaintext
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
|
<!DOCTYPE html>
|
|
<script type="text/javascript">
|
|
var doSearchPatrolPoint = function() {
|
|
$("#table_patrolPoint4Select").bootstrapTable('refresh');
|
|
};
|
|
|
|
function doSelect(dialog,grid) {
|
|
//var checkedItems = $("#table_user").bootstrapTable('getAllSelections');
|
|
var datas="";
|
|
datas_name="";
|
|
$.each(selectionIds, function(index, item){
|
|
if(datas!=""){
|
|
datas+=",";
|
|
}
|
|
datas+=item;
|
|
});
|
|
if(datas==''){
|
|
showAlert('d','请选择测量点');
|
|
}else{
|
|
$.post(ext.contextPath + "/efficiency/efficiencyOverviewMpConfigure/dosave.do",{datas:datas,picId:'${param.picId}',unitId:'${param.unitId}'}, function(data) {
|
|
closeModal("MPointModel");
|
|
showImg();
|
|
},'json');
|
|
}
|
|
};
|
|
|
|
function stateFormatter(value, row, index) {
|
|
var flag=false;
|
|
$.each(eval('${mPoints}'), function(index, item){
|
|
if(row.id==item.id){
|
|
flag=true;
|
|
}
|
|
});
|
|
if (flag){
|
|
return {
|
|
checked : true//设置选中
|
|
};
|
|
}
|
|
return value;
|
|
}
|
|
|
|
var $table;
|
|
var switchStatus=false;
|
|
var selectionIds = [];
|
|
|
|
function initialSelectionIds(){
|
|
var check_array =eval('${mPoints}');
|
|
if(check_array!=null&& check_array.length>0){
|
|
selectionIds =new Array(check_array.length);
|
|
for(var i=0;i<check_array.length;i++){
|
|
selectionIds[i]=check_array[i].id;
|
|
}
|
|
}
|
|
}
|
|
|
|
function getCheckedIds(){
|
|
var ids="";
|
|
var check_array =eval('${mPoints}');
|
|
$.each(check_array, function(index, item){
|
|
if(ids!=""){
|
|
ids+=",";
|
|
}
|
|
ids+=item.id;
|
|
});
|
|
return ids;
|
|
}
|
|
|
|
function queryParams(params) {
|
|
var temp={
|
|
rows: params.limit,
|
|
page: params.offset/params.limit+1,
|
|
sort: params.sort,
|
|
order: params.order,
|
|
search_name: $('#search_name_mpoint').val(),
|
|
companyId: '${param.unitId}'
|
|
}
|
|
return temp;
|
|
}
|
|
|
|
$(function() {
|
|
$("#searchForm_MPoint").attr("onsubmit", "return false;");
|
|
$("#search_name_mpoint").keyup(function () {
|
|
if (event.keyCode == 13) {
|
|
event.preventDefault();
|
|
doSearchPatrolPoint();
|
|
event.stopPropagation();
|
|
}
|
|
});
|
|
$('#searchBox').boxWidget();
|
|
$(".select2-selection--single").css({'height':'30px','paddingTop':'4px'});
|
|
|
|
initialSelectionIds();
|
|
|
|
$table=$("#table_patrolPoint4Select").bootstrapTable({
|
|
url: ext.contextPath + '/work/mpoint/getlist.do',
|
|
clickToSelect:true,
|
|
striped: true,
|
|
pagination: true,
|
|
pageList: [10, 20],
|
|
pageSize: 20,
|
|
pageNumber: 1,
|
|
sidePagination: 'server',
|
|
clickToSelect:true,
|
|
responseHandler:responseHandler,
|
|
queryParams: queryParams,
|
|
queryParamsType: "limit",
|
|
sortName: 'id',
|
|
sortOrder: 'asc',
|
|
columns: [
|
|
{
|
|
checkbox: true,
|
|
formatter: function (i,row) {
|
|
if($.inArray(row.id,Array.from(selectionIds))!=-1){
|
|
return {
|
|
checked : true
|
|
}
|
|
}
|
|
}
|
|
},{
|
|
field: 'parmname',
|
|
title: "名称",
|
|
align: 'center',
|
|
valign: 'middle',
|
|
width: '50%'
|
|
},{
|
|
field: 'mpointcode',
|
|
title: "测量点Code",
|
|
align: 'center',
|
|
valign: 'middle',
|
|
width: '50%'
|
|
}
|
|
],
|
|
onLoadSuccess: function(){
|
|
adjustBootstrapTableView("table_patrolPoint4Select");
|
|
},
|
|
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;
|
|
}
|
|
|
|
function doClose(){
|
|
closeModal("MPointModel");
|
|
}
|
|
|
|
</script>
|
|
|
|
<div class="modal fade" id="MPointModel">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<button type="button" class="close" onclick="doClose();">
|
|
<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="box box-primary box-solid collapsed-box" id="searchBox" collapsed>
|
|
<div class="box-header">
|
|
<!-- tools box -->
|
|
<div class="pull-right box-tools">
|
|
<button type="button" class="btn btn-primary btn-sm pull-right" data-widget="collapse"
|
|
style="margin-right: 5px;">
|
|
<i class="fa fa-plus"></i></button>
|
|
</div>
|
|
<!-- /. tools -->
|
|
<i class="fa fa-search"></i>
|
|
</div>
|
|
<div class="box-body collapse" >
|
|
<form class="form-horizontal " id="searchForm_MPoint">
|
|
<div class="form-group" style="margin-right: 20px;">
|
|
<!-- <label class="col-sm-2 control-label">部门</label>
|
|
<div class="col-sm-4">
|
|
<select class="form-control select2 " id="search_pid" name ="search_pid" style="width:170px;"></select>
|
|
</div> -->
|
|
<label class="col-sm-2 control-label">名称</label>
|
|
<div class="col-sm-4">
|
|
<input type="text" id="search_name_mpoint" name="search_name_mpoint" class="form-control input-sm" placeholder="名称" style="width:170px;">
|
|
</div>
|
|
</div>
|
|
<div class="form-group" style="margin-right: 20px;">
|
|
<div class=" col-sm-offset-6 button-group" style="padding: 0;">
|
|
<button type ="button" class="btn btn-default btn-sm pull-right" onclick="doSearchPatrolPoint();"><i class="fa fa-search"> 搜索</i></button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div id="table_patrolPoint4Select" style="height:230px;overflow:auto;width:100%"></div>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-default pull-left" onclick="doClose();">关闭</button>
|
|
<button type="button" class="btn btn-primary" onclick="doSelect()">确认</button>
|
|
</div>
|
|
</div>
|
|
<!-- /.modal-content -->
|
|
</div>
|
|
<!-- /.modal-dialog -->
|
|
</div> |