加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
trend_wwtp.htm 6.36 KB
一键复制 编辑 原始数据 按行查看 历史
Ecava_IGX 提交于 2022-08-16 14:33 . 上传文件
<html>
<head>
<title>ECAVA IntegraXor - Overall Trending</title>
<LINK href="system/styles/_gui.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="system/scripts/_ig.js"></script>
<script type="text/javascript" src="system/scripts/_gen.js"></script>
<link rel="stylesheet" type="text/css" href="system/styles/subModal.css" />
<script type="text/javascript" src="system/scripts/common.js"></script>
<script type="text/javascript" src="system/scripts/subModal2.js"></script>
<script type="text/javascript" src="system/scripts/date.js"></script>
<script type="text/javascript">
var igsvrIp = "";//"localhost";
var igsvrProject = "";//"stp";
function init()
{
// KH 06.08.01
igsvrIp = window.location.hostname;
var pathname = new String(window.location.pathname);
igsvrProject = pathname.substr(1, pathname.indexOf("/", 1) -1);
//idTrend.setParam("Project", "192.168.1.3:7131/strz");
// var project = igsvrIp + ':' + window.location.port + '/' + igsvrProject;
// trendApplet.setProject(project);
}
function save()
{
// instruction
var content =
"<table width='100%' height='100%'>" +
"<tr><td colspan=2>" +
"<b>Select a date range.</b><br/>" +
"Format: <b>yyyy-MM-dd HH:mm:ss</b><br/>" +
"Default to select all if not specified.<br/>" +
"</td></tr>" +
"<tr><td style='width:20%'>From</td><td><input id='saveFrom' type='text' style='width:90%;'/></td></tr>" +
"<tr><td>To</td><td><input id='saveTo' type='text' style='width:90%;'/></td></tr>" +
"<tr><td></td><td style='text-align:right; right-padding:10px;'>" +
"<input id='saveOk' type='button' value='Save' onclick='saveData(saveFrom.value, saveTo.value); showApplet();'/>&nbsp;" +
"<input id='saveCancel' type='button' value='Cancel' onclick='showApplet()'/>" +
"</td></tr>"
"</table>";
// dialog
appletTd.style.display = 'none';
showPopWin("<b>Select Data Range</b>", content, 400, 200, null, false);
}
function showApplet()
{
hidePopWin(false);
appletTd.style.display = 'block';
}
function trim(string)
{
return string.replace(/(^\s*)|(\s*$)/g, "");
}
function verifyDate(d)
{
var d2 = trim("" + d);
if (isDate(d2, "yyyy-MM-dd HH:mm:ss"))
return d2;
if (isDate(d2, "yyyy-MM-dd"))
return d2 + " 00:00:00";
return "";
}
function setStatus(newStatus, bIsOK)
{
var prevStatus = idStatus.innerHTML;
idStatus.innerHTML = newStatus;
idStatus.style.color = (true == bIsOK) ? "darkgray" : "red";
return prevStatus;
}
function saveData(saveFrom, saveTo)
{
var sFrom = verifyDate(saveFrom);
var sTo = verifyDate(saveTo);
setStatus("Downloading file. This may take several minutes. Please wait...", false);
var sql =
"select tag_name, time_stamp, nvalue from log " +
"where tag_name in ('effStor','neuSump','inFlow1','inFlow2','effFlow','effPH','effTemp') ";
if ("" != sFrom) {
sql += "and time_stamp >= {ts '" + sFrom + "'} ";
}
if ("" != sTo) {
sql += "and time_stamp <= {ts '" + sTo + "'} ";
}
sql += "order by tag_name, time_stamp ";
sql = sql.replace(/ /g, "%20"); // replace space with %20
var szTime = formatDate(new Date(), "yyyyMMdd+HHmmss");
var cmd = "http://" + igsvrIp + ":7131/" + igsvrProject + "/getData?function=sql;sql=" +
sql + ";file=voltAmp+trends+asof+" + szTime + ".csv";
// alert(cmd);
try {
window.open(cmd, null,
"height=100,width=200,top=100,left=200,status=no,toolbar=no,menubar=no,location=no");
setStatus("", true);
} catch (e) {
setStatus(e, false);
}
}
function onPrint() {
var obj = document.getElementById( 'igTrend');
obj.forceRealTime(false);
obj.setGraphBackground("0xF8F8F8");
print();
obj.setGraphBackground("0x000000");
obj.forceRealTime(true);
}
//-->
</script>
</head>
<body onload="init()" bgcolor="white" bottommargin="0" leftmargin="0" rightmargin="0" topmargin="0">
<table height="100%">
<tr class="nonPrint">
<td class="bar" style="vertical-align:top; height:10px;">
<table>
<tr>
<td width="50px" class="button" id="idSave" title="Save trends" onclick="save()">Save</td>
<td class="space">&nbsp;</td>
<td width="50px" class="button" id="idPrint" title="Print" onclick="onPrint()">Print</td>
<td class="space">&nbsp;</td>
<td class="space" style="border-left: darkgray 1px solid">&nbsp;</td>
<td title="Current status" style="background-color: WhiteSmoke; padding-left: 5px; cursor: default;">
<span id="idStatus" style="color: darkgray"></span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td id="appletTd" style="padding:5px; height:100%;">
<script type="text/javascript">
var ObjParam = { //Main param:
TitleString : 'Waste Water',
ParamStr : 'Level|Flowrate|Acidity|Temperature',
UnitStr : '%|m3/h|pH|Celcius',
Hi : '100',
Lo : '0',
MaxStr : '100|70|14|100',
AxisMaximumEditor : 'true'
}
var ObjLegend = {
'effStor': 'Eff.Stor',
'neuSump': 'Neu.Sump',
'inFlow1': 'In.Flow 1',
'inFlow2': 'In.Flow 2',
'effFlow': 'Eff.Flow',
'effPH': 'Eff.Acidity',
'effTemp': 'Eff.Temp.'
}
var ObjAxis = new Object;
var ObjMax = {
'Eff.Stor' : '100',
'Neu.Sump' : '100',
'In.Flow 1' : '70',
'In.Flow 2' : '70',
'Eff.Flow' : '70',
'Eff.Acidity' : '14',
'Eff.Temp.' : '100'
}
ObjAxis['AxisA'] = 'effStor|neuSump';
ObjAxis['AxisB'] = 'inFlow1|inFlow2|effFlow';
ObjAxis['AxisC'] = 'effPH';
ObjAxis['AxisD'] = 'effTemp';
ObjAxis['AxisE'] = '';
ObjAxis['AxisF'] = '';
ObjAxis['AxisG'] = '';
loadTrend( ObjParam , ObjLegend , ObjAxis , ObjMax); //Legend format is "tag: 'desc/color'"
//Note the last param must not ended by comma
</script>
</td>
</tr>
</table>
</body>
</html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化