346 lines
16 KiB
Plaintext
346 lines
16 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 companyId = '';
|
|||
|
|
var signalType = "-1";
|
|||
|
|
var dosearchMp = function () {
|
|||
|
|
$("#table_mpoint").bootstrapTable('refresh');
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
function doselect(dialog, grid) {
|
|||
|
|
var checkedItem = $("#table_mpoint").bootstrapTable('getAllSelections');
|
|||
|
|
if (checkedItem != null && checkedItem != "") {
|
|||
|
|
// console.log(checkedItem);
|
|||
|
|
var mpointids = "";
|
|||
|
|
for (var i = 0; i < checkedItem.length; i++) {
|
|||
|
|
mpointids += checkedItem[i].id + ",";
|
|||
|
|
}
|
|||
|
|
$.post(ext.contextPath + '/data/saveMPoints.do', {
|
|||
|
|
companyId: companyId,
|
|||
|
|
mpointids: mpointids,
|
|||
|
|
pid: '${param.pid}'
|
|||
|
|
}, function (resp) {
|
|||
|
|
//console.info(checkedItem.id)
|
|||
|
|
$("#table_Detail").bootstrapTable('refresh');
|
|||
|
|
initProgrammeTreeView();
|
|||
|
|
$("#table").bootstrapTable('refresh');
|
|||
|
|
closeModal('mpSubModal');
|
|||
|
|
}, '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_name').val(),
|
|||
|
|
search_mpointcode: $('#search_mpointcode').val(),
|
|||
|
|
pSectionId: $('#processSection').val(),
|
|||
|
|
companyId: companyId,
|
|||
|
|
signalType: signalType
|
|||
|
|
};
|
|||
|
|
/* var status =$('#switchBtn').bootstrapSwitch('state')
|
|||
|
|
if(status){
|
|||
|
|
temp.checkedIds=getCheckedIds();
|
|||
|
|
}
|
|||
|
|
*/
|
|||
|
|
return temp;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$(function () {
|
|||
|
|
//简易公司combotree
|
|||
|
|
$.post(ext.contextPath + '/user/getUnitForTreeFromTop.do', {unitId: unitId}, function (data) {
|
|||
|
|
if (data.length == 1 && !data[0].hasOwnProperty("nodes")) {
|
|||
|
|
//当登陆者的pid以下没有子节点时显示单独一个span
|
|||
|
|
$("#search_code").val(data[0].id);
|
|||
|
|
$("#companyselect").hide();
|
|||
|
|
$("#company").text("公司: " + data[0].text);
|
|||
|
|
companyId = data[0].id;
|
|||
|
|
dosearchMp();
|
|||
|
|
//initFun();
|
|||
|
|
} else if ((data.length == 1 && data.nodes != "") || data.length > 1) {
|
|||
|
|
//第一次加载时赋值
|
|||
|
|
$("#search_code").val(data[0].id);
|
|||
|
|
$("#cname_input").val(data[0].text);
|
|||
|
|
companyId = data[0].id;
|
|||
|
|
dosearchMp();
|
|||
|
|
//initFun();
|
|||
|
|
//$table.bootstrapTable('refresh');//异步加载重新刷新,待修改
|
|||
|
|
$('#companytree').treeview({
|
|||
|
|
data: data,
|
|||
|
|
showBorder: false,
|
|||
|
|
levels: 3,
|
|||
|
|
});
|
|||
|
|
$('#companytree').on('nodeSelected', function (event, data) {
|
|||
|
|
$("#search_code").val(data.id);
|
|||
|
|
$("#cname_input").val(data.text);
|
|||
|
|
document.getElementById('ul_tree').style.display = "none";
|
|||
|
|
companyId = data.id;
|
|||
|
|
dosearchMp();
|
|||
|
|
//initFun();
|
|||
|
|
});
|
|||
|
|
} else {
|
|||
|
|
//待完善
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$.post(ext.contextPath + "/user/processSection/getProcessSection4Select.do", {companyId: companyId}, function (data) {
|
|||
|
|
$("#processSection").empty();
|
|||
|
|
var selelct_ = $("#processSection").select2({
|
|||
|
|
data: data,
|
|||
|
|
cache: false,
|
|||
|
|
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");
|
|||
|
|
selelct_.on("change", function (e) {
|
|||
|
|
$("#table_mpoint").bootstrapTable('refresh');
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
}, 'json');
|
|||
|
|
|
|||
|
|
}, 'json');
|
|||
|
|
//防止点击树的+号收起下拉框
|
|||
|
|
$("#ul_tree").on("click", function (e) {
|
|||
|
|
event.stopPropagation();
|
|||
|
|
});
|
|||
|
|
//点击空白隐藏树
|
|||
|
|
$(document).click(function (e) {
|
|||
|
|
var divTree = $('#ul_tree'); // 设置目标区域
|
|||
|
|
if (!divTree.is(e.target) && divTree.has(e.target).length === 0) {
|
|||
|
|
divTree.hide()
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
//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 = "";
|
|||
|
|
// }
|
|||
|
|
// });
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
function changeSignalType(obj) {
|
|||
|
|
var value = $(obj).val();
|
|||
|
|
signalType = value;
|
|||
|
|
dosearchMp();
|
|||
|
|
}
|
|||
|
|
</script>
|
|||
|
|
<div class="modal fade" id="mpSubModal">
|
|||
|
|
<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>
|
|||
|
|
<ul id="companyselect" style="list-style-type:none;padding-left:0px;width:300px;">
|
|||
|
|
<li class="dropdown" style="width:300px;">
|
|||
|
|
<!-- Menu toggle button -->
|
|||
|
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown"
|
|||
|
|
style="width:300px;"
|
|||
|
|
onclick="document.getElementById('ul_tree').style.display = 'block';">
|
|||
|
|
<div class="input-group">
|
|||
|
|
<span class="input-group-addon"
|
|||
|
|
style="height:31px;color:#000000;border-top-left-radius: 4px;border-bottom-left-radius: 4px;font-weight:bold">公司:</span>
|
|||
|
|
<input class="form-control " id="cname_input" name="cname_input"
|
|||
|
|
style="height:31px;width: 220px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;"
|
|||
|
|
readonly/>
|
|||
|
|
</div><!-- /input-group -->
|
|||
|
|
</a>
|
|||
|
|
<ul id="ul_tree" class="dropdown-menu" data-stopPropagation="true">
|
|||
|
|
<li class="header">
|
|||
|
|
<div id="companytree" style="width: 275px;overflow:auto;"></div>
|
|||
|
|
</li>
|
|||
|
|
</ul>
|
|||
|
|
</li>
|
|||
|
|
</ul>
|
|||
|
|
<div class="form-group pull-right form-inline">
|
|||
|
|
<div class="input-group input-group-sm " style="width: 150px;margin-left:30px">
|
|||
|
|
<input type="text" id="search_name" name="search_name" class="form-control pull-right"
|
|||
|
|
placeholder="点位查询">
|
|||
|
|
<div class="input-group-btn">
|
|||
|
|
<button class="btn btn-default" onclick="dosearchMp();"><i class="fa fa-search"></i>
|
|||
|
|
</button>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="input-group input-group-sm " style="width: 200px;">
|
|||
|
|
<label class="col-sm-4 control-label" style="padding:0px 10px 0px 10px;line-height:40px;">工艺段</label>
|
|||
|
|
<div class="col-sm-8 control-label" style="padding: 0px;line-height:40px;">
|
|||
|
|
<select class="form-control select2 " id="processSection" name="processSection"
|
|||
|
|
style="width: 120px;"></select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="input-group input-group-sm " style="width: 150px;">
|
|||
|
|
<label class="col-sm-4 control-label" style="padding:0px 10px 0px 10px;line-height: 40px;">信号</label>
|
|||
|
|
<div class="col-sm-8 control-label" style="padding: 0px;line-height:40px;">
|
|||
|
|
<select id="signalType" name="signalType" class="form-control select2"
|
|||
|
|
style="margin-top:5px;height: 30px;" onchange="changeSignalType(this);">
|
|||
|
|
<option value="-1">全部</option>
|
|||
|
|
<option value="AI">AI</option>
|
|||
|
|
<option value="DI">DI</option>
|
|||
|
|
</select>
|
|||
|
|
</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()">确定</button>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-content -->
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-dialog -->
|
|||
|
|
</div>
|