Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/work/mpointList4LayerSingle.jsp
2026-01-16 14:13:44 +08:00

412 lines
16 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ 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);%>
<%request.setAttribute("Flag_Type_KPI", MPoint.Flag_Type_KPI);%>
<%request.setAttribute("Flag_Type_Hand", MPoint.Flag_Type_Hand);%>
<%request.setAttribute("Flag_Type_Data", MPoint.Flag_Type_Data);%>
<style type="text/css">
.select2-container .select2-selection--single {
height: 34px;
line-height: 34px;
}
.select2-selection__arrow {
margin-top: 3px;
}
</style>
<script type="text/javascript">
var mpids = '${mpids}';
var detailId = '${detailId}';
var dosearchMp = function () {
$("#table_mpoint").bootstrapTable('refresh');
};
function doselect() {
//fucname为传的方法名
var fucname = '${param.fucname}';
var datas = "";
$.each(mpointIds, function (index, item) {
if (datas != "") {
datas += ",";
}
datas += item;
});
if (datas == "") {
showAlert('d', '请先选择测量点', 'mainAlertdiv');
} else {
//调用保存点位方法
eval(fucname + "('" + datas + "','${detailId}')")
closeModal('subModalMpoint');
}
};
//显示已经勾选的数据
/*function stateFormatter(value, row, index) {
var flag = false;
if (row.id == '${mpids}') {
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(),
signaltype: $('#signaltype').val(),
type: $('#type').val(),
unitId: unitId,
existenceIds: "${param.existenceIds}"
};
return temp;
}
var mpointIds = []; //保存选中ids
// function initialSelectionIds() {
// var check_array = mpids.split(",");
// if (check_array != null && check_array.length > 0) {
// mpointIds = new Array(check_array.length);
// for (var i = 0; i < check_array.length; i++) {
// mpointIds[i] = check_array[i];
// }
// }
// }
function initialSelectionIds() {
var check_array = mpids.split(",");
// console.log(check_array);
// if (check_array != null && check_array.length > 0) {
// mpointIds = new Array(check_array.length);
// for (var i = 0; i < check_array.length; i++) {
// mpointIds[i] = check_array[i];
// }
// }
}
$(function () {
initialSelectionIds();
$('#table_mpoint').bootstrapTable('destroy');
$table = $("#table_mpoint").bootstrapTable({ // 对应table标签的id
url: ext.contextPath + '/work/mpoint/getList4Layer.do', // 获取表格数据的url
//cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
clickToSelect: true,
striped: true, //表格显示条纹默认为false
pagination: true, // 在表格底部显示分页组件默认false
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
pageSize: 10, // 页面数据条数
pageNumber: 1, // 首页页码
sidePagination: 'server', // 设置为服务器端分页
singleSelect: true, // 单选checkbox
responseHandler: responseHandler, //在渲染页面数据之前执行的方法,此配置很重要!!!!!!!
queryParams: queryParams,
queryParamsType: "limit",
sortName: 'id', // 要排序的字段
sortOrder: 'desc', // 排序规则
/* showColumns: true,
showRefresh: true, */
columns: [
{
field : 'state',
radio: true
},
{
field: 'parmname', // 返回json数据中的name
title: '测量点名称', // 表格表头显示文字
sortable: true,
align: 'left', // 左右居中
valign: 'middle',
width: '21%',
formatter: function (value, row) {
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.parmname + "'>" + row.parmname + "</span>";
}
},
{
field: 'mpointcode',
title: '测量点Code',
sortable: true,
align: 'left',
valign: 'middle',
width: '21%',
formatter: function (value, row) {
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.mpointcode + "'>" + row.mpointcode + "</span>";
}
},
{
field: 'parmvalue/unit',
title: '当前值/单位',
sortable: false,
align: 'center',
valign: 'middle',
width: '10%',
formatter: function (value, row) {
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.parmvalue + '/' + row.unit + "'>" + row.parmvalue + '/' + row.unit + "</span>";
}
},
// {
// {
// field: 'parmvalue',
// title: '当前值',
// sortable: false,
// align: 'center',
// valign: 'middle',
// width: '8%'
// },
// {
// field: 'unit',
// title: '单位',
// sortable: false,
// align: 'center',
// valign: 'middle',
// width: '5%'
// },
{
field: 'measuredt',
title: '时间',
sortable: false,
align: 'center',
valign: 'middle',
width: '15%',
formatter: function (value, row, index) {
if (value != null) {
return value.substring(0, 19);
} else {
return '';
}
},
},
{
field: 'numtail',
title: '精度',
sortable: false,
align: 'center',
valign: 'middle',
width: '5%'
},
{
field: 'signaltype',
title: '信号类型',
sortable: false,
align: 'center',
valign: 'middle',
width: '7%'
},
{
field: 'type',
title: '数据类型',
sortable: false,
align: 'center',
valign: 'middle',
width: '7%',
formatter: function (value, row) {
if ('${Flag_Type_Data}' == value) {
return '自控';
}
if ('${Flag_Type_Hand}' == value) {
return '手动';
}
if ('${Flag_Type_KPI}' == value) {
return 'KPI';
}
}
},
{
field: '',
title: '工艺段',
sortable: false,
align: 'center',
valign: 'middle',
width: '8%'
},
{
field: 'equipmentid',
title: '所属设备',
sortable: false,
align: 'center',
valign: 'middle',
width: '8%',
formatter: function (value, row) {
if (row.equipmentCard != null && row.equipmentCard != '') {
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.equipmentCard.equipmentname + "'>" + row.equipmentCard.equipmentname + "</span>";
}
}
}
],
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) {
var ids = $.map(!$.isArray(rows) ? [rows] : rows, function (row) {
return row.id;
});
func = $.inArray(e.type, ['check', 'check-all']) > -1 ? 'union' : 'difference';
mpointIds = _[func](mpointIds, ids);
if ('check' == e.type) {
obj.parent().addClass("checked");
} else {
obj.parent().removeClass("checked");
}
//adjustBootstrapTableView("table_user");
});
});
//选中事件操作数组
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, mpointIds) != -1; //判断当前行的数据id是否存在与选中的数组存在则将多选框状态变为true
});
return res;
}
//信号类型
var selelct_signaltype = $("#signaltype").select2({
data: null,
placeholder: '请选择',//默认文字提示
allowClear: false,//允许清空
escapeMarkup: function (markup) {
return markup;
}, // 自定义格式化防止xss注入
language: "zh-CN",
minimumInputLength: 0,
minimumResultsForSearch: 10,//数据超过十个启用搜索框
});
//数据类型
var selelct_type = $("#type").select2({
data: null,
placeholder: '请选择',//默认文字提示
allowClear: false,//允许清空
escapeMarkup: function (markup) {
return markup;
}, // 自定义格式化防止xss注入
language: "zh-CN",
minimumInputLength: 0,
minimumResultsForSearch: 10,//数据超过十个启用搜索框
});
//设置下拉样式
$(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'})
selelct_signaltype.on("change", function (e) {
$("#table_mpoint").bootstrapTable('refresh');
});
selelct_type.on("change", function (e) {
$("#table_mpoint").bootstrapTable('refresh');
});
</script>
<div class="modal fade" id="subModalMpoint">
<div class="modal-dialog modal-lg" style="width: 1200px">
<div class="modal-content">
<%--<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">选择测量点</h4>
</div>--%>
<div class="modal-body">
<div id="mpoint_mainAlertdiv"></div>
<div id="menu4SelectDiv"></div>
<div class="box box-primary">
<div class="box-header with-border">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span></button>
<h3 class="box-title">选择测量点</h3>
</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">
<label class="form-label ">信号类型:</label>
<select id="signaltype" name="signaltype" class="form-control select2"
style="width: 100px;">
<option value="all" selected>全部</option>
<option value="AI">AI</option>
<option value="DI">DI</option>
</select>
</div>
<div class="input-group input-group-sm">
<label class="form-label ">数据类型:</label>
<select id="type" name="type" class="form-control select2" style="width: 100px;">
<option value="all" selected>全部</option>
<option value="${Flag_Type_Data}">自控</option>
<option value="${Flag_Type_Hand}">手动</option>
<option value="${Flag_Type_KPI}">KPI</option>
</select>
</div>
<div class="input-group input-group-sm" style="width: 220px;">
<input type="text" id="search_name" name="search_name" class="form-control "
placeholder="名称/code/设备">
<div class="input-group-btn">
<button class="btn btn-default" onclick="dosearchMp();"><i class="fa fa-search"></i>
</button>
</div>
</div>
</div>
<div class="table-scrollable">
<table id="table_mpoint" style="table-layout:fixed;"></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>
</div>
</div>