自动化立体仓库 - WMS系统
lty
3 天以前 d907a822a940c7ec0fb7de0ca845472bda52229b
src/main/webapp/static/js/apiLog/apiLog.js
@@ -9,59 +9,93 @@
    var form = layui.form;
    var admin = layui.admin;
    // 数据渲染
    tableIns = table.render({
        elem: '#apiLog',
        headers: {token: localStorage.getItem('token')},
        url: baseUrl+'/apiLog/list/auth',
        page: true,
        limit: 15,
        limits: [15, 30, 50, 100, 200, 500],
        toolbar: '#toolbar',
        cellMinWidth: 50,
        height: 'full-120',
        cols: [[
    function getCols() {
        return [[
            {type: 'checkbox'}
            // ,{field: 'id', align: 'center',title: 'ID'}
            // ,{field: 'uuid', align: 'center',title: '日志编号'}
            ,{field: 'namespace', align: 'center',title: '名称空间'}
            ,{field: 'url', align: 'center',title: '接口地址'}
            ,{field: 'appkey', align: 'center',title: '平台密钥'}
            ,{field: 'namespace', align: 'center',title: I18n.t('namespace')}
            ,{field: 'url', align: 'center',title: I18n.t('form_id')}
            ,{field: 'appkey', align: 'center',title: I18n.t('app_key'),hide: true}
            // ,{field: 'timestamp', align: 'center',title: '时间戳'}
            ,{field: 'clientIp', align: 'center',title: '客户端IP'}
            ,{field: 'request', align: 'center',title: '请求内容'}
            ,{field: 'response', align: 'center',title: '响应内容'}
            ,{field: 'clientIp', align: 'center',title: I18n.t('client_ip'),hide: true}
            ,{field: 'request', align: 'center',title: I18n.t('request_content')}
            ,{field: 'response', align: 'center',title: I18n.t('operation_content')}
            // ,{field: 'err', align: 'center',title: '异常内容'}
            ,{field: 'result$', align: 'center',title: '结果', templet: '#resTpl', width: 80}
            ,{field: 'result$', align: 'center',title: I18n.t('result'), templet: '#resTpl', width: 80}
            // ,{field: 'status$', align: 'center',title: '状态'}
            ,{field: 'createTime$', align: 'center',title: '添加时间'}
            ,{field: 'createTime$', align: 'center',title: I18n.t('add_time')}
            // ,{field: 'updateTime$', align: 'center',title: '修改时间'}
            ,{field: 'memo', align: 'center',title: '备注', hide: true}
            ,{field: 'memo', align: 'center',title: I18n.t('memo'), hide: true}
            ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width: 80}
        ]],
        request: {
            pageName: 'curr',
            pageSize: 'limit'
        },
        parseData: function (res) {
            return {
                'code': res.code,
                'msg': res.msg,
                'count': res.data.total,
                'data': res.data.records
            ,{fixed: 'right', title: I18n.t('operation'), align: 'center', toolbar: '#operate', width: 80}
        ]];
    }
    // 数据渲染
    var initTable = function() {
        tableIns = table.render({
            elem: '#apiLog',
            headers: {token: localStorage.getItem('token')},
            url: baseUrl+'/apiLog/list/auth',
            page: true,
            limit: 15,
            limits: [15, 30, 50, 100, 200, 500],
            toolbar: '#toolbar',
            cellMinWidth: 50,
            height: 'full-120',
            cols: getCols(),
            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) {
                if (res.code === 403) {
                    top.location.href = baseUrl+"/";
                }
                pageCurr=curr;
                limit();
                I18n.updatePage();
                setTimeout(function() {
                    I18n.updateLayuiPagination();
                }, 100);
            }
        },
        response: {
            statusCode: 200
        },
        done: function(res, curr, count) {
            if (res.code === 403) {
                top.location.href = baseUrl+"/";
        });
    }
    if (typeof I18n !== 'undefined' && I18n.isReady()) {
        initTable();
    } else {
        $(document).on('i18n:ready', initTable);
    }
    $(document).on('i18n:languageChanged', function() {
        tableIns.reload({
            cols: getCols(),
            done: function(res, curr, count) {
                if (res.code === 403) {
                    top.location.href = baseUrl+"/";
                }
                pageCurr=curr;
                limit();
                I18n.updatePage();
                setTimeout(function() {
                    I18n.updateLayuiPagination();
                }, 100);
            }
            pageCurr=curr;
            limit();
        }
        });
        I18n.updatePage();
    });
    // 监听排序事件
@@ -74,7 +108,18 @@
        searchData['orderByType'] = obj.type;
        tableIns.reload({
            where: searchData,
            page: {curr: 1}
            page: {curr: 1},
            done: function(res, curr, count) {
                if (res.code === 403) {
                    top.location.href = baseUrl+"/";
                }
                pageCurr=curr;
                limit();
                I18n.updatePage();
                setTimeout(function() {
                    I18n.updateLayuiPagination();
                }, 100);
            }
        });
    });
@@ -156,6 +201,7 @@
            title: (mData ? '修改' : '添加') + '订单状态',
            content: $('#editDialog').html(),
            success: function (layero, dIndex) {
                I18n.updatePage(layero);
                layDateRender(mData);
                form.val('detail', mData);
                form.on('submit(editSubmit)', function (data) {
@@ -259,6 +305,17 @@
    });
    tableIns.reload({
        where: searchData,
        page: {curr: pageCurr}
        page: {curr: pageCurr},
        done: function(res, curr, count) {
            if (res.code === 403) {
                top.location.href = baseUrl+"/";
            }
            pageCurr=curr;
            limit();
            I18n.updatePage();
            setTimeout(function() {
                I18n.updateLayuiPagination();
            }, 100);
        }
     });
}