264 lines
12 KiB
Plaintext
264 lines
12 KiB
Plaintext
<%@ page language="java" pageEncoding="UTF-8"%>
|
||
<%@ page import="com.sipai.tools.SessionManager"%>
|
||
<%
|
||
SessionManager sessionManager = new SessionManager();
|
||
%>
|
||
<%@page import="com.sipai.entity.scada.MPoint"%>
|
||
<%request.setAttribute("Flag_Enable",MPoint.Flag_Enable);%>
|
||
<%request.setAttribute("Flag_Disable",MPoint.Flag_Disable);%>
|
||
|
||
<script type="text/javascript">
|
||
var dosearchMp = function() {
|
||
$("#table_mpoint").bootstrapTable('refresh');
|
||
};
|
||
function doselect(dialog,grid) {
|
||
//var checkedItems = $("#table_user").bootstrapTable('getAllSelections');
|
||
var datas_name="";
|
||
var value_name="";
|
||
var datas_code="";
|
||
if(checkedItem!= null && checkedItem!=""){
|
||
$.post(ext.contextPath + '/work/mpoint/getlist.do', {companyId:unitId,checkedIds : checkedItem.id,page:1,rows:50}, function(resp) {
|
||
//console.info(checkedItem.id)
|
||
$.each(resp.rows, function(index, item){
|
||
datas_name=item.parmname;//测量点一次只能添加一个
|
||
value_name=item.parmvalue;
|
||
datas_code=item.mpointcode;
|
||
});
|
||
// console.log("formid","${param.formId}");
|
||
// console.log("formid","${param.hiddenId}");
|
||
// console.log(companyId);
|
||
$('#${param.formId} #${param.hiddenId}' ).val(checkedItem.id);
|
||
$('#${param.formId} #${param.textId}').val(datas_name);
|
||
if('${param.valueId}'!=''){
|
||
$('#${param.formId} #${param.valueId}').val(value_name);
|
||
}
|
||
if('${param.codeId}'!=''){
|
||
$('#${param.formId} #${param.codeId}').val(datas_code);
|
||
}
|
||
if('${param.unitId}'!=''){
|
||
$('#${param.formId} #${param.unitId}').val(unitId);
|
||
}
|
||
|
||
|
||
closeModal('mpSelectSubModal');
|
||
},'json');
|
||
}else{
|
||
showAlert('d','尚未选择测量点!','mpoint_mainAlertdiv');
|
||
}
|
||
|
||
|
||
};
|
||
|
||
//显示已经勾选的数据
|
||
function stateFormatter(value, row, index) {
|
||
var flag=false;
|
||
if(row.id=='${mpid}'){
|
||
flag=true;
|
||
checkedItem = "";
|
||
}
|
||
if (flag)
|
||
return {
|
||
checked : true//设置选中
|
||
};
|
||
return value;
|
||
}
|
||
|
||
var $table;
|
||
|
||
function queryParams(params) {
|
||
|
||
var temp={
|
||
pid:params.pid,
|
||
rows: params.limit, // 每页要显示的数据条数
|
||
page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
||
sort: params.sort, // 要排序的字段
|
||
order: params.order, // 排序规则
|
||
search_name: $('#search_mpointname').val(),
|
||
search_mpointcode: $('#search_mpointcode').val(),
|
||
companyId:unitId
|
||
};
|
||
/* var status =$('#switchBtn').bootstrapSwitch('state')
|
||
if(status){
|
||
temp.checkedIds=getCheckedIds();
|
||
}
|
||
*/ return temp;
|
||
}
|
||
$(function() {
|
||
/* $.post(ext.contextPath + "/user/getSearchBizsByUserId4Select.do", {}, function(data) {
|
||
if(data.length == 1){
|
||
//选择厂区为一个厂时隐藏选择框
|
||
$("#search_code").css("display", "none");
|
||
$("#company").text(data[0].text);
|
||
companyId=data[0].id;
|
||
dosearchMp();
|
||
}else{
|
||
$("#company").css("display", "none");
|
||
var selelct=$("#search_code").select2({
|
||
data : data ,
|
||
placeholder:'请选择',//默认文字提示
|
||
allowClear: true,//允许清空
|
||
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
|
||
language: "zh-CN",
|
||
minimumInputLength: 0,
|
||
minimumResultsForSearch: 10,//数据超过十个启用搜索框
|
||
formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果
|
||
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
|
||
});
|
||
$(".select2-selection--single").css({'height':'30px','paddingTop':'4px'})
|
||
selelct.val('').trigger("change");
|
||
//refreshSelect();
|
||
selelct.on("change",function(e){
|
||
companyId= $(this).val();
|
||
dosearchMp();
|
||
});
|
||
}
|
||
},'json'); */
|
||
//简易公司combotree
|
||
|
||
|
||
//initialSelectionIds();
|
||
//alert();
|
||
$table=$("#table_mpoint").bootstrapTable({ // 对应table标签的id
|
||
url: ext.contextPath + '/work/mpoint/getlist.do', // 获取表格数据的url
|
||
//cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||
clickToSelect:true,
|
||
striped: true, //表格显示条纹,默认为false
|
||
pagination: true, // 在表格底部显示分页组件,默认false
|
||
pageList: [10, 20], // 设置页面可以显示的数据条数
|
||
pageSize: 10, // 页面数据条数
|
||
pageNumber: 1, // 首页页码
|
||
sidePagination: 'server', // 设置为服务器端分页
|
||
//responseHandler:responseHandler, //在渲染页面数据之前执行的方法,此配置很重要!!!!!!!
|
||
queryParams: queryParams,
|
||
queryParamsType: "limit",
|
||
sortName: 'id', // 要排序的字段
|
||
sortOrder: 'desc', // 排序规则
|
||
/* showColumns: true,
|
||
showRefresh: true, */
|
||
columns: [
|
||
{
|
||
checkbox: true, // 显示一个勾选框
|
||
formatter: stateFormatter
|
||
},{
|
||
field: 'mpointcode', // 返回json数据中的name
|
||
title: '测量点Code', // 表格表头显示文字
|
||
sortable : true,
|
||
align: 'center', // 左右居中
|
||
valign: 'middle' // 上下居中
|
||
},{
|
||
field: 'parmname', // 返回json数据中的name
|
||
title: '名称', // 表格表头显示文字
|
||
sortable : true,
|
||
align: 'center', // 左右居中
|
||
valign: 'middle' // 上下居中
|
||
},{
|
||
field: 'signaltype', // 返回json数据中的name
|
||
title: '信号类型', // 表格表头显示文字
|
||
sortable : true,
|
||
align: 'center', // 左右居中
|
||
valign: 'middle' // 上下居中
|
||
},{
|
||
field: 'active', // 返回json数据中的name
|
||
title: '启用状态', // 表格表头显示文字
|
||
sortable : true,
|
||
align: 'center', // 左右居中
|
||
valign: 'middle',
|
||
formatter : function(value, row) {
|
||
if('${Flag_Enable}'==value){
|
||
return "启用";
|
||
}else{
|
||
return "禁用";
|
||
}
|
||
|
||
} // 上下居中
|
||
}
|
||
],
|
||
onLoadSuccess: function(){ //加载成功时执行
|
||
adjustBootstrapTableView("table_mpoint");
|
||
|
||
|
||
},
|
||
onLoadError: function(){ //加载失败时执行
|
||
console.info("加载数据失败");
|
||
}
|
||
|
||
})
|
||
|
||
//绑定选中事件、取消事件、全部选中、全部取消
|
||
$table.on('check.bs.table check-all.bs.table uncheck.bs.table uncheck-all.bs.table', function (e,rows, obj) {
|
||
if('check'==e.type){
|
||
$('#table_mpoint .checked').removeClass("checked");
|
||
obj.parent().addClass("checked");
|
||
checkedItem = rows;
|
||
}else{
|
||
obj.parent().removeClass("checked");
|
||
checkedItem = "";
|
||
}
|
||
});
|
||
});
|
||
</script>
|
||
<div class="modal fade" id="mpSelectSubModal" >
|
||
<div class="modal-dialog modal-md" >
|
||
<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">
|
||
|
||
<div id="mpoint_mainAlertdiv"></div>
|
||
<div id="menu4SelectDiv"></div>
|
||
<div id="modal-body">
|
||
<!-- <div class="form-group">
|
||
<label class="form-label" id="companylabel">水厂:</label>
|
||
<label class="form-label" id="company" style="width:180px;border: none;background: transparent;" ></label>
|
||
<select class="form-control select2 " id="search_code" name ="search_code" style="width: 220px;"></select>
|
||
</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="input-group input-group-sm " style="width: 220px;margin-left:30px">
|
||
<input type="text" id="search_mpointname" name="search_mpointname" class="form-control pull-right" placeholder="点位名称">
|
||
</div>
|
||
<div class="input-group input-group-sm " style="width: 220px;">
|
||
|
||
<input type="text" id="search_mpointcode" name="search_mpointcode" class="form-control " placeholder="点位编码">
|
||
<div class="input-group-btn">
|
||
<button class="btn btn-default" onclick="dosearchMp();"><i class="fa fa-search"></i></button>
|
||
</div>
|
||
</div>
|
||
<!-- <button type="button" class="btn btn-default" onclick="addFun();"><i class="fa fa-plus"></i> 重置</button> -->
|
||
</div>
|
||
<!-- <div class="form-group " style="padding:0;">
|
||
<label class="form-label">班组</label>
|
||
<select class="form-control select2 " id="search_code" name ="search_code" style="width: 220px;"></select>
|
||
<div class="form-group pull-right" >
|
||
<div class="input-group input-group-sm" style="width: 500px;">
|
||
<input type="text" id="search_pid" name="search_pid" class="form-control pull-right" style="width: 200px;" placeholder="所属车间">
|
||
<input type="text" id="search_name" name="search_name" class="form-control pull-right" style="width: 200px;margin-right:10px" placeholder="系统名称">
|
||
<div class="input-group-btn">
|
||
<button class="btn btn-default" onclick="dosearch();"><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="table_mpoint"></table>
|
||
</div>
|
||
</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()" id="btn_save">确定</button>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div> |