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

249 lines
9.3 KiB
Plaintext

<%@ page language="java" pageEncoding="UTF-8"%>
<!-- 引入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">
var beginTimeStore1 = '${param.sdt}';
var endTimeStore1 = '${param.edt}';
function initDate() {
//定义locale汉化插件
if(beginTimeStore1==''){
beginTimeStore1 = moment().subtract(7, 'days').format('YYYY-MM-DD HH:mm');
}
if(endTimeStore1==''){
endTimeStore1 = moment().subtract(0, 'days').format('YYYY-MM-DD HH:mm');
}
var locale = {
"format": 'YYYY-MM-DD HH:mm',
"separator": " ~ ",
"applyLabel": "确定",
"cancelLabel": "取消",
"fromLabel": "起始时间",
"toLabel": "结束时间'",
"customRangeLabel": "自定义",
"weekLabel": "W",
"daysOfWeek": ["日", "一", "二", "三", "四", "五", "六"],
"monthNames": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
"firstDay": 1
};
$('#reservationtime').daterangepicker({
"timePicker": true,
"timePicker24Hour": true,
"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: beginTimeStore1,
endDate: endTimeStore1
}, function(start, end, label) {
beginTimeStore1 = start.format(this.locale.format);
endTimeStore1 = 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));
}
});
$('#reservationtime').val(beginTimeStore1 + locale.separator + endTimeStore1);
};
var color=[
"#2ec7c9",
"#b6a2de",
"#5ab1ef",
"#ffb980",
"#d87a80",
"#8d98b3",
"#e5cf0d",
"#97b552",
"#95706d",
"#dc69aa",
"#07a2a4",
"#9a7fd1",
"#588dd5",
"#f5994e",
"#c05050",
"#59678c",
"#c9ab00",
"#7eb00a",
"#6f5553",
"#c14089"
];
function getEcharts(){
<%--var cunitId="";--%>
<%--if('${param.unitId}'!=''){--%>
<%-- cunitId='${param.unitId}';--%>
<%--}else{--%>
<%-- cunitId=unitId;--%>
<%--}--%>
document.getElementById("chart").removeAttribute("_echarts_instance_");
var myChart = echarts.init(document.getElementById("chart"));
myChart.showLoading({
text: '数据正在加载...',
textStyle: { fontSize : 30 , color: '#444' },
effectOption: {backgroundColor: 'rgba(0, 0, 0, 0)'},
zlevel: 0
});
$.post(ext.contextPath + '/data/getDetailData.do', {mpcode:"${param.mpcode}",sdt:beginTimeStore1,edt:endTimeStore1} , function(result) {
// console.log(result);
var series=[];
var yAxis=[];
var legenddata=[];
for(var i=0;i<result.length;i++){
series.push({
data:result[i].data,
symbol:'none',
name:result[i].name,
type:'line',
lineStyle:{
width:2
},
markPoint: {
data: [
{type: 'max', name: '最大值'},
{type: 'min', name: '最小值'}
]
},
markLine: {
data: [
{type: 'average', name: '平均值'}
]
}
})
legenddata.push(result[i].name);
}
yAxis.push({
type : 'value',
name : false,
splitLine: {
show: false//是否显示分隔线。默认数值轴显示,类目轴不显示。
},
scale:true//设置成 true 后坐标刻度不会强制包含零刻度。
});
var option = {
color:color,
animation:false,
legend: {
data: legenddata,
left: 'center'
},
grid:{
left: '4%', // 与容器左侧的距离
right: '4%', // 与容器右侧的距离
top: '8%', // 与容器顶部的距离
//bottom: '5%', // 与容器底部的距离
containLabel:true
},
toolbox: {
feature: {
saveAsImage: {show: true}
}
},
xAxis: {
type: 'time'
},
yAxis: yAxis,
series: series,
tooltip: {
trigger: 'axis',
formatter: function (params, ticket, callback) {
var htmlStr = '';
for(var i=0;i<params.length;i++){
var param = params[i];
// console.log(param);
var xName = param.name;//x轴的名称
var seriesName = param.seriesName;//图例名称
var xvalue = param.value[0];//x轴值
var yvalue = param.value[1];//y轴值
var remarkvalue = param.value[2];//备注轴值
var color = param.color;//图例颜色
var dataIndex=param.dataIndex;
var seriesIndex=param.seriesIndex;
htmlStr +='<div>';
htmlStr += xvalue + '<br/>' ;
htmlStr += '<span style="margin-right:5px;display:inline-block;width:10px;height:10px;border-radius:5px;background-color:'+color+';"></span>';
htmlStr += seriesName+':'+ yvalue + '';
htmlStr += '</div>';
}
return htmlStr;
}
// alwaysShowContent:true,
},
dataZoom: [{
type: 'inside',
start: 0,
end: 100
}, {
start: 0,
end: 100,
handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
handleSize: '60%',
handleStyle: {
color: '#fff',
shadowBlur: 3,
shadowColor: 'rgba(0, 0, 0, 0.6)',
shadowOffsetX: 2,
shadowOffsetY: 2
}
}]
};
myChart.setOption(option,true);
myChart.hideLoading();
},'json');
}
$(function() {
var windowhight=$(window).height();
var windowwidth=$(window).width();
$('#chart').attr("style","height:"+(windowhight-200)+"px;width:"+(windowwidth-100)+"px;padding-top:35px;");
initDate();
getEcharts();
});
function doCurveSearch(){
getEcharts();
}
</script>
<div class="modal fade" id="curveModal">
<div style="padding: 20px;">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title">历史曲线</h4>
</div>
<div class="modal-body">
<div class="input-group pull-left input-group-sm" >
<input type="text" class="form-control pull-left" id="reservationtime" style="width:230px" >
<div class="input-group-btn pull-left">
<button type="button" class="btn btn-default" onclick="doCurveSearch();" ><i class="fa fa-search"></i> 查询</button>
</div>
</div>
<div id="chart" style="float: left;"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
</div>
</div>
</div>
</div>