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

739 lines
31 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.report.RptSpSet" %>
<% 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); %>
<%@page import="com.sipai.entity.activiti.ProcessType" %>
<% request.setAttribute("Type_Detail", ProcessType.B_Maintenance.getId());%>
<%--报表--%>
<%@page import="com.sipai.entity.business.BusinessUnit" %>
<% request.setAttribute("UNIT_REPORT_CREATE", BusinessUnit.UNIT_REPORT_CREATE);%>
<% request.setAttribute("UNIT_REPORT_AUDIT", BusinessUnit.UNIT_REPORT_AUDIT);%>
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security" %>
<%String contextPath = request.getContextPath();%>
<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 () {
$("#table2").bootstrapTable('refresh');
};
var getListFun2 = function () {
$("#table2").bootstrapTable({ // 对应table标签的id
url: ext.contextPath + '/report/rptCreate/getList4Check.do', // 获取表格数据的url
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
striped: true, //表格显示条纹默认为false
pagination: true, // 在表格底部显示分页组件默认false
pageList: [10], // 设置页面可以显示的数据条数
pageSize: 10, // 页面数据条数
pageNumber: 1, // 首页页码
sidePagination: 'client', // 设置为服务器端分页
queryParams: function (params) { // 请求服务器数据时发送的参数可以在这里添加额外的查询参数返回false则终止请求
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}'
}
},
sortName: 'rptdt', // 要排序的字段
sortOrder: 'desc', // 排序规则
onClickRow: function (row) {//单击行事件,执行查看功能
},
columns: [
{
field: 'name', // 返回json数据中的name
title: '任务名称', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
formatter: function (value, row) {
//console.log(row)
if (row.type.indexOf('${Type_Detail}') != -1) {
var arr = new Array();
arr = row.type.split("-")
var maintenanceType = arr[2];//运维类型:保养,维修,检修
switch (maintenanceType) {
case '${MAINTENANCE_TYPE_MAINTAIN}':
return "保养任务";
case '${MAINTENANCE_TYPE_REPAIR}':
return "维修任务";
case '${MAINTENANCE_TYPE_DEFECT}':
return "缺陷任务";
default:
return "--";
}
} else {
return row.name;
}
}
}, {
field: 'createTime', // 返回json数据中的name
title: '上步处理时间', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
formatter: function (value, row) {
return row.task.createTime;
}
}, {
field: 'companyname', // 返回json数据中的name
title: '厂区', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
formatter: function (value, row) {
if (row.business != null && row.business != '') {
if (row.business.company != null && row.business.company != '') {
return row.business.company.name;
}
}
}
}, {
field: 'problem', // 返回json数据中的name
title: '问题描述', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
formatter: function (value, row) {
return row.business == null ? '' : row.business.problem;
}
}, {
field: 'taskName', // 返回json数据中的name
title: '任务节点', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
formatter: function (value, row) {
return row.task.name;
}
}, {
field: 'op',
title: "操作",
align: 'center',
valign: 'middle',
width: 80, // 定义列的宽度单位为像素px
formatter: function (value, row, index) {
var str = '';
if (!row.task.assignee) {
str += '<button class="btn btn-default btn-sm" onclick="claimFun(\'' + row.task.id + '\')" data-toggle="tooltip" title="签收"><i class="fa fa-tag"></i><span class="hidden-md hidden-lg"> 签收</span></button>';
} else {
if (row.type.indexOf('${Type_Detail}') != -1) {
str += '<button class="btn btn-default btn-sm" onclick="viewDetailFun(\'' + row.processInstance.businessKey + '\',\'' + row.type + '\')" data-toggle="tooltip" title="查看详情"><i class="fa fa-history"></i><span class="hidden-md hidden-lg"> 查看详情</span></button>'
}
if (row.business != null) {
str += '<button class="btn btn-default btn-sm" onclick="gotoTaskFun(\'' + row.type + '\',\'' + row.business.status + '\',\'' + row.processInstance.id + '\',\'' + row.task.id + '\',\'' + row.processInstance.businessKey + '\');" data-toggle="tooltip" title="处理">' +
'<i class="fa fa-play"></i><span class="hidden-md hidden-lg"> 处理</span></button>';
}
}
str = '<div class="btn-group" >' + str + '</div>';
return str;
}
}
],
onLoadSuccess: function () { //加载成功时执行
adjustBootstrapTableView("table");
},
onLoadError: function () { //加载失败时执行
console.info("加载数据失败");
}
});
};
//签收
var claimFun = function (id) {
stopBubbleDefaultEvent();
$.post(ext.contextPath + '/activiti/workflow/task/claim.do', {taskId: id}, function (data) {
if (data == 1) {
showAlert('s', '签收成功', 'mainAlertdiv');
$("#table2").bootstrapTable('refresh')
} else {
showAlert('d', '签收失败', 'mainAlertdiv');
}
});
};
var gotoTaskFun = function (type, status, processInstanceId, taskId, businessKey) {
stopBubbleDefaultEvent();
/* tabIndex为维护清单页面tab的index变量 */
/* console.log('status',status); */
if (type.indexOf('${Report_Check}') != -1) {
switch (status) {
case '${UNIT_REPORT_CREATE}'://报表生成
$.post(ext.contextPath + '/report/rptCreate/doedit.do', {
processInstanceId: processInstanceId, taskId: taskId,
unitId: status
}, function (data) {
$("#subDiv").html(data);
openModal('subModal');
});
break;
case '${UNIT_REPORT_AUDIT}'://报表审核
$.post(ext.contextPath + '/report/rptCreate/showAudit.do', {
processInstanceId: processInstanceId, taskId: taskId,
unitId: status
}, function (data) {
$("#subDiv").html(data);
openModal('subModalAudit');
});
break;
default:
showAlert('w', '未查询到任务模块!', 'mainAlertdiv');
}
} else {
showAlert('w', '未查询到任务模块!', 'mainAlertdiv');
}
};
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 docheck(id) {
alert('开发中' + id);
}
//后台解析报表渲染到前端
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) {
//sheet赋值
$('#sheet').val(sheetName);
//creatId赋值
$('#creatId').val(id);
$.post(ext.contextPath + '/report/rptCreate/viewFile.do', {
id: id,
sheetName: sheetName,
layerType: 'edit'
}, function (data) {
var end = data.replace(RegExp('${RptSpSet_Type_Confirm}', 'g'), '<button type="button" style="pointer-events:none;">确认</button>');
$('#viewFile_bottom').html(end);
});
layer.open({
type: 1,
title: false,
area: '90%',
skin: 'bgfff', //没有背景色
maxmin: true,
content: $('#viewFile'),
cancel: function () {//获取右上角关闭事件
$.post(ext.contextPath + '/report/rptCreate/dosaveAgain.do', {createId: id}, function (data) {
});
}
});
}
//仅赋值---切换sheet
function viewFile(id, sheetName) {
//给sheet赋值
$('#sheet').val(sheetName);
$.post(ext.contextPath + '/report/rptCreate/viewFile.do', {
id: id,
sheetName: sheetName,
layerType: 'edit'
}, function (data) {
var end = data.replace(RegExp('${RptSpSet_Type_Confirm}', 'g'), '<button type="button" style="pointer-events:none;">确认</button>');
$('#viewFile_bottom').html(end);
});
}
//渲染后的table 右键事件
function tabClickRight() {
var td = event.srcElement; // 通过event.srcElement 获取激活事件的对象 td
if (td.parentElement.rowIndex != 'undefined' && td.parentElement.rowIndex != undefined && td.cellIndex != 'undefined' && td.cellIndex != undefined) {
var posx = td.cellIndex;
var posy = td.parentElement.rowIndex;
$('#tableLog').bootstrapTable('destroy');
$("#tableLog").bootstrapTable({ // 对应table标签的id
url: ext.contextPath + '/report/rptLog/getList.do', // 获取表格数据的url
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
striped: true, //表格显示条纹默认为false
pagination: true, // 在表格底部显示分页组件默认false
pageList: [200], // 设置页面可以显示的数据条数
pageSize: 200, // 页面数据条数
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,
createId: $('#creatId').val(),
posx: posx,
posy: posy
}
},
sortName: 'insdt', // 要排序的字段
sortOrder: 'desc', // 排序规则
columns: [
{
field: '', // 返回json数据中的name
title: '修订前值', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
width: '25%',
formatter: function (value, row, index) {
return row.beforeValue;
}
},
{
field: '', // 返回json数据中的name
title: '修订值', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
width: '25%',
formatter: function (value, row, index) {
return row.afterValue;
}
},
{
field: '', // 返回json数据中的name
title: '修订人', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
width: '25%',
formatter: function (value, row, index) {
if (row.user != null && row.user != '') {
return row.user.caption;
}
}
},
{
field: '', // 返回json数据中的name
title: '修订时间', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
width: '25%',
formatter: function (value, row, index) {
return row.insdt.substring(0, 19);
}
}
],
onLoadSuccess: function (data) { //加载成功时执行
adjustBootstrapTableView("tableLog");
if (data.total > 0) {
layer.open({
type: 1,
title: false,
area: '50%',
skin: 'bgfff', //没有背景色
maxmin: false,
content: $('#viewHis'),
cancel: function () {//获取右上角关闭事件
//无
}
});
}
},
onLoadError: function () { //加载失败时执行
console.info("加载数据失败");
}
});
}
}
//渲染后的table 左键事件
function tabClickLeft() {
var td = event.srcElement; // 通过event.srcElement 获取激活事件的对象 td
if (td.parentElement.rowIndex != 'undefined' && td.parentElement.rowIndex != undefined && td.cellIndex != 'undefined' && td.cellIndex != undefined) {
var str = td.innerHTML;
var reg = RegExp(/button/);
//如果包含button则为有事件的单元格 不参与修改值
if (str.match(reg)) {
//if (str.match('确认区域')) {
layer.confirm("是否确认该时间段内数据?", {icon: 3, title: '提示'},
function (index) {//确认
var sheet = $('#sheet').val();
var creatId = $('#creatId').val();
var type = '${RptSpSet_Type_Confirm}';
var posx = td.cellIndex;
var posy = td.parentElement.rowIndex;
var userId = '${userId}';
$.post(ext.contextPath + '/report/rptLog/doupdate.do', {
sheet: sheet,
creatId: creatId,
type: type,
posx: posx,
posy: posy,
userId: userId,
val: 0
}, function (data) {
//
});
td.innerHTML = '${userName}';
layer.close(index);
},
function (index) {//取消
layer.close(index);
});
} else {
layer.prompt({value: str},
function (val, index) {
td.innerHTML = val;//设置单击单元格的值
var sheet = $('#sheet').val();
var creatId = $('#creatId').val();
var type = '${RptSpSet_Type_Cal}';
var posx = td.cellIndex;
var posy = td.parentElement.rowIndex;
$.post(ext.contextPath + '/report/rptLog/dosave.do', {
sheet: sheet,
creatId: creatId,
type: type,
posx: posx,
posy: posy,
beforeValue: str,//修改前的值
afterValue: val //修改后的值
}, function (data) {
});
layer.close(index);
});
}
}
}
//渲染后的table 单击事件
$("#viewFile_bottom").unbind("mousedown").bind("mousedown", function (event) {
if (event.which == 1) {//左键事件
tabClickLeft();
} else if (event.which == 2) {//中键事件
} else if (event.which == 3) {//右键事件
document.oncontextmenu = function (ev) {
return false;
}
tabClickRight();
}
});
//确认数据方法
function confirmData() {
var td = event.srcElement; // 通过event.srcElement 获取激活事件的对象 td
layer.confirm("是否确认该时间段内数据?", {icon: 3, title: '提示'},
function (index) {//确认
var sheet = $('#sheet').val();
var creatId = $('#creatId').val();
var type = '${RptSpSet_Type_Confirm}';
var posx = td.cellIndex;
var posy = td.parentElement.rowIndex;
var userId = '${userId}';
$.post(ext.contextPath + '/report/rptLog/doupdate.do', {
sheet: sheet,
creatId: creatId,
type: type,
posx: posx,
posy: posy,
userId: userId,
val: ''
}, function (data) {
//
});
td.innerHTML = '${userName}';
layer.close(index);
},
function (index) {//取消
layer.close(index);
});
}
// 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 = $("#table2").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) {
$("#table2").bootstrapTable('refresh');
} else {
showAlert('d', '删除失败', 'mainAlertdiv');
}
});
}
});
};
var deletesFun = function () {
var checkedItems = $("#table2").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) {
$("#table2").bootstrapTable('refresh');
} else {
showAlert('d', '删除失败', 'mainAlertdiv');
}
}, 'json');
}
});
}
};
$(function () {
getListFun2();
});
</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-solid">
<div class="box-header with-border">
<h3 class="box-title">${param.text}</h3>
<div class="box-tools pull-right">
<%--<button type="button" class="btn btn-default" onclick="downloadFilesFun();"><i
class="fa fa-download"></i>
下載
</button>--%>
<%--<div style="float:right;">
<button type="button" class="btn btn-default btn-sm" onclick="dosearch();"><i class="fa fa-search"></i>
搜索
</button>
<label style="padding-top:6px;">时间范围:</label>
<input type="text" class="form-control pull-right" id="reservationtime2"
style="width:190px;height:35px;">
</div>--%>
</div>
</div>
<div class="box-body ">
<div>
<table id="table2" style="table-layout:fixed;"></table>
</div>
</div>
</div>
</html>