From 3f3e2af96c938192cd679b67b3ebf5fafa9e54a1 Mon Sep 17 00:00:00 2001 From: Junjie <fallin.jie@qq.com> Date: 星期六, 20 五月 2023 08:43:53 +0800 Subject: [PATCH] WCS监控图增加设备信息 --- src/main/webapp/static/wcs/js/console.js | 74 ++++++++++++++++++++++++++++++++++++ 1 files changed, 73 insertions(+), 1 deletions(-) diff --git a/src/main/webapp/static/wcs/js/console.js b/src/main/webapp/static/wcs/js/console.js index 71073e8..c7984a3 100644 --- a/src/main/webapp/static/wcs/js/console.js +++ b/src/main/webapp/static/wcs/js/console.js @@ -148,4 +148,76 @@ $("#line-total").empty() $("#line-total").html(total[e]) // listenChange(); -} \ No newline at end of file +} + + +layui.config({ + base: baseUrl + "/static/wms/layui/lay/modules/" +}).use(['table', 'form'], function () { + var table = layui.table; + var $ = layui.jquery; + var cache; + + // 鏁版嵁娓叉煋 + tableIns = table.render({ + elem: '#deviceInfo', + headers: {token: localStorage.getItem('token')}, + url: baseUrl + '/console/deviceInfo', + page: false, + limit: 16, + limits: [16, 30, 50, 100, 200, 500], + even: true, + cellMinWidth: 50, + cols: [[ + {field: 'device', align: 'center', title: '璁惧'} + , {field: 'deviceId', align: 'center', title: '缂栧彿'} + , {field: 'battery', align: 'center', title: '鐢甸噺'} + , {field: 'error', align: 'center', title: '寮傚父', templet: '#errorTpl'} + , {field: 'status', align: 'center', title: '鐘舵��', width: 150} + ]], + request: { + pageName: 'curr', + pageSize: 'limit' + }, + parseData: function (res) { + return { + 'code': res.code, + 'msg': res.msg, + 'count': res.data.total, + 'data': res.data.records + } + }, + response: { + statusCode: 200 + }, + done: function (res, curr, count) { + $(".layui-table-tool").hide() + $(".layui-table-view").css({"margin":"0px"}) + $(".layui-table-box").css({"padding-bottom":"0px"}) + + cache = table.cache['deviceInfo']; + } + }); + + setInterval(() => { + tableReload() + },10000) + + function tableReload() { + $.ajax({ + url: baseUrl + "/console/deviceInfo", + headers: {'token': localStorage.getItem('token')}, + contentType: 'application/json;charset=UTF-8', + method: 'GET', + traditional: true, + success: function (res) { + cache = res.data.records + table.reload('deviceInfo',{ + data: cache + }) + } + }) + } + +}); + -- Gitblit v1.9.1