From 0cc7484397c776af7a7279405d9b5034d5f0edfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=9C=E7=AC=99=E6=AD=8C?= <2277317060@qq.com> Date: Thu, 9 Jun 2022 13:59:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/static/js/common/scrollTable.js | 4 +- .../resources/static/js/tankShell/device.js | 140 ++++++++++++------ .../resources/templates/tankShell/device.html | 4 +- .../classes/static/js/common/scrollTable.js | 4 +- .../classes/static/js/tankShell/device.js | 140 ++++++++++++------ .../classes/templates/tankShell/device.html | 4 +- 6 files changed, 192 insertions(+), 104 deletions(-) diff --git a/productionboard/src/main/resources/static/js/common/scrollTable.js b/productionboard/src/main/resources/static/js/common/scrollTable.js index 950975a..e92b6ee 100644 --- a/productionboard/src/main/resources/static/js/common/scrollTable.js +++ b/productionboard/src/main/resources/static/js/common/scrollTable.js @@ -220,7 +220,7 @@ let dynamicTable = resource => { //奇偶校验 --> 处理最后一行是奇数的问题 let oddORevenCheck = $(`${ele}>.table>.tbody>.tr`).length % 2 == 0 ? 'even' : 'odd'; //滚动动画 - setInterval(function() { + var animation = () => setInterval(function() { $(ele + '>.table>.tbody>.tr:eq(0)').slideToggle(100, function() { switch (oddORevenCheck) { case 'even': @@ -239,7 +239,7 @@ let dynamicTable = resource => { // 组件销毁钩子 $(`${ele}`).bind('DOMNodeRemoved', (e) => { if (e.target.classList[0] === 'asit-table') { - clearInterval(timer); + clearInterval(animation); } }); } diff --git a/productionboard/src/main/resources/static/js/tankShell/device.js b/productionboard/src/main/resources/static/js/tankShell/device.js index 9b66238..a648d59 100644 --- a/productionboard/src/main/resources/static/js/tankShell/device.js +++ b/productionboard/src/main/resources/static/js/tankShell/device.js @@ -4,6 +4,31 @@ $(() => { $.getJSON('/tankShellDevice/getOeeStatistics', function (result) { OEEStatistics(result, document.getElementById("OEEStatistics")); }); + setInterval(() => { + let result = [ + { + "createTime": 1654729200000, + "yValue": "07", + "xValue": Math.random() * 3 + }, + { + "createTime": 1654732800000, + "yValue": "08", + "xValue": Math.random() * 3 + }, + { + "createTime": 1654736400000, + "yValue": "09", + "xValue": Math.random() * 3 + }, + { + "createTime": 1654740000000, + "yValue": "10", + "xValue": Math.random() * 3 + } + ] + OEEStatistics(result, document.getElementById("OEEStatistics")); + }, 1000); //设备故障排名 $.getJSON('/tankShell/getStatisticalOutputByModel', function (result) { @@ -21,58 +46,75 @@ $(() => { }); //生产计划 - $.ajax({ - url: '/storage/getProductionPlan', - type: 'GET', - dataType: 'JSON', - success: function (res) { - let Res = res - Res.data.forEach(val => { - val[0] = 'SHEBEI452736' - val[1] = 'AGYM45HH23' - val[2] = '32' - val[3] = '2021.01.01 10:00:00' - delete val[4] - }); - Res.header = ['设备名称', '参数名称', '当前值', '时间',] - dynamicTable({ - el: '#productionPlan', - rowNum: 5, - timeout: 0, - header: Res.header, - data: Res.data, - index: false, - fontColor: '#B4B7BF ', - indexBGC: '#86F3FF', - headerBGC: 'rgba(8,36,75,0.2)', - oddRowBGC: 'rgba(8,36,75,0.2)', - evenRowBGC: 'rgba(6,25,57,0.2)', - colWidth: ['100%', '100%', '40%', '160%',] - }); - }, - error: function (e) { - console.log(e) + + let isUpdata = false + const getTable = () => { + $.ajax({ + url: '/storage/getProductionPlan', + type: 'GET', + dataType: 'JSON', + success: function (res) { + console.log('update'); + let Res = res + Res.data.forEach(val => { + val[0] = 'SHEBEI452736' + val[1] = 'AGYM45HH23' + val[2] = Math.random()*30 + val[3] = '2021.01.01 10:00:00' + delete val[4] + }); + Res.header = ['设备名称', '参数名称', '当前值', '时间',] + console.log(Res); + dynamicTable({ + el: '#productionPlan', + rowNum: 5, + timeout: 0, + header: Res.header, + data: Res.data, + index: false, + fontColor: '#B4B7BF ', + indexBGC: '#86F3FF', + headerBGC: 'rgba(8,36,75,0.2)', + oddRowBGC: 'rgba(8,36,75,0.2)', + evenRowBGC: 'rgba(6,25,57,0.2)', + colWidth: ['100%', '100%', '40%', '160%',] + }); + }, + error: function (e) { + console.log(e) + } + }); + } + getTable() + setInterval(() => { + console.log(123123); + if (isUpdata) { + console.log($('#productionPlan')); + clearInterval(animation); + animation = null + $('.scrollTable').html('
') + getTable() } - }); + }, 2000); + setInterval(() => { + isUpdata = !isUpdata + }, 4000); /*数据信息*/ - const statusArray = [0, 0, 0, 0, 0]; - // var a = () => { - $.getJSON('/tankShellDevice/getDataInformation', function (result) { - dataInformationFunction(result) - }); - $.getJSON('/tankShellDevice/getRunParameters', function (result) { - console.log(result); - energyProductionStatisticsFunction(result) - runParamStatisticsFunction(result) - $("#lossParam").text(result[8]); - - $("#meterParam").text(result[9]); - }); - $.getJSON('/tankShellDevice/getRunParameters', function (result) { - runParamStatisticsFunction(result) - }); - // } + $.getJSON('/tankShellDevice/getDataInformation', function (result) { + dataInformationFunction(result) + }); + $.getJSON('/tankShellDevice/getRunParameters', function (result) { + console.log(result); + energyProductionStatisticsFunction(result) + runParamStatisticsFunction(result) + $("#lossParam").text(result[8]); + + $("#meterParam").text(result[9]); + }); + $.getJSON('/tankShellDevice/getRunParameters', function (result) { + runParamStatisticsFunction(result) + }); }) /*数据信息*/ diff --git a/productionboard/src/main/resources/templates/tankShell/device.html b/productionboard/src/main/resources/templates/tankShell/device.html index 2bf3b3e..999a15b 100644 --- a/productionboard/src/main/resources/templates/tankShell/device.html +++ b/productionboard/src/main/resources/templates/tankShell/device.html @@ -42,7 +42,9 @@
-
+
+
+
diff --git a/productionboard/target/classes/static/js/common/scrollTable.js b/productionboard/target/classes/static/js/common/scrollTable.js index 950975a..e92b6ee 100644 --- a/productionboard/target/classes/static/js/common/scrollTable.js +++ b/productionboard/target/classes/static/js/common/scrollTable.js @@ -220,7 +220,7 @@ let dynamicTable = resource => { //奇偶校验 --> 处理最后一行是奇数的问题 let oddORevenCheck = $(`${ele}>.table>.tbody>.tr`).length % 2 == 0 ? 'even' : 'odd'; //滚动动画 - setInterval(function() { + var animation = () => setInterval(function() { $(ele + '>.table>.tbody>.tr:eq(0)').slideToggle(100, function() { switch (oddORevenCheck) { case 'even': @@ -239,7 +239,7 @@ let dynamicTable = resource => { // 组件销毁钩子 $(`${ele}`).bind('DOMNodeRemoved', (e) => { if (e.target.classList[0] === 'asit-table') { - clearInterval(timer); + clearInterval(animation); } }); } diff --git a/productionboard/target/classes/static/js/tankShell/device.js b/productionboard/target/classes/static/js/tankShell/device.js index 9b66238..24c827a 100644 --- a/productionboard/target/classes/static/js/tankShell/device.js +++ b/productionboard/target/classes/static/js/tankShell/device.js @@ -4,6 +4,31 @@ $(() => { $.getJSON('/tankShellDevice/getOeeStatistics', function (result) { OEEStatistics(result, document.getElementById("OEEStatistics")); }); + setInterval(() => { + let result = [ + { + "createTime": 1654729200000, + "yValue": "07", + "xValue": Math.random() * 3 + }, + { + "createTime": 1654732800000, + "yValue": "08", + "xValue": Math.random() * 3 + }, + { + "createTime": 1654736400000, + "yValue": "09", + "xValue": Math.random() * 3 + }, + { + "createTime": 1654740000000, + "yValue": "10", + "xValue": Math.random() * 3 + } + ] + OEEStatistics(result, document.getElementById("OEEStatistics")); + }, 1000); //设备故障排名 $.getJSON('/tankShell/getStatisticalOutputByModel', function (result) { @@ -21,58 +46,75 @@ $(() => { }); //生产计划 - $.ajax({ - url: '/storage/getProductionPlan', - type: 'GET', - dataType: 'JSON', - success: function (res) { - let Res = res - Res.data.forEach(val => { - val[0] = 'SHEBEI452736' - val[1] = 'AGYM45HH23' - val[2] = '32' - val[3] = '2021.01.01 10:00:00' - delete val[4] - }); - Res.header = ['设备名称', '参数名称', '当前值', '时间',] - dynamicTable({ - el: '#productionPlan', - rowNum: 5, - timeout: 0, - header: Res.header, - data: Res.data, - index: false, - fontColor: '#B4B7BF ', - indexBGC: '#86F3FF', - headerBGC: 'rgba(8,36,75,0.2)', - oddRowBGC: 'rgba(8,36,75,0.2)', - evenRowBGC: 'rgba(6,25,57,0.2)', - colWidth: ['100%', '100%', '40%', '160%',] - }); - }, - error: function (e) { - console.log(e) + + let isUpdata = false + const getTable = () => { + $.ajax({ + url: '/storage/getProductionPlan', + type: 'GET', + dataType: 'JSON', + success: function (res) { + console.log('update'); + let Res = res + Res.data.forEach(val => { + val[0] = 'SHEBEI452736' + val[1] = 'AGYM45HH23' + val[2] = Math.random()*30 + val[3] = '2021.01.01 10:00:00' + delete val[4] + }); + Res.header = ['设备名称', '参数名称', '当前值', '时间',] + console.log(Res); + dynamicTable({ + el: '#productionPlan', + rowNum: 5, + timeout: 0, + header: Res.header, + data: Res.data, + index: false, + fontColor: '#B4B7BF ', + indexBGC: '#86F3FF', + headerBGC: 'rgba(8,36,75,0.2)', + oddRowBGC: 'rgba(8,36,75,0.2)', + evenRowBGC: 'rgba(6,25,57,0.2)', + colWidth: ['100%', '100%', '40%', '160%',] + }); + }, + error: function (e) { + console.log(e) + } + }); + } + getTable() + setInterval(() => { + console.log(123123); + if (isUpdata) { + console.log($('#productionPlan')); + clearInterval(animation); + animation = null + $('.scrollTable').html('
') + getTable() } - }); + }, 2000); + setInterval(() => { + isUpdata = !isUpdata + }, 10000); /*数据信息*/ - const statusArray = [0, 0, 0, 0, 0]; - // var a = () => { - $.getJSON('/tankShellDevice/getDataInformation', function (result) { - dataInformationFunction(result) - }); - $.getJSON('/tankShellDevice/getRunParameters', function (result) { - console.log(result); - energyProductionStatisticsFunction(result) - runParamStatisticsFunction(result) - $("#lossParam").text(result[8]); - - $("#meterParam").text(result[9]); - }); - $.getJSON('/tankShellDevice/getRunParameters', function (result) { - runParamStatisticsFunction(result) - }); - // } + $.getJSON('/tankShellDevice/getDataInformation', function (result) { + dataInformationFunction(result) + }); + $.getJSON('/tankShellDevice/getRunParameters', function (result) { + console.log(result); + energyProductionStatisticsFunction(result) + runParamStatisticsFunction(result) + $("#lossParam").text(result[8]); + + $("#meterParam").text(result[9]); + }); + $.getJSON('/tankShellDevice/getRunParameters', function (result) { + runParamStatisticsFunction(result) + }); }) /*数据信息*/ diff --git a/productionboard/target/classes/templates/tankShell/device.html b/productionboard/target/classes/templates/tankShell/device.html index 2bf3b3e..999a15b 100644 --- a/productionboard/target/classes/templates/tankShell/device.html +++ b/productionboard/target/classes/templates/tankShell/device.html @@ -42,7 +42,9 @@
-
+
+
+