pang.jiabao
2025-05-13 0069b25d77cf2dd36b030fa4c86d4f3738f552e8
src/main/webapp/static/wcs/js/console.js
@@ -40,10 +40,16 @@
            }
        }else {
            bNum = minBayNo
            let hiddenArr = [];
            if (rackss[i].hiddenArr != undefined) {
                hiddenArr = rackss[i].hiddenArr
            }
            for (let j = 0; j < bLen; j++) {
                bay = "<button class='item' style='width: "+ bayWidth +"px'>" + bNum + "</button>"
                bays = bays + bay
                bay = "<button class='item' style='width: "+ bayWidth +"px'>" + bNum + "</button>";
                if (hiddenArr.indexOf(bNum) != -1) {
                    bay = "<button class='item' style='width: "+ bayWidth +"px;visibility: hidden'>" + bNum + "</button>";
                }
                bays = bays + bay;
                bNum = bNum + minBayNo;
            }
        }
@@ -148,4 +154,76 @@
    $("#line-total").empty()
    $("#line-total").html(total[e])
    // listenChange();
}
}
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
                })
            }
        })
    }
});