From 7aa842ca0c3863da9024873cadd9fd64c72d26d2 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@63.com> Date: 星期二, 13 十二月 2022 08:48:54 +0800 Subject: [PATCH] # --- src/main/webapp/views/pipeline.html | 81 ++++++++++++++++++++++++++++++++++------ 1 files changed, 68 insertions(+), 13 deletions(-) diff --git a/src/main/webapp/views/pipeline.html b/src/main/webapp/views/pipeline.html index d8500fc..b4fe318 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,71 @@ 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) { + 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(res.msg, {icon: 1}) + } else if (res.code === 403){ + window.location.href = baseUrl+"/login"; + } else { + layer.msg(res.msg, {icon: 2}) + } + } + }); + layer.closeAll(); + }) + } + } + }); + } + + + } + // plc寮傚父淇℃伅琛ㄨ幏鍙� function getPlcError() { var tableEl = $('#plc-error-table'); -- Gitblit v1.9.1