From 890c164aaf39c9ca28de044d8ac55bd4fe8cbc3e Mon Sep 17 00:00:00 2001
From: vincent <1341870251@qq.com>
Date: 星期二, 02 六月 2020 11:05:44 +0800
Subject: [PATCH] #
---
src/main/webapp/views/pipeline.html | 80 ++++++++++++++++++++++-----------------
1 files changed, 45 insertions(+), 35 deletions(-)
diff --git a/src/main/webapp/views/pipeline.html b/src/main/webapp/views/pipeline.html
index cac6746..325b9eb 100644
--- a/src/main/webapp/views/pipeline.html
+++ b/src/main/webapp/views/pipeline.html
@@ -11,7 +11,6 @@
<link rel="stylesheet" type="text/css" href="../static/css/pipeline.css">
<script type="text/javascript" src="../static/js/jquery/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="../static/js/common.js"></script>
- <script type="text/javascript" src="../static/js/handlebars/handlebars-v4.5.3.js"></script>
<style>
</style>
@@ -414,52 +413,41 @@
<textarea id="output"></textarea>
</footer>
</body>
-<script type="text/template" id="plcErrorTable">
- {{#each data}}
- <tr>
- <td>{{no}}</td>
- <td>{{plcDesc}}</td>
- <td>{{error}}</td>
- </tr>
- {{/each}}
-</script>
<script>
// 鍒濆鍖�
+ var plcErrorTableFieldCount = 0;
var outputDom = document.getElementById("output");
-
- // 绌虹櫧琛ㄦ牸娓叉煋
$(document).ready(function() {
- var one = $('#plc-error-table thead').height();
- var total = $('.plc-log-body').height();
- var count = total / one;
- count = parseInt(count);
- var html = "";
- for (var i = 0; i < count-1; i ++){
- html += " <tr>\n" +
- " <td></td>\n" +
- " <td></td>\n" +
- " <td></td>\n" +
- " </tr>\n";
- }
- $('#plc-error-table tbody').after(html);
-
+ initPlcErrorTable();
getPlcError();
});
+ // 瀹炴椂璁块棶
+ setInterval(function () {
+ getPlcError();
+ }, 1000);
+ setInterval(function () {
+ output("\n" +new Date().toLocaleString() + "銆�2020-5-29 13:14:22銆戞壂鎻弍lcA 鐩爣绔�--27328372372832763643234323432342");
+ },500);
+
+
// plc寮傚父淇℃伅琛ㄨ幏鍙�
function getPlcError() {
+ var tableEl = $('#plc-error-table');
+ tableEl.children("tr").children("td").html("");
$.ajax({
url: baseUrl+ "/site/table/plc/errors",
headers: {'token': localStorage.getItem('token')},
method: 'POST',
success: function (res) {
if (res.code === 200){
- console.log(res.data);
- var tpl = $("#plcErrorTable").html();
- var template = Handlebars.compile(tpl);
- var html = template(res);
- console.log(html);
- $('#plc-error-table').append(html);
+ var table = res.data;
+ for (var i=1;i<=table.length;i++){
+ var tr = tableEl.find("tr").eq(i);
+ tr.children("td").eq(0).html(table[i-1].no);
+ tr.children("td").eq(1).html(table[i-1].plcDesc);
+ tr.children("td").eq(2).html(table[i-1].error);
+ }
} else if (res.code === 403){
top.location.href = baseUrl+"/login";
} else {
@@ -474,10 +462,32 @@
outputDom.value += content;
outputDom.scrollTop = outputDom.scrollHeight;
}
- setInterval(function () {
- output("\n" +new Date().toLocaleString() + "銆�2020-5-29 13:14:22銆戞壂鎻弍lcA 鐩爣绔�--27328372372832763643234323432342");
- },500);
+ // ------------------------------------------------------------------------------------------------
+
+ // plc寮傚父绌虹櫧琛ㄦ牸娓叉煋
+ function initPlcErrorTable(row) {
+ var line;
+ if (row === undefined){
+ var one = $('#plc-error-table thead').height();
+ var total = $('.plc-log-body').height();
+ var count = total / one;
+ count = parseInt(count) - 1;
+ plcErrorTableFieldCount = count;
+ line = count;
+ } else {
+ line = row;
+ }
+ var html = "";
+ for (var i = 0; i < line; i ++){
+ html += " <tr>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " </tr>\n";
+ }
+ $('#plc-error-table tbody').after(html);
+ }
</script>
</html>
\ No newline at end of file
--
Gitblit v1.9.1