316 lines
11 KiB
Plaintext
316 lines
11 KiB
Plaintext
<%@ 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 () {
|
||
$('#table22').bootstrapTable('destroy');
|
||
$("#table22").bootstrapTable({ // 对应table标签的id
|
||
url: ext.contextPath + '/report/rptInfoSet/getSheetAll.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.id}'
|
||
}
|
||
},
|
||
sortName: 'morder', // 要排序的字段
|
||
sortOrder: 'asc', // 排序规则
|
||
|
||
columns: [
|
||
{
|
||
checkbox: true, // 显示一个勾选框
|
||
width: '40px'
|
||
},
|
||
{
|
||
field: '1', // 返回json数据中的name
|
||
title: 'sheet名', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
width: '100%',
|
||
formatter: function (value, row, index) {
|
||
return row.sheetName;
|
||
}
|
||
}
|
||
],
|
||
onLoadSuccess: function () { //加载成功时执行
|
||
adjustBootstrapTableView("table22");
|
||
},
|
||
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');
|
||
}
|
||
}*/
|
||
);
|
||
}
|
||
});
|
||
$("#table22").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 checkedItems = $("#table22").bootstrapTable('getSelections');
|
||
var datas = "";
|
||
$.each(checkedItems, function (index, item) {
|
||
datas += item.sheetName + ",";
|
||
});
|
||
$.post(ext.contextPath + '/report/rptInfoSet/dosave4Sheet.do', {
|
||
names: datas,
|
||
rptInfoSetId: '${param.id}'
|
||
}, function (data) {
|
||
closeModal('subModalSheet')
|
||
$("#sheetTable").bootstrapTable('refresh');
|
||
});
|
||
}
|
||
|
||
//选择点位
|
||
function choiceMeasurePointsMpList(datas) {
|
||
$.post(ext.contextPath + '/report/rptMpSet/dosaveMp.do', {ids: datas, id: '${param.spId}'}, function (data) {
|
||
if (data.code > 0) {
|
||
$("#table22").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) {
|
||
$("#table22").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) {
|
||
$("#table22").bootstrapTable('refresh');
|
||
} else {
|
||
showAlert('d', '新增成功', 'mainAlertdiv');
|
||
}
|
||
}, 'json');
|
||
}
|
||
|
||
//删除
|
||
function doDeletesMp() {
|
||
var checkedItems = $("#table22").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) {
|
||
$("#table22").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) {
|
||
$("#table22").bootstrapTable('refresh');
|
||
} else {
|
||
showAlert('d', '删除失败', 'mainAlertdiv');
|
||
}
|
||
}, 'json');
|
||
}
|
||
});
|
||
};
|
||
|
||
var doPrompt = function () {
|
||
//alert('可拖拽排序');
|
||
layer.msg("可拖拽排序!");
|
||
}
|
||
|
||
$(function () {
|
||
initFun();
|
||
})
|
||
</script>
|
||
<div class="modal fade" id="subModalSheet">
|
||
<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">×</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>
|
||
</div>
|
||
<div class="box-body ">
|
||
<table id="table22" 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> |