From 4702274720a7c87605f9f7c286ea092448ad3a5a Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期二, 20 九月 2022 14:18:07 +0800 Subject: [PATCH] # --- src/main/webapp/views/pipeline.html | 71 +++++++++++++++++++++++++++++++---- 1 files changed, 62 insertions(+), 9 deletions(-) diff --git a/src/main/webapp/views/pipeline.html b/src/main/webapp/views/pipeline.html index d8500fc..8361771 100644 --- a/src/main/webapp/views/pipeline.html +++ b/src/main/webapp/views/pipeline.html @@ -58,26 +58,21 @@ <!-- 璁惧浠诲姟鎿嶄綔 --> <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> @@ -175,6 +170,7 @@ var siteTableFullRows = 0; var outputDom = document.getElementById("output"); $(document).ready(function() { + getIoModeInfo(); initPlcErrorTable(); getPlcError(); initSiteTable(); @@ -184,11 +180,68 @@ 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)) { + if (e.modeVal === 3 || e.modeVal === 4) { + layer.confirm('纭畾鍒囨崲涓哄叆搴撴ā寮忓悧锛�',function () { + $.ajax({ + url: baseUrl+ "/site/io/mode/action/site", + headers: {'token': localStorage.getItem('token')}, + data: {floor: e.floor}, + 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