From c350b737713fe518c22036dfc9a2574bcafcb15c Mon Sep 17 00:00:00 2001
From: vincent <1341870251@qq.com>
Date: 星期二, 02 六月 2020 15:18:08 +0800
Subject: [PATCH] #

---
 src/main/webapp/views/crn.html |   65 ++++++++++++++++++++++++++++++--
 1 files changed, 61 insertions(+), 4 deletions(-)

diff --git a/src/main/webapp/views/crn.html b/src/main/webapp/views/crn.html
index 2a5be06..6eb1082 100644
--- a/src/main/webapp/views/crn.html
+++ b/src/main/webapp/views/crn.html
@@ -163,7 +163,6 @@
 </div>
 </body>
 <script>
-
     // 绌虹櫧琛屾暟
     var crnStateTableBlankRows = 0;
     var crnMsgTableBlankRows = 0;
@@ -176,14 +175,38 @@
         initCrnStateTable();
         getCrnStateInfo();
         initCrnMsgTable();
+        getCrnMsgInfo();
     });
     // 鏁版嵁鏇存柊
     setInterval(function () {
         getCrnStateInfo();
-    },500);
+        getCrnMsgInfo();
+        getCommandLog();
+    },1000);
     setInterval(function () {
         getSiteOutput();
     },500);
+
+    // 鑾峰彇鍫嗗灈鏈烘墽琛屼腑鐨勫懡浠�
+    function getCommandLog() {
+        $.ajax({
+            url: baseUrl + "/crn/command/ongoing",
+            headers: {'token': localStorage.getItem('token')},
+            method: 'POST',
+            success: function (res) {
+                if (res.code === 200) {
+                    var commands = res.data;
+                    for (var i=0; i<commands.length;i++){
+                        $("#crn"+commands[i].crnNo).val(commands[i].command);
+                    }
+                } else if (res.code === 403) {
+                    top.location.href = baseUrl + "/login";
+                } else {
+                    alert(res.msg);
+                }
+            }
+        })
+    }
 
 
     // 鍫嗗灈鏈轰俊鎭〃鑾峰彇 ---- 琛ㄤ竴
@@ -215,6 +238,42 @@
                         setVal(tr.children("td").eq(10), table[i-1].workNo);
                         setVal(tr.children("td").eq(11), table[i-1].status);
                         setVal(tr.children("td").eq(12), table[i-1].warnCode);
+                    }
+                } else if (res.code === 403){
+                    top.location.href = baseUrl+"/login";
+                }  else {
+                    alert(res.msg);
+                }
+            }
+        });
+    }
+
+    // 鍫嗗灈鏈烘暟鎹〃鑾峰彇 ---- 琛ㄤ簩
+    function getCrnMsgInfo() {
+        var tableEl = $('#crn-msg-table');
+        $.ajax({
+            url: baseUrl+ "/crn/table/crn/msg",
+            headers: {'token': localStorage.getItem('token')},
+            method: 'POST',
+            success: function (res) {
+                if (res.code === 200){
+                    var table = res.data;
+                    if (table.length > crnStateTableBlankRows && table.length !== crnStateTableFullRows) {
+                        initCrnStateTable(table.length-crnStateTableBlankRows);
+                        crnStateTableFullRows = table.length;
+                    }
+                    for (var i=1;i<=table.length;i++){
+                        var tr = tableEl.find("tr").eq(i);
+                        setVal(tr.children("td").eq(0), table[i-1].crnNo);
+                        setVal(tr.children("td").eq(1), table[i-1].status);
+                        setVal(tr.children("td").eq(2), table[i-1].workNo);
+                        setVal(tr.children("td").eq(3), table[i-1].sourceStaNo);
+                        setVal(tr.children("td").eq(4), table[i-1].staNo);
+                        setVal(tr.children("td").eq(5), table[i-1].sourceLocNo);
+                        setVal(tr.children("td").eq(6), table[i-1].locNo);
+                        setVal(tr.children("td").eq(7), table[i-1].error);
+                        setVal(tr.children("td").eq(8), table[i-1].origin);
+                        setVal(tr.children("td").eq(9), table[i-1].command);
                     }
                 } else if (res.code === 403){
                     top.location.href = baseUrl+"/login";
@@ -315,8 +374,6 @@
         crnOutputDom.value += content;
         crnOutputDom.scrollTop = crnOutputDom.scrollHeight;
     }
-
-
 
 </script>
 </html>
\ No newline at end of file

--
Gitblit v1.9.1