From 41eaaf7f671bc59ec2fc195c299ba158f02b2d45 Mon Sep 17 00:00:00 2001 From: vincent <1341870251@qq.com> Date: 星期二, 02 六月 2020 08:58:11 +0800 Subject: [PATCH] # --- src/main/java/com/zy/client/controller/SiteController.java | 30 +++++++ src/main/webapp/static/css/pipeline.css | 60 +++++++++++++++ src/main/webapp/views/pipeline.html | 78 +++++-------------- src/main/java/com/zy/client/domain/PlcErrorTable.java | 40 ++++++++++ 4 files changed, 151 insertions(+), 57 deletions(-) diff --git a/src/main/java/com/zy/client/controller/SiteController.java b/src/main/java/com/zy/client/controller/SiteController.java index 1971837..9eccd10 100644 --- a/src/main/java/com/zy/client/controller/SiteController.java +++ b/src/main/java/com/zy/client/controller/SiteController.java @@ -1,7 +1,14 @@ package com.zy.client.controller; +import com.core.annotations.ManagerAuth; +import com.core.common.R; +import com.zy.client.domain.PlcErrorTable; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; + +import java.util.ArrayList; +import java.util.List; /** * 杈撻�佽澶囨帴鍙� @@ -11,5 +18,28 @@ @RequestMapping("/site") public class SiteController { + @PostMapping("/table/plc/errors") + @ManagerAuth(memo = "杈撻�佽澶噋lc寮傚父淇℃伅琛�") + public R crnLatestData(){ + List<PlcErrorTable> list = new ArrayList<>(); + for (int i=0;i<10;i++){ + PlcErrorTable table = new PlcErrorTable(); + table.setNo(String.valueOf(i)); + table.setError("寮傚父淇℃伅"); + table.setPlcDesc("plc寮傚父鎻忚堪"); + list.add(table); + } + list.sort((o1, o2) -> { + if (o1.getNo().compareTo(o2.getNo()) > 0){ + return 1; + }else if (o1.getNo().compareTo(o2.getNo()) < 0){ + return 0; + }else{ + return -1; + } + + }); + return R.ok().add(list); + } } diff --git a/src/main/java/com/zy/client/domain/PlcErrorTable.java b/src/main/java/com/zy/client/domain/PlcErrorTable.java new file mode 100644 index 0000000..647accc --- /dev/null +++ b/src/main/java/com/zy/client/domain/PlcErrorTable.java @@ -0,0 +1,40 @@ +package com.zy.client.domain; + +/** + * Created by vincent on 2020-06-02 + */ +public class PlcErrorTable { + + // 搴忓彿 + private String no; + + // plc寮傚父鎻忚堪 + private String plcDesc; + + // 寮傚父 + private String error; + + public String getNo() { + return no; + } + + public void setNo(String no) { + this.no = no; + } + + public String getPlcDesc() { + return plcDesc; + } + + public void setPlcDesc(String plcDesc) { + this.plcDesc = plcDesc; + } + + public String getError() { + return error; + } + + public void setError(String error) { + this.error = error; + } +} diff --git a/src/main/webapp/static/css/pipeline.css b/src/main/webapp/static/css/pipeline.css index 6a4f519..5c99e76 100644 --- a/src/main/webapp/static/css/pipeline.css +++ b/src/main/webapp/static/css/pipeline.css @@ -19,6 +19,66 @@ border-right: 1px solid #cad9ea; } +/* 琛ㄦ牸 */ +.plc-log-header { + height: 15%; +} +.plc-log-body { + height: 85%; + overflow: auto; +} + + +/* 绔欑偣琛ㄦ牸 */ +#site-table { + font-size: 12px; + border-collapse: collapse; + margin: 0 auto; + text-align: center; +} +#site-table td, #site-table th { + border: 1px solid #cad9ea; + color: #666; + height: 25px; +} +#site-table thead th { + background-color: #CCE8EB; + width: 100px; +} +#site-table tr:nth-child(odd) { + background: #fff; +} +#site-table tr:nth-child(even) { + background: #F5FAFA; +} + + + +/* plc寮傚父琛ㄦ牸 */ +#plc-error-table { + font-size: 12px; + border-collapse: collapse; + margin: 0 auto; +} +#plc-error-table td, #plc-error-table th { + border: 1px solid #cad9ea; + color: #666; + height: 25px; + text-align: left; + padding-left: 5px; +} +#plc-error-table thead th { + background-color: #CCE8EB; + width: 100px; +} +#plc-error-table tr:nth-child(odd) { + background: #fff; +} +#plc-error-table tr:nth-child(even) { + background: #F5FAFA; +} + + /* 灏鹃儴 */ footer { height: 11%; diff --git a/src/main/webapp/views/pipeline.html b/src/main/webapp/views/pipeline.html index de76ec4..8320cd8 100644 --- a/src/main/webapp/views/pipeline.html +++ b/src/main/webapp/views/pipeline.html @@ -10,65 +10,9 @@ <link rel="stylesheet" type="text/css" href="../static/css/common.css"> <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/layer/layer.js"></script> <style> - .plc-log-header { - height: 15%; - } - .plc-log-body { - height: 85%; - overflow: auto; - } - - - /* 绔欑偣琛ㄦ牸 */ - #site-table { - font-size: 12px; - border-collapse: collapse; - margin: 0 auto; - text-align: center; - } - #site-table td, #site-table th { - border: 1px solid #cad9ea; - color: #666; - height: 25px; - } - #site-table thead th { - background-color: #CCE8EB; - width: 100px; - } - #site-table tr:nth-child(odd) { - background: #fff; - } - #site-table tr:nth-child(even) { - background: #F5FAFA; - } - - - - /* plc寮傚父琛ㄦ牸 */ - #plc-error-table { - font-size: 12px; - border-collapse: collapse; - margin: 0 auto; - } - #plc-error-table td, #plc-error-table th { - border: 1px solid #cad9ea; - color: #666; - height: 25px; - text-align: left; - padding-left: 5px; - } - #plc-error-table thead th { - background-color: #CCE8EB; - width: 100px; - } - #plc-error-table tr:nth-child(odd) { - background: #fff; - } - #plc-error-table tr:nth-child(even) { - background: #F5FAFA; - } </style> </head> @@ -489,6 +433,26 @@ $('#plc-error-table tbody').after(html); }); + getPlcError(); + // plc寮傚父淇℃伅琛ㄨ幏鍙� + function getPlcError() { + $.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); + addPlcError(res.data); + } else if (res.code === 403){ + top.location.href = baseUrl+"/login"; + } else { + alert(res.msg); + } + } + }); + } + // plc寮傚父杈撳叆 function addPlcError(val) { -- Gitblit v1.9.1