From acabc19b58ebdfd71fdd3e9a279989005e7c9e79 Mon Sep 17 00:00:00 2001
From: TQS <56479841@qq.com>
Date: 星期五, 02 十二月 2022 15:16:45 +0800
Subject: [PATCH] #

---
 src/main/webapp/views/pipeline.html |   80 +++++++++++++++++++++++++++++++++------
 1 files changed, 67 insertions(+), 13 deletions(-)

diff --git a/src/main/webapp/views/pipeline.html b/src/main/webapp/views/pipeline.html
index d8500fc..6415b2f 100644
--- a/src/main/webapp/views/pipeline.html
+++ b/src/main/webapp/views/pipeline.html
@@ -58,33 +58,27 @@
                     <!-- 璁惧浠诲姟鎿嶄綔 -->
                     <div class="io-mode-oper">
                         <fieldset>
-                            <legend>鍏ュ嚭搴撴ā寮忥紙IO-Mode锛�</legend>
+                            <legend>鍏呯數鎺у埗锛圕harge-Mode锛�</legend>
                             <div class="io-mode-box">
-                                <label>1F</label>
+                                <label>1#</label>
                                 <button id="io-mode-1" class="ioModeBtn" onclick="ioModeSwitch(this.id)"> - </button>
                             </div>
                             <div class="io-mode-box">
-                                <label>3F</label>
+                                <label>2#</label>
                                 <button id="io-mode-2" class="ioModeBtn" onclick="ioModeSwitch(this.id)"> - </button>
                             </div>
                             <div class="io-mode-box">
-                                <label>4F</label>
+                                <label>3#</label>
                                 <button id="io-mode-3" class="ioModeBtn" onclick="ioModeSwitch(this.id)"> - </button>
                             </div>
-                            <div class="io-mode-box">
-                                <label>5F</label>
-                                <button id="io-mode-4" class="ioModeBtn" onclick="ioModeSwitch(this.id)"> - </button>
-                            </div>
                         </fieldset>
-                    </div>
-
-
-                    <div>
-                        <span style="color: #1E9FFF">PLC寮傚父淇℃伅琛�:</span>
                     </div>
                 </div>
                 <!-- 涓讳綋 -->
                 <div class="plc-log-body">
+                    <div>
+                        <span style="color: #1E9FFF">PLC寮傚父淇℃伅琛�:</span>
+                    </div>
                     <table id="plc-error-table">
                         <thead>
                         <tr>
@@ -175,6 +169,7 @@
     var siteTableFullRows = 0;
     var outputDom = document.getElementById("output");
     $(document).ready(function() {
+        getIoModeInfo();
         initPlcErrorTable();
         getPlcError();
         initSiteTable();
@@ -184,11 +179,70 @@
     setInterval(function () {
         getPlcError();
         getSite();
+        getIoModeInfo();
     }, 1000);
     setInterval(function () {
         getSiteOutput();
     },500);
 
+    var ioModeData;
+    function getIoModeInfo() {
+        $.ajax({
+            url: baseUrl+ "/site/io/mode/info/site",
+            headers: {'token': localStorage.getItem('token')},
+            method: 'GET',
+            success: function (res) {
+                if (res.code === 200){
+                    ioModeData = res.data;
+                    ioModeData.forEach(function (e) {
+                        $("#io-mode-"+e.floor).html(e.modeDesc);
+                    })
+                } else if (res.code === 403){
+                    window.location.href = baseUrl+"/login";
+                }  else {
+                    console.log(res.msg);
+                }
+            }
+        });
+    }
+
+    /**
+     * 寮哄埗鍒囨崲鍏ュ嚭搴撴ā寮�
+     */
+    function ioModeSwitch(el) {
+        var floor = el.split("-")[2];
+        if (ioModeData != null && ioModeData.length > 1) {
+            ioModeData.forEach(function(e) {
+                if (e.floor === Number(floor)) {
+                    console.log()
+                    layer.confirm('纭畾鍒囨崲鍏呯數鐘舵�佸悧锛�',function () {
+                        $.ajax({
+                            url: baseUrl+ "/site/io/mode/action/site",
+                            headers: {'token': localStorage.getItem('token')},
+                            data: {
+                                floor: e.floor,
+                                charge: !e.modeVal
+                            },
+                            method: 'POST',
+                            success: function (res) {
+                                if (res.code === 200){
+                                    layer.msg("鎿嶄綔鎴愬姛锛岃鑰愬績绛夊緟涓�鍒嗛挓", {icon: 1})
+                                } else if (res.code === 403){
+                                    window.location.href = baseUrl+"/login";
+                                }  else {
+                                    console.log(res.msg);
+                                }
+                            }
+                        });
+                        layer.closeAll();
+                    })
+                }
+            });
+        }
+
+
+    }
+
     // plc寮傚父淇℃伅琛ㄨ幏鍙�
     function getPlcError() {
         var tableEl = $('#plc-error-table');

--
Gitblit v1.9.1