Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/maintenance/maintenanceAndRepairAnalysis.jsp

1434 lines
60 KiB
Plaintext
Raw Normal View History

2026-01-16 14:13:44 +08:00
<%@page import="com.sipai.entity.maintenance.MaintenanceDetail" %>
<%@page import="com.sipai.entity.maintenance.Maintenance" %>
<%@page import="com.sipai.entity.maintenance.MaintenanceCommString" %>
<%@ 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" %>
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security" %>
<%String contextPath = request.getContextPath();%>
<%request.setAttribute("Status_Start", MaintenanceDetail.Status_Start);%>
<%request.setAttribute("Status_Finish", MaintenanceDetail.Status_Finish);%>
<%request.setAttribute("MAINTENANCE_TYPE_MAINTAIN", MaintenanceCommString.MAINTENANCE_TYPE_MAINTAIN);%>
<%request.setAttribute("MAINTENANCE_TYPE_REPAIR", MaintenanceCommString.MAINTENANCE_TYPE_REPAIR);%>
<%request.setAttribute("MAINTENANCE_TYPE_DEFECT", MaintenanceCommString.MAINTENANCE_TYPE_DEFECT);%>
<%request.setAttribute("TYPE_MAINTENANCE", Maintenance.TYPE_MAINTENANCE);%>
<%request.setAttribute("TYPE_SUPPLEMENT", Maintenance.TYPE_SUPPLEMENT);%>
<%request.setAttribute("TYPE_MAINTAIN", Maintenance.TYPE_MAINTAIN);%>
<!DOCTYPE html>
<!-- <html lang="zh-CN"> -->
<!-- BEGIN HEAD -->
<head>
<title><%= ServerObject.atttable.get("TOPTITLE")%>
</title>
<!-- 引用页头及CSS页-->
<jsp:include page="/jsp/inc.jsp"></jsp:include>
<!--bootstrap-table 导出 -->
<script type="text/javascript"
src="<%=request.getContextPath()%>/plugins/bootstrap-table/extensions/export/bootstrap-table-export.js"></script>
<script type="text/javascript"
src="<%=request.getContextPath()%>/plugins/bootstrap-table/tableExport/libs/FileSaver/FileSaver.min.js"></script>
<script type="text/javascript"
src="<%=request.getContextPath()%>/plugins/bootstrap-table/tableExport/libs/js-xlsx/xlsx.core.min.js"></script>
<script type="text/javascript"
src="<%=request.getContextPath()%>/plugins/bootstrap-table/tableExport/libs/jsPDF/jspdf.min.js"></script>
<script type="text/javascript"
src="<%=request.getContextPath()%>/plugins/bootstrap-table/tableExport/libs/jsPDF-AutoTable/jspdf.plugin.autotable.js"></script>
<script type="text/javascript"
src="<%=request.getContextPath()%>/plugins/bootstrap-table/tableExport/libs/es6-promise/es6-promise.auto.min.js"></script>
<script type="text/javascript"
src="<%=request.getContextPath()%>/plugins/bootstrap-table/tableExport/libs/html2canvas/html2canvas.min.js"></script>
<script type="text/javascript"
src="<%=request.getContextPath()%>/plugins/bootstrap-table/tableExport/tableExport.min.js"></script>
<style type="text/css">
#div_top {
width: 100%;
height: 50%;
margin: 0px 0px 0px 0px;
float: left;
}
#div_below {
width: 100%;
height: 50%;
margin: 0px 0px 0px 0px;
float: left;
}
.allDiv {
height: 100%;
float: left;
display: table-cell;
vertical-align: middle;
text-align: center;
}
.leftDiv {
display: inline-block;
width: 97%;
height: 96%;
border-radius: 7px;
border: 1px solid #DDDDDD;
margin: 0px 0px 0px 0px;
background-color: #FFFFFF;
}
/*
.centerDiv{
display:inline-block;width:100%;height:96%;border-radius:7px;border:1px solid #DDDDDD;margin: 0px 0px 0px 0px;background-color:#686868;
}
*/
.rightDiv {
display: inline-block;
width: 98%;
height: 96%;
border-radius: 7px;
border: 1px solid #DDDDDD;
margin: 0px 2% 0px 0px;
background-color: #FFFFFF;
}
.titleDiv {
width: 100%;
height: 12%;
background-color: #E3E4E6;
}
.divContent {
width: 100%;
height: 88%;
/* background-color:pink; */
}
/*
根据不同分辨率显示不同px的文字大小
*/
@media (min-width: 400px) and (min-height: 300px) {
/* 标题样式 */
.titleText {
color: #000000;
font-size: 10px;
}
}
@media (min-width: 768px) and (min-height: 432px) {
/* 标题样式 */
.titleText {
color: #000000;
font-size: 12px;
}
}
@media (min-width: 992px) and (min-height: 558px) {
/* 标题样式 */
.titleText {
color: #000000;
font-size: 14px;
}
}
@media (min-width: 1200px) and (min-height: 675px) {
/* 标题样式 */
.titleText {
color: #000000;
font-size: 16px;
}
}
@media (min-width: 1400px) and (min-height: 875px) {
/* 标题样式 */
.titleText {
color: #000000;
font-size: 16px;
}
}
body {
background-color: #FFFFFF;
}
</style>
<!-- 文件上传-->
<link rel="stylesheet" href="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/css/fileinput.min.css"/>
<script type="text/javascript"
src="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/fileinput.min.js"
charset="utf-8"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/locales/zh.js"
charset="utf-8"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/plugins/echarts/echarts.4.1.0.min.js"
charset="utf-8"></script>
<script type="text/javascript">
var companyId = '';
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})
};
/*
年度故障趋势
*/
function echart1(container, bizid, textSize2, dateType, selectDate) {
var EleId = document.getElementById(container);
$.ajax({
type: 'GET',
url: ext.contextPath + '/maintenance/getRepairData.do?&&math=' + Math.random() + '&bizid=' + bizid + '&dateType=' + dateType + '&selectDate=' + selectDate + '&type=' +${type},
async: true,
globle: false,
error: function () {
return false;
},
success: function (data) {
var data = eval('(' + data + ')');
var mychart = echarts.init(EleId);
var xdata = new Array();//X轴数据 [0,1,2,3,4,5]
var ydata = new Array();//Y轴数据 [0,1,2,3,4,5]
for (var i = 0; i < data.length; i++) {
xdata[i] = (i + 1);
ydata[i] = data[i].count;
}
var option = {
tooltip: {
trigger: 'axis',
axisPointer: {// 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
top: '6%',
containLabel: true
},
xAxis: {
type: 'category',
data: xdata,
boundaryGap: false,//折线图下方阴影
axisLabel: {
interval: 0, //0为显示所有标签 1为隔一个显示一个
margin: 10,
textStyle: {
fontSize: textSize2,
color: '#000000'//月份文字颜色 ---切换主题需修改
}
}
},
yAxis: {
type: 'value',
axisLabel: {
formatter: '{value}',
textStyle: {
fontSize: textSize2,
color: '#000000'//Y轴数量颜色---切换主题需修改
}
}
//name: '数量'
},
series: [
{
name: '故障数',
//type: 'bar',
barWidth: 22,
type: 'line',
stack: '总量',
label: {
normal: {
show: false,//柱状图上显示数值
position: 'insideRight',
color: '#4169E1',
}
},
data: ydata,
itemStyle: {
normal: {
color: '#8DD34C', //#44CD4B,#81FA9D
}
},
areaStyle: {
//color:'FFFBF3'
}
}
]
};
mychart.clear();
mychart.setOption(option);
mychart.resize();//主动调用resize达到区域更新的效果,用于自动刷新区域大小
}
});
}
function doBar(id,data){
const color = ['#EFA103', '#00CCCC', '#9E70C7', '#47C1C8', '#F55945', '#A84ECB'];
// 基于准备好的dom初始化echarts实例
var height = $(document).height()*0.31;
$("#"+id).height(height);
var myChart = echarts.init(document.getElementById(id));
var option = {
color: color,
tooltip: {
trigger: 'axis',
},
grid: {
left: '4%',
right: '1%',
top: '15%',
bottom: '10%',
containLabel: true
},
legend: {
bottom: 0,
x: 'center',
icon:'roundRect',
textStyle: {
color: '#000' ,
lineHeight: 16,
fontSize: 13 ,
fontWeight : 600 ,
},
},
xAxis: [
{
type: 'category',
axisLine: {
show: false,
lineStyle:{
color:'#8A88B7',
}
},
axisLabel: {
color:'#8A88B7',
interval:0,
rotate:40
},
axisTick: {
show: false
},
}
],
yAxis: [
{
type: 'value',
name:data.name,
axisLine: {
show: false,
lineStyle:{
color:'#8A88B7',
}
},
axisLabel: {
color:'#8A88B7',
},
axisTick: {
show: false
},
//网格样式
splitLine: {
show: false,
lineStyle:{
color: '#8A88B7',
type: 'dashed',
opacity:0.3,
}
}
}
],
series: [
{
name: data.name,
type: 'bar',
barWidth: '20%',
barMinWidth: 10 ,
itemStyle: {
barBorderRadius: 8 ,
},
label: {
show: true,
position: 'inside'
},
data: data.value1
}
]
};
myChart.clear();
myChart.setOption(option, true);
}
/*
完成任务占比
*/
function echart2(container, bizid, textSize1, textSize2, dateType, selectDate) {
var EleId = document.getElementById(container);
$.ajax({
type: 'GET',
url: ext.contextPath + '/maintenance/getMaintenanceFinishRate.do?&&math=' + Math.random() + '&bizid=' + bizid + '&dateType=' + dateType + '&selectDate=' + selectDate,
async: true,
globle: false,
error: function () {
return false;
},
success: function (data) {
var data = eval('(' + data + ')');
var mychart = echarts.init(EleId);
var str = [];
for (var o in data) {
str.push({
value: data[o].value,
name: data[o].name,
});
}
var option = {
title: {
text: '',
left: 'center',
top: '32%',
//padding:[24,0],
textStyle: {
color: '#FFFFFF',
fontSize: textSize1,
align: 'center'
}
},
/*legend: {
orient: 'horizontal',//vertical 横向 纵向
left: 'center',
bottom:'bottom',
itemWidth: 14,//legend的图标的宽度
itemHeight: 10,
itemGap: 10,
data: ['分离设备'],
textStyle:{
color:'#FFFFFF',
fontSize:textSize2
}
},*/
tooltip: {
show: true,
trigger: 'item',
formatter: '{a} <br/>{b}: {c} ({d}%)'
},
series: [
{
name: '',
type: 'pie',
radius: ['0%', '75%'],//调整大小
center: ['50%', '50%'],
itemStyle: {
normal: {
label: {
show: true,
textStyle: {
fontSize: '12', //改变标示文字的大小
color: '#000000' // 改变标示文字的颜色
}
},
labelLine: {
show: true,
length: 2, // 改变标示线的长度
lineStyle: {
color: "#000000" // 改变标示线的颜色
}
}
},
},
data: str,
itemStyle: {
normal: {
label: {
show: true,
formatter: '{b} : {c} 次({d}%)'
},
labelLine: {show: true}
}
}
}
]
};
mychart.clear();
mychart.setOption(option);
mychart.resize();//主动调用resize达到区域更新的效果,用于自动刷新区域大小
//饼图点击事件
mychart.on('click', function (params) {
// getRankList(bizid,dateType,selectDate,params.name);//排名列表
// var rankText = '('+params.name+')&nbsp;&nbsp;';
// $('#rankText').html(rankText);//显示点击的名称
// $('#rankTextBack').html('恢复所有&nbsp;&nbsp;');//显示点击的名称
});
}
});
}
/*
工单列表
*/
function getWorkList(bizid, dateType, selectDate) {
//获取div的高度
var hei = $(window).height();
var heightstr = (hei - 40) * 0.5 * 0.96;
$('#workTable').bootstrapTable('destroy');
$("#workTable").bootstrapTable({ // 对应table标签的id
url: ext.contextPath + '/maintenance/getWorkList.do', // 获取表格数据的url
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
striped: true, //表格显示条纹默认为false
pagination: true, // 在表格底部显示分页组件默认false
pageList: [10], // 设置页面可以显示的数据条数
pageSize: 10, // 页面数据条数
pageNumber: 1, // 首页页码
height: heightstr - 43,
sidePagination: 'server', // 设置为服务器端分页
queryParams: function (params) { // 请求服务器数据时发送的参数可以在这里添加额外的查询参数返回false则终止请求
return {
rows: params.limit, // 每页要显示的数据条数
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
sort: params.sort, // 要排序的字段
order: params.order,
search_name: $('#search_name').val(),
search_code: bizid,
// type:'${type}',
dateType: dateType,
selectDate: selectDate
}
},
sortName: 'id', // 要排序的字段
sortOrder: 'desc', // 排序规则
onClickRow: function (row) {
viewFun(row.id);
},
//导出配置使用需要单独引用js
//是否显示导出按钮
showExport: false,
//导出表格方式默认basic只导出当前页的表格数据all导出所有数据selected导出选中的数据
exportDataType: "all",
//导出文件类型
exportTypes: ['excel'],
exportOptions: {
worksheetName: '工单列表', //表格工作区名称
fileName: '维修/保养工单'
},
//end
columns: [
{
field: 'companyName', // 返回json数据中的name
title: '厂区', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
width: '10%',
formatter: function (value, row, index) {
//新数据直接保存维护公司信息,老数据只含有运维信息
if (row.company != null) {
return row.company.sname;
} else if (row.maintenance != null) {
return row.maintenance.company.sname;
} else {
return "--";
}
}
}, {
field: 'equipmentNames', // 返回json数据中的name
title: '设备名称', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
width: '13%',
formatter: function (value, row, index) {
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.equipmentNames + "'>" + row.equipmentNames + "</span>";
}
}, {
field: 'equipmentCardIds', // 返回json数据中的name
title: '设备编号', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
width: '13%',
formatter: function (value, row, index) {
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.equipmentCardIds + "'>" + row.equipmentCardIds + "</span>";
}
}, {
field: 'problemcontent', // 返回json数据中的name
title: '问题描述', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
width: '24%',
formatter: function (value, row, index) {
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.problemcontent + "'>" + row.problemcontent + "</span>";
}
}, {
field: 'insdt', // 返回json数据中的name
title: '发起时间', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
width: '14%',
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: 'type', // 返回json数据中的name
title: '类型', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
width: '8%',
formatter: function (value, row, index) {
switch (value) {
case '1':
return '保养';
case '2':
return '维修';
case '3':
return '缺陷';
default:
return '';
}
}
}, {
field: 'status', // 返回json数据中的name
title: '状态', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
width: '8%',
formatter: function (value, row, index) {
switch (value) {
case '${Status_Start}':
return '已下发';
case '${Status_Finish}':
return '已完成';
default:
return value;
}
}
}, {
title: "操作",
align: 'center',
valign: 'middle',
width: '10%',
formatter: function (value, row, index) {
var str = "";
str += '<button class="btn btn-default btn-sm" onclick="viewFun(\'' + row.id + '\')" data-toggle="tooltip" title="查看详情"><i class="fa fa-eye "></i><span class="hidden-md hidden-lg"> 查看详情</span></button>'
str = '<div class="btn-group" >' + str + '</div>';
return str;
}
}
],
onLoadSuccess: function () { //加载成功时执行
adjustBootstrapTableView("workTable");
},
onLoadError: function () { //加载失败时执行
console.info("加载数据失败");
}
})
};
//维修单
var viewFun = function (id) {
$.post(ext.contextPath + '/maintenance/viewMaintain.do', {id: id}, function (data) {
$("#subDiv").html(data);
openModal('subRepairModal');
});
}
/*
工时排名列表
*/
function getRankList(bizid, dateType, selectDate) {
//获取div的高度
var hei = $(window).height();
var heightstr = (hei - 40) * 0.5 * 0.96 - 43;
//console.log('高='+heightstr);
if (dateType == 1) {
dateType = 'year';
selectDate = selectDate + '-01-01';
}
if (dateType == 0) {
dateType = 'month';
selectDate = selectDate + '-01';
}
$('#rankTable').bootstrapTable('destroy');
$("#rankTable").bootstrapTable({ // 对应table标签的id
url: ext.contextPath + '/maintenance/getFinishData.do', // 获取表格数据的url
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
striped: true, //表格显示条纹默认为false
pagination: true, // 在表格底部显示分页组件默认false
pageList: [1000], // 设置页面可以显示的数据条数
pageSize: 1000, // 页面数据条数
pageNumber: 1, // 首页页码
height: heightstr,
sidePagination: 'server', // 设置为服务器端分页
queryParams: function (params) { // 请求服务器数据时发送的参数可以在这里添加额外的查询参数返回false则终止请求
return {
rows: params.limit, // 每页要显示的数据条数
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
sort: params.sort, // 要排序的字段
order: params.order,
search_name: $('#search_name').val(),
unitId: bizid,
dateType: dateType,
selectDate: selectDate
}
},
sortName: 'id', // 要排序的字段
sortOrder: 'desc', // 排序规则
onClickRow: function (row) {
//viewFun(row.id);
},
//导出配置使用需要单独引用js
//是否显示导出按钮
showExport: false,
//导出表格方式默认basic只导出当前页的表格数据all导出所有数据selected导出选中的数据
exportDataType: "all",
//导出文件类型
exportTypes: ['excel'],
exportOptions: {
worksheetName: '统计', //表格工作区名称
fileName: '人员工单统计'
},
//end
columns: [
{
field: 'rank', // 返回json数据中的name
title: '排名', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
width: '6%',
formatter: function (value, row, index) {
return index + 1;
}
}, {
field: 'userName', // 返回json数据中的name
title: '人员', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
width: '25%'
}, {
field: 'repairNum', // 返回json数据中的name
title: '维修数', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
width: '25%'
}, {
field: 'mainNum', // 返回json数据中的name
title: '保养数', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
width: '25%'
}, {
field: 'finishNum', // 返回json数据中的name
title: '总数', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
width: '25%'
}
],
onLoadSuccess: function () { //加载成功时执行
adjustBootstrapTableView("rankTable");
},
onLoadError: function () { //加载失败时执行
console.info("加载数据失败");
}
})
};
/*
根据月查询
*/
function domonth() {
$("#yeartimeId").val('');//点月的时候把年的值置为空
$("#monthButtonId").css({//高亮月 去除年高亮色
"background-color": "#238AE5"
});
$("#yearButtonId").css({
"background-color": "#FFFFFF"
});
$("#yearDiv").attr("style", "width:120px;height:100%;float:left;margin:5px 5px 5px 15px;display:none;");//隐藏div
$("#monthDiv").attr("style", "width:120px;height:100%;float:left;margin:5px 5px 5px 15px;display:block;");//显示div
$("#dateType").val('0');//dateType为日期类型 0为查看月 1为查看年
}
/*
根据年查询
*/
function doyear() {
$("#monthtimeId").val('');//点年的时候把月的值置为空
$("#yearButtonId").css({//高亮年 去除月高亮色
"background-color": "#238AE5"
});
$("#monthButtonId").css({
"background-color": "#FFFFFF"
});
$("#monthDiv").attr("style", "width:120px;height:100%;float:left;margin:5px 5px 5px 15px;display:none;");//隐藏div
$("#yearDiv").attr("style", "width:120px;height:100%;float:left;margin:5px 5px 5px 15px;display:block;");//显示div
$("#dateType").val('1');//dateType为日期类型 0为查看月 1为查看年
}
function chaDate(ev) {
var dateType = $('#dateType').val();//dateType为日期类型 0为查看月 1为查看年
var datestr = '';
if (dateType == '1') {
datestr = $('#yeartimeId').val();
} else {
datestr = $('#monthtimeId').val();
}
$("#selectDate").val(datestr);//selectDate为查询时间
initMenu();//加载所有方法
}
function initMenu() {
var dateType = $('#dateType').val();//查询类型 0:月 1:年
var selectDate = $('#selectDate').val();//查询的日期
var bizid = companyId;
//根据分辨率自适应
var wid = $(window).width();
var hei = $(window).height();
$('#divbottom').height(hei - 40);//顶部工具栏固定30px 其余为下面div高度
$('#monthtimeId').datepicker({
format: 'yyyy-mm',
weekStart: 1,
autoclose: true,
startView: 2,
minViewMode: 1,
maxViewMode: 2,
forceParse: false,
language: 'cn'
}).on('changeDate', chaDate);
$('#yeartimeId').datepicker({
format: 'yyyy',
weekStart: 1,
autoclose: true,
startView: 2,
minViewMode: 2,
maxViewMode: 2,
forceParse: false,
language: 'cn'
}).on('changeDate', chaDate);
var textSize1 = 0;//环形图里面的数字/百分比大小
var textSize2 = 0;//标签类 如ABCD类/白班/晚班 的大小
if (wid > 0 && hei > 0) {
textSize1 = 12;
textSize2 = 8;
}
if (wid > 768 && hei > 432) {
textSize1 = 12;
textSize2 = 12;
}
if (wid > 992 && hei > 558) {
textSize1 = 16;
textSize2 = 12;
}
if (wid > 1200 && hei > 675) {
textSize1 = 16;
textSize2 = 14;
}
// echart1('container1',bizid,textSize1,dateType,selectDate);//折线图
echart2('container2', bizid, textSize1, textSize2, dateType, selectDate);//圆环图
getWorkList(bizid, dateType, selectDate);//工单列表
getRankList(bizid, dateType, selectDate, '');//排名列表
}
window.onresize = function () {
initMenu();
}
$(function () {
companyId = unitId;
//简易公司combotree
/*$.post(ext.contextPath + '/user/getUnitForTree.do', {ng: ''}, function (data) {
if (data.length == 1 && !data[0].hasOwnProperty("nodes")) {
//当登陆者的pid以下没有子节点时显示单独一个span
$("#search_pid").val(data[0].id);
$("#companyselect").hide();
$("#companyName").text("公司: " + data[0].text);
companyId = data[0].id;
initMenu();
} else if ((data.length == 1 && data.nodes != "") || data.length > 1) {
//第一次加载时赋值
$("#search_pid").val(data[0].id);
$("#cname_input").val(data[0].text);
companyId = data[0].id;
initMenu();
//$table.bootstrapTable('refresh');//异步加载重新刷新,待修改
$('#companytree').treeview({
data: data,
showBorder: false,
levels: 3,
});
$('#companytree').on('nodeSelected', function (event, data) {
$("#search_pid").val(data.id);
$("#cname_input").val(data.text);
document.getElementById('ul_tree').style.display = "none";
companyId = data.id;
initMenu();
});
} else {
//待完善
}
;
}, 'json');
//防止点击树的+号收起下拉框
$("#ul_tree").on("click", function (e) {
event.stopPropagation();
});
//点击空白隐藏树
$(document).click(function (e) {
var divTree = $('#ul_tree'); // 设置目标区域
if (!divTree.is(e.target) && divTree.has(e.target).length === 0) {
divTree.hide()
}
})*/
//console.log('123');
initDate2();
$.post(ext.contextPath + '/equipment/equipmentMaintain/getMaintain.do', {} , function(data) {
var values = JSON.parse(data);
console.log(values);
var drugBar = {name:"各部门维修成本",value1:values.contract2};
doBar("goodContract",drugBar);
var drugBar = {name:"各部门保养成本",value1:values.contract};
doBar("goodContract2",drugBar);
});
//泵站类型tree
$.post(ext.contextPath + '/user/processSection/getProcessType4Tree.do', {
ng: '',
unitId: unitId
}, function (data) {
if (data.length == 1 && !data[0].hasOwnProperty("nodes")) {
//当登陆者的pid以下没有子节点时显示单独一个span
$("#search_pid2").val(data[0].id);
$("#companyselect2").hide();
$("#companyName2").text("公司: " + data[0].text);
//companyId = data[0].id;
initMenu();
} else if ((data.length == 1 && data.nodes != "") || data.length > 1) {
//第一次加载时赋值
$("#search_pid2").val(data[0].id);
$("#cname_input2").val(data[0].text);
//companyId = data[0].id;
initMenu();
$('#companytree2').treeview({
data: data,
showBorder: false,
levels: 3,
});
$('#companytree2').on('nodeSelected', function (event, data) {
$("#search_pid2").val(data.id);
$("#cname_input2").val(data.text);
document.getElementById('ul_tree2').style.display = "none";
//companyId = data.id;
initMenu();
});
} else {
//待完善
}
;
}, 'json');
//防止点击树的+号收起下拉框
$("#ul_tree2").on("click", function (e) {
event.stopPropagation();
});
//点击空白隐藏树
$(document).click(function (e) {
var divTree = $('#ul_tree2'); // 设置目标区域
if (!divTree.is(e.target) && divTree.has(e.target).length === 0) {
divTree.hide()
}
})
//设备类型tree
$.post(ext.contextPath + '/equipment/equipmentClass/getTreeJson.do', {
ng: '',
unitId: unitId
}, function (data) {
var datastr = data.result;
if (datastr.length == 1 && !datastr[0].hasOwnProperty("nodes")) {
//当登陆者的pid以下没有子节点时显示单独一个span
$("#search_pid3").val(datastr[0].id);
$("#companyselect3").hide();
$("#companyName3").text("公司: " + data[0].text);
//companyId = data[0].id;
initMenu();
} else if ((data.length == 1 && data.nodes != "") || datastr.length > 1) {
//第一次加载时赋值
$("#search_pid3").val(datastr[0].id);
$("#cname_input3").val(datastr[0].text);
//companyId = data[0].id;
initMenu();
$('#companytree3').treeview({
data: datastr,
showBorder: false,
levels: 3,
});
$('#companytree3').on('nodeSelected', function (event, data) {
$("#search_pid3").val(data.id);
$("#cname_input3").val(data.text);
document.getElementById('ul_tree3').style.display = "none";
//companyId = data.id;
initMenu();
});
} else {
//待完善
}
;
}, 'json');
//防止点击树的+号收起下拉框
$("#ul_tree3").on("click", function (e) {
event.stopPropagation();
});
//点击空白隐藏树
$(document).click(function (e) {
var divTree = $('#ul_tree3'); // 设置目标区域
if (!divTree.is(e.target) && divTree.has(e.target).length === 0) {
divTree.hide()
}
})
});
//维修计
function showFinishDataWx() {
var dateType = $('#dateType').val();//查询类型 0:月 1:年
var selectDate = $('#selectDate').val();//查询的日期
var bizid = companyId;
var type = '${MAINTENANCE_TYPE_REPAIR}';
if (dateType == 1) {
dateType = 'year';
selectDate = selectDate + '-01-01';
}
if (dateType == 0) {
dateType = 'month';
selectDate = selectDate + '-01';
}
$.post(ext.contextPath + '/maintenance/showFinishData.do', {
dateType: dateType,
selectDate: selectDate,
unitId: bizid,
type: type
}, function (data) {
$("#subDiv").html(data);
openModal('subModal');
});
}
//保养统计
function showFinishDataBy() {
var dateType = $('#dateType').val();//查询类型 0:月 1:年
var selectDate = $('#selectDate').val();//查询的日期
var bizid = companyId;
var type = '${MAINTENANCE_TYPE_MAINTAIN}';
if (dateType == 1) {
dateType = 'year';
selectDate = selectDate + '-01-01';
}
if (dateType == 0) {
dateType = 'month';
selectDate = selectDate + '-01';
}
$.post(ext.contextPath + '/maintenance/showFinishData.do', {
dateType: dateType,
selectDate: selectDate,
unitId: bizid,
type: type
}, function (data) {
$("#subDiv").html(data);
openModal('subModal');
});
}
//导出维修/保养工单
function doExportWorkTable() {
$('#workTable').tableExport({
type: 'excel',
exportDataType: "all",
ignoreColumn: [7],//忽略某一列的索引
fileName: '维修/保养工单',//下载文件名称
onCellHtmlData: function (cell, row, col, data) {//处理导出内容,自定义某一行、某一列、某个单元格的内容
return data;
},
});
}
//导出人员工单排行
function doExportRankTable() {
$('#rankTable').tableExport({
type: 'excel',
exportDataType: "all",
//ignoreColumn: [7],//忽略某一列的索引
fileName: '人员工单统计',//下载文件名称
onCellHtmlData: function (cell, row, col, data) {//处理导出内容,自定义某一行、某一列、某个单元格的内容
return data;
},
});
}
</script>
</head>
<body onload="initMenu()" style="overflow:hidden;">
<div style="width:100%;height:30;">
<input type="hidden" name="bizid" id="bizid" value="${bizidstr}">
<input type="hidden" name="dateType" id="dateType" value="1">
<input type="hidden" name="selectDate" id="selectDate" value="${datestr}">
<div id="subDiv"></div>
<div class="form-group " style="margin-bottom:10px;">
<input id="search_pid" name="search_pid" type="hidden"/>
<span id="companyName"
style="height:31px;color:#000000;border-top-left-radius: 4px;border-bottom-left-radius: 4px;font-weight:bold"></span>
</div>
<div class="form-group " style="margin-bottom:10px;">
<input id="search_pid2" name="search_pid2" type="hidden"/>
<span id="companyName2"
style="height:31px;color:#000000;border-top-left-radius: 4px;border-bottom-left-radius: 4px;font-weight:bold"></span>
</div>
<div class="form-group " style="margin-bottom:10px;">
<input id="search_pid3" name="search_pid3" type="hidden"/>
<span id="companyName3"
style="height:31px;color:#000000;border-top-left-radius: 4px;border-bottom-left-radius: 4px;font-weight:bold"></span>
</div>
<%--<div style="width:270px;height:100%;float:left;margin:3px 5px 3px 15px">
<ul id="companyselect" style="list-style-type:none;padding-left:0px;width:300px;">
<li class="dropdown" style="width:300px;">
<!-- Menu toggle button -->
<a href="#" class="dropdown-toggle" data-toggle="dropdown"
style="width:300px;" onclick="document.getElementById('ul_tree').style.display = 'block';">
<div class="input-group">
<span class="input-group-addon"
style="height:31px;color:#000000;border-top-left-radius: 4px;border-bottom-left-radius: 4px;font-weight:bold">公司:</span>
<input class="form-control " id="cname_input" name="cname_input"
style="height:31px;width: 220px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;"
readonly/>
</div><!-- /input-group -->
</a>
<ul id="ul_tree" class="dropdown-menu" data-stopPropagation="true">
<li class="header">
<div id="companytree" style="width: 275px;overflow:auto;"></div>
</li>
</ul>
</li>
</ul>
</div>--%>
<div style="width:300px;height:100%;float:left;margin:3px 5px 3px 15px">
<ul id="companyselect2" style="list-style-type:none;padding-left:0px;width:300px;">
<li class="dropdown" style="width:300px;">
<!-- Menu toggle button -->
<a href="#" class="dropdown-toggle" data-toggle="dropdown"
style="width:300px;" onclick="document.getElementById('ul_tree2').style.display = 'block';">
<div class="input-group">
<span class="input-group-addon"
style="height:31px;color:#000000;border-top-left-radius: 4px;border-bottom-left-radius: 4px;font-weight:bold">泵站类型:</span>
<input class="form-control " id="cname_input2" name="cname_input2"
style="height:31px;width: 220px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;"
readonly/>
</div><!-- /input-group -->
</a>
<ul id="ul_tree2" class="dropdown-menu" data-stopPropagation="true">
<li class="header">
<div id="companytree2" style="width: 275px;overflow:auto;"></div>
</li>
</ul>
</li>
</ul>
</div>
<div style="width:300px;height:100%;float:left;margin:3px 5px 3px 15px;">
<ul id="companyselect3" style="list-style-type:none;padding-left:0px;width:300px;">
<li class="dropdown" style="width:300px;">
<!-- Menu toggle button -->
<a href="#" class="dropdown-toggle" data-toggle="dropdown"
style="width:300px;" onclick="document.getElementById('ul_tree3').style.display = 'block';">
<div class="input-group">
<span class="input-group-addon"
style="height:31px;color:#000000;border-top-left-radius: 4px;border-bottom-left-radius: 4px;font-weight:bold">设备类型:</span>
<input class="form-control " id="cname_input3" name="cname_input3"
style="height:31px;width: 220px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;"
readonly/>
</div><!-- /input-group -->
</a>
<ul id="ul_tree3" class="dropdown-menu" data-stopPropagation="true" style="overflow:auto;">
<li class="header">
<div id="companytree3" style="width: 275px;"></div>
</li>
</ul>
</li>
</ul>
</div>
<div style="width:1%;height:100%;float:left;"></div>
<div style="width:120px;height:100%;float:left;margin:2px 0px;display:none;" id="monthDiv">
<div class="input-group">
<input class="form-control date-picker" id="monthtimeId" autocomplete="off"
type="text" placeholder="点击选择" style="background-color:#FFFFFF;height:100%;" value=""/>
<span class="input-group-addon">
<i class="fa fa-calendar bigger-110"></i>
</span>
</div>
</div>
<div style="width:120px;height:100%;float:left;margin:5px 5px 5px 15px;" id="yearDiv">
<div class="input-group">
<input class="form-control date-picker" id="yeartimeId" name="yeartimeId" autocomplete="off"
type="text" placeholder="点击选择" style="background-color:#FFFFFF;height:100%;" value="${datestr}"/>
<span class="input-group-addon">
<i class="fa fa-calendar bigger-110"></i>
</span>
</div>
</div>
<div style="width:1%;height:100%;float:left;"> </div>
<div style="width:120px;height:100%;float:left;margin:3px 5px 6px 0px">
<div class="btn-group" role="group" aria-label="...">
<button id="yearButtonId" type="button" class="btn btn-default"
style="height:100%;background-color:#238AE5;" onclick="doyear();">
</button>
<button id="monthButtonId" type="button" class="btn btn-default"
style="height:100%;background-color:#D4D4D4;" onclick="domonth();">
</button>
</div>
</div>
<div style="float:left;margin:3px 5px 6px 0px">
<label style="padding-top:4px">时间范围:</label> <input type="text"
class="form-control pull-right" id="reservationtime2"
style="width:160px">
</div>
<div style="width:1%;height:100%;float:left;"></div>
<div style="width:100px;height:100%;float:right;margin:10px 5px 10px 0px">
<div class="btn-group" role="group" aria-label="...">
<button type="button" class="btn btn-default" style="height:100%;"
onclick="showFinishDataWx();">
维修统计
</button>
</div>
</div>
<div style="width:1%;height:100%;float:left;"></div>
<div style="width:100px;height:100%;float:right;margin:10px 5px 10px 0px">
<div class="btn-group" role="group" aria-label="...">
<button type="button" class="btn btn-default" style="height:100%;"
onclick="showFinishDataBy();">
保养统计
</button>
</div>
</div>
</div>
<div style="width:100%;" id="divbottom">
<!--上面div-->
<div id="div_top">
<div class="allDiv" style="width:60%;">
<div class="leftDiv">
<div class="titleDiv">
<!-- <span class="titleTextDiv">成本统计</span> -->
<table style="font-size: 12px;border-left: 1px solid #e4e4e4;border-right: 1px solid #e4e4e4;table-layout: fixed;border-collapse: collapse;width:100%;height:100%;background: #E3E4E6;"
cellspacing="0">
<tr style="border-bottom: 1px solid #e4e4e4;padding-bottom:5px;height:10%;">
<td align="left" class="titleText">&nbsp;&nbsp;成本统计</td>
</tr>
</table>
</div>
<div class="divContent">
<table border="" style="width:100%; height:100%;">
<tr>
<td style="width:50%;"> <div id="goodContract">
</div> </td>
</th>
<td style="width:50%;"> <div id="goodContract2">
</div></td>
</th>
</tr>
</table>
</div>
</div>
</div>
<div class="allDiv" style="width:40%;">
<div class="rightDiv">
<div class="titleDiv">
<!-- <span class="titleTextDiv">任务完成率</span> -->
<table style="font-size: 12px;border-left: 1px solid #e4e4e4;border-right: 1px solid #e4e4e4;table-layout: fixed;border-collapse: collapse;width:100%;height:100%;background: #E3E4E6;"
cellspacing="0">
<tr style="border-bottom: 1px solid #e4e4e4;padding-bottom:5px;height:10%;">
<td align="left" class="titleText">&nbsp;&nbsp;任务完成率</td>
</tr>
</table>
</div>
<div class="divContent">
<div id="container2" style="width:100%; height:100%;"></div>
</div>
</div>
</div>
</div>
<!--下面div-->
<div id="div_below">
<div class="allDiv" style="width:60%;">
<div class="leftDiv">
<div class="titleDiv">
<!-- <span class="titleTextDiv">维修/保养工单</span> -->
<table style="font-size: 12px;border-left: 1px solid #e4e4e4;border-right: 1px solid #e4e4e4;table-layout: fixed;border-collapse: collapse;width:100%;height:100%;background: #E3E4E6;"
cellspacing="0">
<tr style="border-bottom: 1px solid #e4e4e4;padding-bottom:5px;height:10%;">
<td align="left" class="titleText">&nbsp;&nbsp;<span onclick="selectRankAll()"
style="cursor:pointer;">维修/保养工单</span>&nbsp;
<!-- <span id="rankText" style="color:red"></span> -->
</td>
<td align="left" class="titleText">
<button type="button" class="btn btn-default" style="height:70%;float:right;"
onclick="doExportWorkTable();">
导出
</button>
</td>
</tr>
</table>
</div>
<div class="divContent">
<table id="workTable" style="table-layout:fixed"></table>
</div>
</div>
</div>
<div class="allDiv" style="width:40%;">
<div class="rightDiv">
<div class="titleDiv">
<table style="font-size: 12px;border-left: 1px solid #e4e4e4;border-right: 1px solid #e4e4e4;table-layout: fixed;border-collapse: collapse;width:100%;height:100%;background: #E3E4E6;"
cellspacing="0">
<tr style="border-bottom: 1px solid #e4e4e4;padding-bottom:5px;height:10%;">
<td align="left" class="titleText">&nbsp;&nbsp;<span onclick="selectRankAll()"
style="cursor:pointer;">人员工单统计</span>&nbsp;
<!-- <span id="rankText" style="color:red"></span> -->
</td>
<td align="left" class="titleText">
<button type="button" class="btn btn-default" style="height:70%;float:right;"
onclick="doExportRankTable();">
导出
</button>
</td>
</tr>
</table>
</div>
<div class="divContent">
<table id="rankTable"></table>
</div>
</div>
</div>
</div>
</div>
</body>
<!-- bootstrap switch -->
<link rel="stylesheet"
href="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.min.css"/>
<script type="text/javascript"
src="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/js/bootstrap-switch.min.js"
charset="utf-8"></script>
<!-- 引入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>
</html>