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

614 lines
22 KiB
Plaintext

<%@ page language="java" pageEncoding="UTF-8" %>
<script type="text/javascript">
var beginTimeStoreD1 = '';
var endTimeStoreD1 = '';
let nowHourTime = getNowTime().substring(0, 13);
function initDate() {
//定义locale汉化插件
beginTimeStoreD1 = moment().subtract(15, 'days').format('YYYY-MM-DD') + " 00:00";
endTimeStoreD1 = moment().subtract(-15, 'days').format('YYYY-MM-DD') + " 23:59";
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: beginTimeStoreD1,
endDate: endTimeStoreD1
}, function (start, end, label) {
beginTimeStoreD1 = start.format(this.locale.format);
endTimeStoreD1 = 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(beginTimeStoreD1 + locale.separator + endTimeStoreD1);
};
let myDetailChart = "";
let detailOption = [];
let detailSeries = [];
let type = '${param.type}';
let mpcodes = '${param.mpcodes}';
$(function () {
var windowhight = $(window).height();
var windowwidth = $(window).width();
$('#detailChartLine').attr("style", "height:" + (windowhight - 200) + "px;width:" + (windowwidth - 100) + "px;padding-top:35px;");
initDate();
myDetailChart = echarts.init(document.getElementById("detailChartLine"));
if (type == '1') {
detailOption = {
color: [
"#00DB16"
],
tooltip: {
trigger: 'axis'
},
legend: {
left: 'right',
// textStyle: {
// color: '#fff'
// },
data: ['潮汐']
},
grid: {
left: '2%',
right: '2%',
bottom: '1%',
top: '5%',
containLabel: true
},
xAxis: {
type: 'time',
boundaryGap: false,
axisLine: {
show: false
},
axisTick: {
show: true,
// lineStyle: {
// color: '#fff'
// }
},
// axisLabel: {
// color: '#fff'
// }
},
yAxis: {
name: 'cm',
type: 'value',
axisLine: {
show: true,
// lineStyle: {
// color: '#fff'
// }
},
splitLine: {
lineStyle: {
// color: '#fff',
type: 'dashed'
}
}
},
series: detailSeries
};
myDetailChart.setOption(detailOption, true);
} else if (type == '2') {
detailOption = {
color: [
"#00DB16", "#4875E8"
],
tooltip: {
trigger: 'axis'
},
legend: {
left: 'right',
// textStyle: {
// color: '#fff'
// },
data: ['实测CI', '预测CI']
},
grid: {
left: '2%',
right: '2%',
bottom: '1%',
top: '5%',
containLabel: true
},
xAxis: {
type: 'time',
boundaryGap: false,
axisLine: {
show: false
},
axisTick: {
show: true,
// lineStyle: {
// color: '#fff'
// }
},
// axisLabel: {
// color: '#fff'
// }
},
yAxis: {
name: 'ppm',
type: 'value',
axisLine: {
show: true,
// lineStyle: {
// color: '#fff'
// }
},
splitLine: {
lineStyle: {
// color: '#fff',
type: 'dashed'
}
}
},
series: detailSeries
};
myDetailChart.setOption(detailOption, true);
} else if (type == '3') {
detailOption = {
tooltip: {
trigger: 'axis'
},
// legend: {
// left: 'right',
// textStyle: {
// color: '#fff'
// },
// data: ['潮汐']
// },
grid: {
left: '2%',
right: '2%',
bottom: '1%',
top: '5%',
containLabel: true
},
tooltip: {
trigger: 'axis',
formatter: function (params) {
let outContent = "";
for (let item of params) {
// <span style=\"display:inline-block;margin-right:4px;border-radius:10px;width:10px;height:10px;background-color:rgba(0,0,0,0);\"></span>
let time = item.value[0];
let value = item.value[1];
if (value == 0) {
outContent = time + ':关';
} else if (value == 1) {
outContent = time + ':开';
} else {
outContent = '';
}
}
return outContent
}
},
xAxis: {
type: 'time',
// boundaryGap: false,
axisLine: {
show: false
},
axisTick: {
show: false
},
splitLine: {
show: true,
lineStyle: {
// color: '#fff',
type: 'dashed'
}
},
// axisLabel: {
// color: '#fff'
// }
// data: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12']
},
yAxis: {
type: 'value',
max: 2,
min: -1,
minInterval: 1,
axisLine: {
show: true,
// lineStyle: {
// color: '#fff'
// }
},
splitLine: {
show: false,
lineStyle: {
// color: '#fff',
type: 'dashed'
}
},
axisLabel: {
formatter: function (value, index) {
if (value == 0) {
value = '关';
} else if (value == 1) {
value = '开';
} else {
value = '';
}
return value;
}
}
},
visualMap: [
{
show: false,
// type: 'piecewise',
// splitNumber: 2,
pieces: [
{gt: 1, lte: 2, label: '开(自定义特殊颜色)', color: '#00DB16'},
{gt: -1, lte: 0, label: '关(自定义特殊颜色)', color: 'red'}
]
},
],
series: detailSeries
};
myDetailChart.setOption(detailOption, true);
} else if (type == '4') {
detailOption = {
color: [
"#00DB16", "#4875E8"
],
tooltip: {
trigger: 'axis'
},
legend: {
left: 'right',
// textStyle: {
// color: '#fff'
// },
data: ['实测液位', '预测液位']
},
grid: {
left: '2%',
right: '2%',
bottom: '1%',
top: '5%',
containLabel: true
},
xAxis: {
type: 'time',
boundaryGap: false,
axisLine: {
show: false
},
axisTick: {
show: true,
// lineStyle: {
// color: '#fff'
// }
},
// axisLabel: {
// color: '#fff'
// }
},
yAxis: {
name: 'ppm',
type: 'value',
axisLine: {
show: true,
// lineStyle: {
// color: '#fff'
// }
},
splitLine: {
lineStyle: {
// color: '#fff',
type: 'dashed'
}
}
},
series: detailSeries
};
myDetailChart.setOption(detailOption, true);
} else if (type == '98') {
detailOption = {
color: [
"#3fb1e3", "#b6a2de", "#626c91"
],
tooltip: {
trigger: 'axis'
},
legend: {
left: 'right',
// textStyle: {
// color: '#fff'
// },
data: ['潮汐', 'CI','预测']
},
grid: {
left: '2%',
right: '2%',
bottom: '1%',
top: '5%',
containLabel: true
},
xAxis: {
type: 'time',
boundaryGap: false,
axisLine: {
show: false
},
axisTick: {
show: true,
// lineStyle: {
// color: '#fff'
// }
},
// axisLabel: {
// color: '#fff'
// }
},
yAxis: [{
// name: 'ppm',
type: 'value',
axisLine: {
show: true,
// lineStyle: {
// color: '#fff'
// }
},
splitLine: {
lineStyle: {
// color: '#fff',
type: 'dashed'
}
}
}, {
type: 'value',
max: 2,
min: -1,
minInterval: 1,
axisLine: {
show: true,
// lineStyle: {
// color: '#fff'
// }
},
splitLine: {
show: false,
lineStyle: {
// color: '#fff',
type: 'dashed'
}
},
axisLabel: {
formatter: function (value, index) {
if (value == 0) {
value = '关';
} else if (value == 1) {
value = '开';
} else {
value = '';
}
return value;
}
}
}],
visualMap: [
{
show: false,
seriesIndex:2,
// type: 'piecewise',
// splitNumber: 2,
pieces: [
{gt: 1, lte: 2, label: '开(自定义特殊颜色)', color: '#00DB16'},
{gt: -1, lte: 0, label: '关(自定义特殊颜色)', color: 'red'}
]
}
],
series: detailSeries
};
myDetailChart.setOption(detailOption, true);
} else if (type == '99') {
detailOption = {
color: [
"#00DB16", "#4875E8"
],
tooltip: {
trigger: 'axis'
},
// legend: {
// left: 'right',
// // textStyle: {
// // color: '#fff'
// // },
// data: ['实测液位', '预测液位']
// },
grid: {
left: '2%',
right: '2%',
bottom: '1%',
top: '5%',
containLabel: true
},
xAxis: {
type: 'time',
boundaryGap: false,
axisLine: {
show: false
},
axisTick: {
show: true,
// lineStyle: {
// color: '#fff'
// }
},
// axisLabel: {
// color: '#fff'
// }
},
yAxis: {
// name: 'ppm',
type: 'value',
axisLine: {
show: true,
// lineStyle: {
// color: '#fff'
// }
},
splitLine: {
lineStyle: {
// color: '#fff',
type: 'dashed'
}
}
},
series: detailSeries
};
myDetailChart.setOption(detailOption, true);
}
getEcharts();
});
function doCurveSearch() {
getEcharts();
}
function getEcharts() {
$.ajax({
type: 'GET',
url: ext.contextPath + "/digitalProcess/digitalTechnologist/getBGJspDataDetailLine.do",
dataType: 'json',
data: {
unitId: unitId,
mpcodes: mpcodes,
sdt: beginTimeStoreD1,
edt: endTimeStoreD1
},
async: true,
error: function () {
return false;
},
success: function (data) {
// console.log(data)
if (data.length > 0) {
detailOption.series.splice(0,detailOption.series.length);
if (type == '98') {
for (let i = 0; i < data.length; i++) {
if (i == 0) {
detailSeries.push({
name:'潮汐',
type: 'line',
symbol: 'none',
yAxisIndex: 0,
data: data[i]
})
}else if (i == 1) {
detailSeries.push({
name:'CI',
type: 'line',
symbol: 'none',
yAxisIndex: 0,
data: data[i]
})
}else {
detailSeries.push({
name:'预测',
type: 'line',
step: 'middle',
symbol: 'none',
markLine: {
lineStyle: {
type: 'solid'
},
label: {
color: '#ffffff'
},
data: [
{
name: 'today',
xAxis: nowHourTime
}
]
},
yAxisIndex: 1,
data: data[i]
})
}
detailOption.series = detailSeries;
myDetailChart.setOption(detailOption, true);
}
} else {
for (let i = 0; i < data.length; i++) {
detailSeries.push({
type: 'line',
symbol: 'none',
data: data[i]
})
detailOption.series = detailSeries;
myDetailChart.setOption(detailOption, true);
}
}
}
}
});
}
</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="detailChartLine"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
</div>
</div>
</div>
</div>