自动化立体仓库 - WMS系统
lty
7 天以前 539a56279625242c497b4b4093f2defbb9d80334
src/main/webapp/static/js/saas/locMove.js
@@ -1,10 +1,17 @@
var pageCurr = 0;
var tableIns;
function getCol() {
    var cols = [
        {field: 'locNo', align: 'center',title: '库位号', merge: true, style: 'font-weight: bold'}
        {field: 'locNo', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('location_no') : '库位号', merge: true, style: 'font-weight: bold'}
    ];
    cols.push.apply(cols, detlCols);
    var dCols = [];
    if (typeof getDetlCols === 'function') {
        dCols = getDetlCols();
    } else {
        dCols = typeof detlCols !== 'undefined' ? detlCols.slice() : [];
    }
    cols.push.apply(cols, dCols);
    return cols;
}
@@ -16,42 +23,69 @@
    var form = layui.form;
    var tableMerge = layui.tableMerge;
    // 数据渲染
    tableIns = table.render({
        elem: '#locMatCode',
        headers: {token: localStorage.getItem('token')},
        // url: baseUrl+'/locDetl/list/auth',
        data:[],
        page: true,
        limit: 16,
        limits: [16, 50, 100, 200, 500],
        even: true,
        cellMinWidth: 50,
        cols: [getCol()],
        request: {
            pageName: 'curr',
            pageSize: 'limit'
        },
        parseData: function (res) {
            return {
                'code': res.code,
                'msg': res.msg,
                'count': res.data.total,
                'data': res.data.records
    window.initTable = function() {
        // 数据渲染
        tableIns = table.render({
            elem: '#locMatCode',
            headers: {token: localStorage.getItem('token')},
            // url: baseUrl+'/locDetl/list/auth',
            data:[],
            page: true,
            limit: 16,
            limits: [16, 50, 100, 200, 500],
            even: true,
            cellMinWidth: 50,
            cols: [getCol()],
            text: {
                none: typeof I18n !== 'undefined' ? I18n.t('no_data') : '暂无相关数据'
            },
            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) {
                tableMerge.render(this);
                if (res.code === 403) {
                    top.location.href = baseUrl+"/";
                }
                pageCurr=curr;
                limit();
                clearSelect();
                if (typeof I18n !== 'undefined') {
                    I18n.updatePage();
                    setTimeout(function() {
                        I18n.updateLayuiPagination();
                    }, 50);
                }
            }
        },
        response: {
            statusCode: 200
        },
        done: function(res, curr, count) {
            tableMerge.render(this);
            if (res.code === 403) {
                top.location.href = baseUrl+"/";
            }
            pageCurr=curr;
            limit();
            clearSelect();
        }
        });
    };
    if (typeof I18n !== 'undefined' && I18n.isReady()) {
        initTable();
    } else {
        $(document).on('i18n:ready', initTable);
    }
    $(document).on('i18n:languageChanged', function() {
        initTable();
        $('[data-i18n-placeholder]').each(function() {
            var key = $(this).attr('data-i18n-placeholder');
            $(this).attr('placeholder', I18n.t(key));
        });
        I18n.updatePage();
        form.render('select');
    });
});