first commit
This commit is contained in:
254
WebRoot/jsp/efficiency/constituteConfigureMPoint4Select.jsp
Normal file
254
WebRoot/jsp/efficiency/constituteConfigureMPoint4Select.jsp
Normal file
@ -0,0 +1,254 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<%@page import="com.sipai.entity.efficiency.ConstituteConfigureDetail"%>
|
||||
<%request.setAttribute("Type_Day", ConstituteConfigureDetail.Type_Day); %>
|
||||
<%request.setAttribute("Type_Month", ConstituteConfigureDetail.Type_Month); %>
|
||||
<%request.setAttribute("Type_Hour", ConstituteConfigureDetail.Type_Hour); %>
|
||||
<%request.setAttribute("Type_Empty", ConstituteConfigureDetail.Type_Empty); %>
|
||||
<!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/constituteConfigureDetail/dosaves.do",{datas:datas,pid:'${param.pid}',unitId:unitId,type:$('#type').val()}, function(data) {
|
||||
closeModal("MPointModel");
|
||||
$("#table").bootstrapTable('refresh');
|
||||
},'json');
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
var $table;
|
||||
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: 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',
|
||||
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'
|
||||
},{
|
||||
field: 'mpointcode',
|
||||
title: "测量点Code",
|
||||
align: 'center',
|
||||
valign: 'middle'
|
||||
},{
|
||||
field: 'parmvalue',
|
||||
title: "最新值",
|
||||
align: 'center',
|
||||
valign: 'middle'
|
||||
},{
|
||||
field: 'measuredt',
|
||||
title: "最新时间",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width:'145px',
|
||||
formatter: function (value, row, index) {
|
||||
return value.substring(0,16)
|
||||
}
|
||||
},{
|
||||
field: 'unit',
|
||||
title: "单位",
|
||||
align: 'center',
|
||||
valign: 'middle'
|
||||
}
|
||||
],
|
||||
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;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="modal fade" id="MPointModel">
|
||||
<div class="modal-dialog" style="width: 850px;">
|
||||
<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="box box-primary box-solid collapsed-box" id="searchBox" collapsed>
|
||||
<div class="box-header">
|
||||
<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>
|
||||
<i class="fa fa-search"></i>
|
||||
</div> -->
|
||||
<div >
|
||||
<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-3">
|
||||
<input type="text" id="search_name_mpoint" name="search_name_mpoint" class="form-control input-sm" placeholder="名称" >
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">取值类型</label>
|
||||
<div class="col-sm-3">
|
||||
<select class="form-control select2" id="type" name ="type" >
|
||||
<option value= "${Type_Day}" selected = "selected">_day</option>
|
||||
<option value= "${Type_Month}">_month</option>
|
||||
<option value= "${Type_Hour}">_hour</option>
|
||||
<option value= "${Type_Empty}"></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-2 " >
|
||||
<button type ="button" class="btn btn-default btn-sm pull-right" onclick="doSearchPatrolPoint();"><i class="fa fa-search"> 搜索</i></button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="form-group" style="margin-right: 20px;">
|
||||
|
||||
</div> -->
|
||||
</form>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
<div>
|
||||
<table id="table_patrolPoint4Select" style="height:230px;overflow:auto;width:100%"></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