Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/report/rptMpSetList.jsp

454 lines
19 KiB
Plaintext
Raw Normal View History

2026-01-16 14:13:44 +08:00
<%@ page language="java" pageEncoding="UTF-8" %>
<!-- 拖拽排序-->
<script type="text/javascript" src="<%=request.getContextPath()%>/plugins/bootstrap-table/jquery.tablednd.js"
charset="utf-8"></script>
<script type="text/javascript"
src="<%=request.getContextPath()%>/plugins/bootstrap-table/extensions/reorder-rows/bootstrap-table-reorder-rows.js"
charset="utf-8"></script>
<link rel="stylesheet"
href="<%=request.getContextPath()%>/plugins/bootstrap-table/extensions/reorder-rows/bootstrap-table-reorder-rows.css"/>
<%@page import="com.sipai.entity.scada.MPoint" %>
<% 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);%>
<%@ page import="com.sipai.entity.report.RptMpSet" %>
<% request.setAttribute("RptMpSetRog", RptMpSet.rog);%>
<% request.setAttribute("RptMpSetDt", RptMpSet.dt);%>
<style type="text/css">
.select2-container .select2-selection--single {
height: 34px;
line-height: 34px;
}
.select2-selection__arrow {
margin-top: 3px;
}
.div-row {
margin-left: 3px;
margin-right: 3px;
}
.div-border {
border-style: solid;
border-width: 1px;
text-align: center;
}
.right-border {
border-right: none;
}
.top-right-border {
border-top: none;
border-right: none;
}
.top-border {
border-top: none;
}
</style>
<script type="text/javascript">
var initFun = function () {
$('#tableMp').bootstrapTable('destroy');
$("#tableMp").bootstrapTable({ // 对应table标签的id
url: ext.contextPath + '/report/rptMpSet/getList.do', // 获取表格数据的url
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
striped: true, //表格显示条纹默认为false
pagination: true, // 在表格底部显示分页组件默认false
pageList: [10], // 设置页面可以显示的数据条数
pageSize: 10, // 页面数据条数
pageNumber: 1, // 首页页码
// paginationDetailHAlign: ' hidden',//去除分页的显示
sidePagination: 'server', // 设置为服务器端分页
queryParams: function (params) { // 请求服务器数据时发送的参数可以在这里添加额外的查询参数返回false则终止请求
return {
rows: params.limit, // 每页要显示的数据条数
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
sort: params.sort, // 要排序的字段
order: params.order,
id: '${param.spId}',
unitId: unitId
}
},
sortName: 'morder', // 要排序的字段
sortOrder: 'asc', // 排序规则
columns: [
{
field: '1',
title: '拖动', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
width: '50px',
formatter: function (value, row, index) {
//pointer-events:none; 为标签失去鼠标事件
return '<i class="fa fa-bars" style="color:#C0C0C0;pointer-events:none;" ></i>';
}
},
{
checkbox: true, // 显示一个勾选框
width: '40px'
},
{
field: '2', // 返回json数据中的name
title: '变量名', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
width: '24%',
formatter: function (value, row, index) {
if (row.mPoint != null && row.mPoint != '') {
return "<span style='display: block;user-select: none;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;pointer-events:none;' title='" + row.mPoint.mpointcode + "'>" + row.mPoint.mpointcode + "</span>";
} else {
if (row.mpid == '${RptMpSetRog}') {
return "<hr style='height:1px;width:30px;border:none;border-top:3px solid #555555;pointer-events:none;margin-top:0px;margin-bottom:0px;' />";
} else if (row.mpid == '${RptMpSetDt}') {
return "日期";
} else {
return "<span style='display: block;user-select: none;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;pointer-events:none;' >" + row.mpid + "</span>";
}
}
}
}, {
field: '3', // 返回json数据中的name
title: '变量描述', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
width: '25%',
formatter: function (value, row, index) {
if (row.mPoint != null && row.mPoint != '') {
return "<span style='display: block;user-select: none;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;pointer-events:none;' title='" + row.mPoint.parmname + "'>" + row.mPoint.parmname + "</span>";
} else {
if (row.mpid == '${RptMpSetRog}') {
return "<hr style='height:1px;width:30px;border:none;border-top:3px solid #555555;pointer-events:none;margin-top:0px;margin-bottom:0px;' />";
} else if (row.mpid == '${RptMpSetDt}') {
return "date";
} else {
return "<span style='display: block;user-select: none;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;pointer-events:none;' >" + "组合点" + "</span>";
}
}
}
}, {
field: '4', // 返回json数据中的name
title: '单位', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
width: '6%',
formatter: function (value, row, index) {
if (row.mPoint != null && row.mPoint != '') {
return row.mPoint.unit;
} else {
return '';
}
}
}, {
field: '5', // 返回json数据中的name
title: '数据来源', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
width: '9%',
formatter: function (value, row, index) {
if (row.mPoint != null && row.mPoint != '') {
if (row.mPoint.type == '${Flag_Type_KPI}') {
return '计算点';
}
if (row.mPoint.type == '${Flag_Type_Hand}') {
return '手工点';
}
if (row.mPoint.type == '${Flag_Type_Data}') {
return '采集点';
}
}
}
}, {
field: '6', // 返回json数据中的name
title: '数据类型', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
width: '9%',
formatter: function (value, row, index) {
return row.dataType;
}
}, {
field: '7', // 返回json数据中的name
title: '采集方式', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
width: '9%',
formatter: function (value, row, index) {
if (row.rptCollectMode != null && row.rptCollectMode != '') {
return row.rptCollectMode.content;
}
}
}, {
field: '8', // 返回json数据中的name
title: '顺序', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
width: '6%',
formatter: function (value, row, index) {
return row.morder;
}
},
{
title: "操作",
align: 'center',
valign: 'middle',
width: '12%',
formatter: function (value, row, index) {
var buts = '';
buts += '<button class="btn btn-default btn-sm" onclick="editFunMp(\'' + row.id + '\',\'' + row.unitId + '\')" data-toggle="tooltip" title="编辑"><i class="fa fa-edit "></i><span class="hidden-md hidden-lg"> 编辑</span></button>';
buts += '<button class="btn btn-default btn-sm" onclick="doDeleteMp(\'' + row.id + '\')" data-toggle="tooltip" title="删除"><i class="fa fa-trash-o "></i><span class="hidden-md hidden-lg"> 删除</span></button>';
buts = '<div class = "btn-group">' + buts + '</div>';
return buts;
}
}
],
onLoadSuccess: function () { //加载成功时执行
adjustBootstrapTableView("tableMp");
},
onLoadError: function () { //加载失败时执行
console.info("加载数据失败");
},
//当拖拽结束后,整个表格的数据
onReorderRow: function (newData) {
//这里的newData是整个表格数据数组形式
var array = [];
for (let i = 0; i < newData.length; i++) {
let data = {id: newData[i].id, morder: newData[i].morder};
array.push(data)
}
$.post(ext.contextPath + '/report/rptMpSet/dosort.do', {jsondata: JSON.stringify(array)},
/*function (data) {
if (data == 1) {
//$("#table").bootstrapTable('refresh');
} else {
showAlert('d', '数据错误', 'mainAlertdiv');
}
}*/
);
}
});
$("#tableMp").tableDnD();
}
//新增合并点
function doAddMp() {
$.post(ext.contextPath + '/report/rptMpSet/doadd.do', {spId: '${param.spId}'}, function (data) {
$("#subDivMpoint").html(data);
openModal('subModalMp');
});
}
//编辑合并点
function editFunMp(id, unitId) {
$.post(ext.contextPath + '/report/rptMpSet/doedit.do', {id: id}, function (data) {
$("#subDivMpoint").html(data);
openModal('subModalMp');
});
}
//弹出选择测量点页面--SIPAIIS_WMSD通用选择测量点方法
function doImportMp() {
var allTableData = $("#tableMp").bootstrapTable('getData');
var mpids = "";
$.each(allTableData, function (index, item) {
if (mpids != "") {
mpids += ",";
}
mpids += item.mpid;
})
$.post(ext.contextPath + '/work/mpoint/mpointList4Layer.do', {
// mpids: mpids,
mpids: '',
fucname: 'choiceMeasurePointsMpList'
}, function (data) {
$("#subDivMpointList").html(data);
openModal('subModalMpoint');
});
}
//选择点位
function choiceMeasurePointsMpList(datas) {
$.post(ext.contextPath + '/report/rptMpSet/dosaveMp.do', {ids: datas, id: '${param.spId}'}, function (data) {
if (data.code > 0) {
$("#tableMp").bootstrapTable('refresh');
} else {
showAlert('d', '导入失败', 'mainAlertdiv');
}
}, 'json');
}
//插入横杠
function doRodMp() {
$.post(ext.contextPath + '/report/rptMpSet/dosaveRod.do', {id: '${param.spId}'}, function (data) {
if (data.code > 0) {
$("#tableMp").bootstrapTable('refresh');
} else {
showAlert('d', '新增成功', 'mainAlertdiv');
}
}, 'json');
}
//插入日期
function doDtMp() {
$.post(ext.contextPath + '/report/rptMpSet/dosaveDt.do', {id: '${param.spId}'}, function (data) {
if (data.code > 0) {
$("#tableMp").bootstrapTable('refresh');
} else {
showAlert('d', '新增成功', 'mainAlertdiv');
}
}, 'json');
}
//删除
function doDeletesMp() {
var checkedItems = $("#tableMp").bootstrapTable('getSelections');
var datas = "";
$.each(checkedItems, function (index, item) {
datas += item.id + ",";
});
if (datas == "") {
showAlert('d', '请先选择记录', 'mainAlertdiv');
} else {
swal({
text: "您确定要删除此记录?",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
})
.then(function (willDelete) {
if (willDelete) {
$.post(ext.contextPath + '/report/rptMpSet/dodeletes.do', {
ids: datas,
rptMpSetId: '${param.spId}'
}, function (data) {
if (data.code > 0) {
$("#tableMp").bootstrapTable('refresh');
} else {
showAlert('d', '删除失败', 'mainAlertdiv');
}
}, 'json');
}
});
}
}
var doDeleteMp = function (id) {
stopBubbleDefaultEvent();
swal({
text: "您确定要删除此记录?",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
})
.then(function (willDelete) {
if (willDelete) {
$.post(ext.contextPath + '/report/rptMpSet/dodelete.do', {
id: id,
rptMpSetId: '${param.spId}'
}, function (data) {
if (data.code == 1) {
$("#tableMp").bootstrapTable('refresh');
} else {
showAlert('d', '删除失败', 'mainAlertdiv');
}
}, 'json');
}
});
};
var doPrompt = function () {
//alert('可拖拽排序');
layer.msg("可拖拽排序!");
}
$(function () {
initFun();
})
</script>
<div class="modal fade" id="subModalMpList">
<div class="modal-dialog" style="width:1000px">
<div class="modal-content">
<div class="modal-body">
<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="btn-group" style="width: 500px;padding-top:10px;">
<button type="button" class="btn btn-default" onclick="doImportMp();"><i class="fa fa-plus"></i>
导入
</button>
<button type="button" class="btn btn-default" onclick="doRodMp();"><i
class="fa fa-long-arrow-right"></i>
插入横杠
</button>
<button type="button" class="btn btn-default" onclick="doDtMp();"><i
class="fa fa-plus"></i>
插入日期
</button>
<button type="button" class="btn btn-default" onclick="doAddMp();"><i class="fa fa-plus"></i>
组合点
</button>
<button type="button" class="btn btn-default" onclick="doDeletesMp();"><i
class="fa fa-trash-o"></i>
删除
</button>
<%--<button type="button" class="btn btn-default" data-toggle="modal" data-target="#myModal"
onclick="doPrompt();"><i class="fa fa-question-circle"></i>
</button>--%>
</div>
<div class="box-body ">
<table id="tableMp" style="table-layout:fixed;" data-use-row-attr-func="true"
data-reorderable-rows="true">
</table>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default " data-dismiss="modal">关闭</button>
</div>
</div>
</div>
</div>