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

537 lines
22 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" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ page import="com.sipai.entity.base.ServerObject" %>
<%@ page import="com.sipai.entity.report.RptSpSet" %>
<%@ page import="com.sipai.entity.report.RptLog" %>
<% request.setAttribute("RptSpSet_Type_Cal", RptSpSet.RptSpSet_Type_Cal); %>
<% request.setAttribute("RptSpSet_Type_Insuser", RptSpSet.RptSpSet_Type_Insuser); %>
<% request.setAttribute("RptSpSet_Type_Confirm", RptSpSet.RptSpSet_Type_Confirm); %>
<% request.setAttribute("RptSpSet_Type_Checkuser", RptSpSet.RptSpSet_Type_Checkuser); %>
<% request.setAttribute("RptSpSet_Type_Rptdt", RptSpSet.RptSpSet_Type_Rptdt); %>
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security" %>
<%String contextPath = request.getContextPath();%>
<!-- 引入daterangepicker-->
<link rel="stylesheet" href="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/daterangepicker.css"/>
<script type="text/javascript" src="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/moment.min.js"
charset="utf-8"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/daterangepicker.js"
charset="utf-8"></script>
<script type="text/javascript">
function getNowFormatDate() {
var date = new Date();
var seperator1 = "-";
var seperator2 = ":";
var month = date.getMonth() + 1;
var strDate = date.getDate();
var hour = date.getHours();
var minute = date.getMinutes();
var second = date.getSeconds();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate;
}
if (hour >= 0 && hour <= 9) {
hour = "0" + hour;
}
if (minute >= 0 && minute <= 9) {
minute = "0" + minute;
}
if (second >= 0 && second <= 9) {
second = "0" + second;
}
var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
+ " " + hour + seperator2 + minute
+ seperator2 + second;
return currentdate;
}
//----------------------------------------------------------------------------------------------------------------------
var beginTimeStore2 = '';
var endTimeStore2 = '';
function initDate2() {
//定义locale汉化插件
beginTimeStore2 = moment().subtract(6, 'days').format('YYYY-MM-DD');
endTimeStore2 = moment().subtract(-1, 'days').format('YYYY-MM-DD');
var locale = {
"format": 'YYYY-MM-DD',
"separator": " ~ ",
"applyLabel": "确定",
"cancelLabel": "取消",
"fromLabel": "起始时间",
"toLabel": "结束时间'",
"customRangeLabel": "自定义",
"weekLabel": "W",
"daysOfWeek": ["日", "一", "二", "三", "四", "五", "六"],
"monthNames": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月",
"九月", "十月", "十一月", "十二月"],
"firstDay": 1
};
$('#reservationtime2').daterangepicker(
{
"timePicker": false,
"timePicker24Hour": false,
"linkedCalendars": false,
"autoUpdateInput": false,
"timePickerIncrement": 10,
"locale": locale,
//汉化按钮部分
ranges: {
'今日': [moment(), moment().subtract(-1, 'days')],
'昨日': [moment().subtract(1, 'days'), moment()],
'最近7日': [moment().subtract(6, 'days'),
moment().subtract(-1, 'days')],
'本月': [moment().startOf('month'),
moment().endOf('month').subtract(-1, 'days')],
'上月': [
moment().subtract(1, 'month').startOf('month'),
moment().subtract(1, 'month').endOf('month')
.subtract(-1, 'days')]
},
startDate: beginTimeStore2,
endDate: endTimeStore2
},
function (start, end, label) {
beginTimeStore2 = start.format(this.locale.format);
endTimeStore2 = end.format(this.locale.format);
if (!this.startDate) {
this.element.val('');
} else {
this.element.val(this.startDate
.format(this.locale.format)
+ this.locale.separator
+ this.endDate.format(this.locale.format));
}
});
$('#reservationtime2').val(
beginTimeStore2 + locale.separator + endTimeStore2);
//$('#reservationtime2').daterangepicker({autoUpdateInput:false})
};
//----------------------------------------------------------------------------
var dosearch = function () {
$("#table").bootstrapTable('refresh');
};
var getListFun = function () {
$("#table").bootstrapTable({ // 对应table标签的id
url: ext.contextPath + '/report/rptCreate/getList4View.do', // 获取表格数据的url
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
striped: true, //表格显示条纹默认为false
pagination: true, // 在表格底部显示分页组件默认false
pageList: [10], // 设置页面可以显示的数据条数
pageSize: 10, // 页面数据条数
pageNumber: 1, // 首页页码
sidePagination: 'server', // 设置为服务器端分页
queryParams: function (params) { // 请求服务器数据时发送的参数可以在这里添加额外的查询参数返回false则终止请求
var rpt_sdt = $("#rpt_sdt").val();
var rpt_edt = $("#rpt_edt").val();
return {
rows: params.limit, // 每页要显示的数据条数
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
sort: params.sort, // 要排序的字段
order: params.order,
classId: '${param.classId}',
search_name: $('#search_name').val(),
unitId: '${param.unitId}',
stdt: rpt_sdt,
eddt: rpt_edt
}
},
sortName: 'rptdt', // 要排序的字段
sortOrder: 'desc', // 排序规则
onClickRow: function (row) {//单击行事件,执行查看功能
},
columns: [
{
width: '40px',
checkbox: true, // 显示一个勾选框
},
{
field: 'rptdt', // 返回json数据中的name
title: '日期', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
width: '10%',
formatter: function (value, row, index) {
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + value.substring(0, 10) + "'>" + value.substring(0, 10) + "</span>";
}
},
{
field: 'rptname', // 返回json数据中的name
title: '生成报表名', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
width: '35%',
formatter: function (value, row, index) {
return '<span onclick="onlineExcel4minio(\'' + row.id + '\',\'view\')" style="color:#004B97;cursor:pointer;">' + row.rptname + '</span>';
}
},
{
field: 'upsdt', // 返回json数据中的name
title: '生成时间 ', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
width: '15%',
formatter: function (value, row, index) {
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + value.substring(0, 19) + "'>" + value.substring(0, 19) + "</span>";
}
},
{
field: 'inputusername', // 返回json数据中的name
title: '生成人 ', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
width: '13%'
},
{
field: 'memo', // 返回json数据中的name
title: '备注', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
width: '12%'
},
{
title: "操作",
align: 'center',
valign: 'middle',
width: '15%',
formatter: function (value, row, index) {
var buts = '';
buts += '<security:authorize buttonUrl="report/rptCreate/down.do"><button class="btn btn-default btn-sm" onclick="fileDownloadFun(\'' + row.id + '\')" data-toggle="tooltip" title="文件下载"><i class="fa fa-download"></i><span class="hidden-md hidden-lg"> 文件下载</span></button></security:authorize>';
// buts += '<button class="btn btn-default btn-sm" onclick="onlineExcel4minio(\'' + row.id + '\')" data-toggle="tooltip" title="在线预览"><i class="fa fa-eye"></i><span class="hidden-md hidden-lg"> 在线预览</span></button>';
buts += '<button class="btn btn-default btn-sm" onclick="onlineExcel4minio(\'' + row.id + '\',\'view\')" data-toggle="tooltip" title="在线预览"><i class="fa fa-eye"></i><span class="hidden-md hidden-lg"> 在线预览</span></button>';
buts += '<button class="btn btn-default btn-sm" onclick="deleteFun(\'' + 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("table");
},
onLoadError: function () { //加载失败时执行
console.info("加载数据失败");
}
});
};
function onlineExcel(filename) {
window.open(getRootPath() + '_tohtm/Report/data/' + filename + '.htm', 'onlineExcel', 'width=' + (window.screen.availWidth - 10) + ',height=' + (window.screen.availHeight - 30) + ',top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=no,location=no, status=no');
}
// function onlineExcel4minio(id) {
// window.open(ext.contextPath + '/report/rptCreate/viewFile.do?id=8f6bd39a19c0418285a5d70d7dd11c7a&sheetName=泵房运行操作记录(3系统)表零', 'onlineExcel', 'width=' + (window.screen.availWidth - 10) + ',height=' + (window.screen.availHeight - 30) + ',top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=no,location=no, status=no');
// }
//后台解析报表渲染到前端
// function onlineExcel4minio(id) {
// $.post(ext.contextPath + '/report/rptCreate/viewFile.do', { id: '8f6bd39a19c0418285a5d70d7dd11c7a', sheetName: '泵房运行操作记录(3系统)表零' }, function (data) {
// $('#viewFile').html(data);
// });
// layer.open({
// type: 1,
// title: false,
// //closeBtn: 0,
// area: '90%',
// //fixed: false,
// skin: 'bgfff', //没有背景色
// //shadeClose: true,
// maxmin: true,
// content: $('#viewFile')
// });
// }
//后台解析报表渲染到前端
function onlineExcel4minio(id, layerType) {
window.parent.window.onlineExcel4minio(id, layerType);
}
//后台解析报表渲染到前端
/*function onlineExcel4minio(id) {
var sheetName = '';
//获取该excel的所有sheet 默认加载第一个sheet
$.post(ext.contextPath + '/report/rptCreate/getSheet.do', {id: id}, function (data) {
var datastr = eval('(' + data + ')');
if (datastr.code == 1) {
var msg = datastr.msg;
var arr = msg.split(",");
var sheetstr = '';
//循环sheet
for (var i = 0; i < arr.length; i++) {
sheetstr += '<div style="border:1px solid #696969;font-weight: bold;float: left; margin-left: 5px;cursor: pointer;" onclick="viewFile(\'' + id + '\',\'' + arr[i] + '\');">' + arr[i] + '</div>';
}
$('#viewFile_top').html(sheetstr);
//获取excel数据前端渲染
sheetName = arr[0];
viewFile_open(id, sheetName);
}
});
}*/
//赋值并打开页面
function viewFile_open(id, sheetName) {
//先清空excel div
$('#viewFile_bottom').html('');
//等待
top.layer.load(1);
//sheet赋值
$('#sheet').val(sheetName);
//creatId赋值
$('#creatId').val(id);
$.post(ext.contextPath + '/report/rptCreate/viewFile.do', {
id: id,
sheetName: sheetName,
layerType: 'view'
}, function (data) {
var end = data.replace(RegExp('${RptSpSet_Type_Confirm}', 'g'), '未确认');
$('#viewFile_bottom').html(end);
//关闭等待
top.layer.closeAll('loading');
});
layer.open({
type: 1,
title: '报表预览',
area: '95%',
skin: 'bgfff', //没有背景色
maxmin: true,
shadeClose: true,
closeBtn: '1',
content: $('#viewFile'),
success: function (layero, index) { //弹出层加载成功后执行
}
});
}
//仅赋值---切换sheet
function viewFile(id, sheetName) {
//先清空excel div
$('#viewFile_bottom').html('');
//等待
top.layer.load(1);
//给sheet赋值
$('#sheet').val(sheetName);
$.post(ext.contextPath + '/report/rptCreate/viewFile.do', {
id: id,
sheetName: sheetName,
layerType: 'view'
}, function (data) {
var end = data.replace(RegExp('${RptSpSet_Type_Confirm}', 'g'), '未确认');
$('#viewFile_bottom').html(end);
//关闭等待
top.layer.closeAll('loading');
});
}
// function fileDownloadFun(id) {
// // window.open(ext.contextPath + "/base/downloadFileFromMasterid.do?key="+id+"&tbName=TB_Report_RptCreateFile");
// $.post(ext.contextPath + "/base/downloadFileFromMasterid.do", { key: id, tbName: 'TB_Report_RptCreateFile' });
// }
function fileDownloadFun(id) {
window.open(ext.contextPath + "/report/rptCreate/downloadFile4minio.do?id=" + id);
// $.post(ext.contextPath + "/report/rptCreate/downloadFile4minio.do", { id: id, tbName: 'TB_Report_RptCreateFile' });
}
function downloadFilesFun() {
var checkedItems = $("#table").bootstrapTable('getSelections');
$.each(checkedItems, function (index, item) {
fileDownloadFun(item.id);
console.log(item.id);
});
}
function getRootPath() {
var pathName = window.location.pathname.substring(1);
var webName = pathName == '' ? '' : pathName.substring(0, pathName.indexOf('/'));
return window.location.protocol + '//' + window.location.host + "/" + webName;
}
var addFun = function () {
var pid = '${param.classId}';
$.post(ext.contextPath + '/report/rptCreate/doadd.do', {
classId: '${param.classId}',
unitId: '${param.unitId}'
}, function (data) {
$("#subDiv").html(data);
openModal('subModal');
});
};
var editFun = function (id) {
$.post(ext.contextPath + '/report/rptCreate/doedit.do', {id: id}, function (data) {
$("#subDiv").html(data);
openModal('subModal');
});
};
var deleteFun = function (id) {
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/rptCreate/dodelete.do', {id: id}, function (data) {
var datastr = eval('(' + data + ')');
if (datastr.code == 1) {
$("#table").bootstrapTable('refresh');
} else {
showAlert('d', '删除失败', 'mainAlertdiv');
}
});
}
});
};
var deletesFun = function () {
var checkedItems = $("#table").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/rptCreate/dodeletes.do', {ids: datas}, function (data) {
if (data.code > 0) {
$("#table").bootstrapTable('refresh');
} else {
showAlert('d', '删除失败', 'mainAlertdiv');
}
}, 'json');
}
});
}
};
$(function () {
getListFun();
//加载日期控件
createDatetimepickerTwo('rpt_sdt','rpt_edt','D');
});
</script>
</head>
<input type="hidden" id="classId" name="classId" value="${param.classId}">
<input type="hidden" id="sheet" name="sheet" value="${param.sheet}">
<input type="hidden" id="creatId" name="creatId" value="${param.creatId}">
<div class="box box-primary" style="margin-bottom:0px;">
<div class="box-header with-border">
<h3 class="box-title">${param.text}</h3>
<div class="box-tools pull-right">
</div>
</div>
<div class="box-body ">
<div id="mainAlertdiv"></div>
<div id="rptDiv"></div>
<div id="fileInputDiv"></div>
<div class="row" style="margin-bottom:5px;">
<div class="col-lg-7">
<div class="btn-group btn-group-sm" role="group" aria-label="...">
<button type="button" class="btn btn-default" onclick="downloadFilesFun();"><i
class="fa fa-cloud-download"></i>
下载
</button>
</div>
</div>
<div class="col-lg-5">
<div class="input-group input-group-sm">
<div class="input-group-addon">时间范围:</div>
<input type="text" class="form-control" id="rpt_sdt" name="rpt_sdt" value="" readOnly>
<div class="input-group-addon">至</div>
<input type="text" class="form-control" id="rpt_edt" name="rpt_edt" value="" readOnly>
<span class="input-group-btn">
<a class="btn btn-default" onclick="dosearch();"><i class="fa fa-search"></i> 搜索</a>
</span>
</div>
</div>
</div>
<table id="table" data-use-row-attr-func="true" data-reorderable-rows="true"></table>
</div>
</div>
<%--<div class="box box-solid">
<div class="box-header with-border">
<h3 class="box-title">${param.text}</h3>
<div class="box-tools pull-right">
<security:authorize buttonUrl="report/rptCreate/edit.do">
<button type="button" class="btn btn-default" onclick="downloadFilesFun();"><i
class="fa fa-download"></i>
下載
</button>
</security:authorize>
</div>
</div>
<div class="box-body ">
<div>
<table id="table" style="table-layout:fixed;"></table>
</div>
</div>
</div>--%>
</html>