自动化立体仓库 - WMS系统
lty
7 天以前 539a56279625242c497b4b4093f2defbb9d80334
src/main/webapp/static/js/locDetlStatis/locDetlStatis.js
@@ -1,13 +1,38 @@
var pageCurr;
function getCol() {
    var title = '库存数量';
    if (typeof I18n !== 'undefined') {
        title = I18n.t('inventory_quantity');
    }
    var cols = [
        {field: 'anfme', align: 'center',title: '库存数量', style: 'font-weight: bold'}
        {field: 'anfme', align: 'center',title: title, style: 'font-weight: bold'}
    ];
    arrRemove(detlCols, "field", "anfme")
    arrRemove(detlCols, "field", "zpallet")
    cols.push.apply(cols, detlCols);
    // cols.push({field: 'anfme', align: 'center',title: '数量', style: 'font-weight: bold'}
    // )
    // Use getDetlCols() if available for fresh translations
    var currentDetlCols = [];
    if (typeof getDetlCols === 'function') {
        // Get fresh copy
        currentDetlCols = getDetlCols();
    } else if (typeof detlCols !== 'undefined') {
        // Fallback to global variable (might be stale or already modified)
        // Clone to avoid affecting the global variable if we are filtering
        currentDetlCols = JSON.parse(JSON.stringify(detlCols));
    }
    // Remove unwanted columns from the copy
    // We use a filter approach to avoid issues with in-place modification of globals
    // and to ensure we can switch languages correctly.
    var filteredCols = [];
    if (currentDetlCols) {
        for(var i=0; i<currentDetlCols.length; i++){
            var col = currentDetlCols[i];
            if(col.field !== 'anfme' && col.field !== 'zpallet'){
                filteredCols.push(col);
            }
        }
    }
    cols.push.apply(cols, filteredCols);
    return cols;
}
@@ -49,6 +74,14 @@
            if (res.code === 403) {
                top.location.href = baseUrl+"/";
            }
            if (typeof I18n !== 'undefined') {
                I18n.updatePage($('.layui-table-tool'));
                setTimeout(function() {
                    I18n.updateLayuiPagination();
                }, 50);
            }
            pageCurr=curr;
            limit();
            form.on('checkbox(tableCheckbox)', function (data) {
@@ -68,11 +101,43 @@
                contentType:'application/json;charset=UTF-8',
                method: 'POST',
                success: function (res) {
                    $("#countNum").text(res.data + '个');
                    var unit = (typeof I18n !== 'undefined') ? I18n.t('unit_piece') : '个';
                    $("#countNum").text(res.data + unit);
                }
            });
        }
    });
    // 监听语言切换事件
    $(document).on('i18n:languageChanged', function() {
        tableIns.reload({
            cols: [getCol()],
            text: {
                none: I18n.t('no_data')
            },
            done: function(res, curr, count) {
                if (typeof I18n !== 'undefined') {
                    I18n.updatePage($('.layui-table-tool'));
                    setTimeout(function() {
                        I18n.updateLayuiPagination();
                    }, 50);
                }
                pageCurr=curr;
                limit();
                // 重新获取数量以更新翻译
                $.ajax({
                    url: baseUrl+"/locDetl/count",
                    headers: {'token': localStorage.getItem('token')},
                    contentType:'application/json;charset=UTF-8',
                    method: 'POST',
                    success: function (res) {
                        var unit = (typeof I18n !== 'undefined') ? I18n.t('unit_piece') : '个';
                        $("#countNum").text(res.data + unit);
                    }
                });
            }
        });
    });
    // 监听排序事件
@@ -92,6 +157,14 @@
                if (res.code === 403) {
                    top.location.href = baseUrl+"/";
                }
                if (typeof I18n !== 'undefined') {
                    I18n.updatePage($('.layui-table-tool'));
                    setTimeout(function() {
                        I18n.updateLayuiPagination();
                    }, 50);
                }
                pageCurr=curr;
                limit();
            }
@@ -105,11 +178,14 @@
            case 'exportAll':
                layer.closeAll();
                layer.load(1, {shade: [0.1,'#fff']});
                location.href = baseUrl + "/locDetl/statis/export";
                var lang = (typeof I18n !== 'undefined') ? I18n.getLanguage() : 'zh-cn';
                location.href = baseUrl + "/locDetl/statis/export?lang=" + lang;
                layer.closeAll('loading');
                break;
            case 'exportData':
                layer.confirm('确定导出Excel吗', {shadeClose: true}, function(){
                var confirmMsg = (typeof I18n !== 'undefined') ? I18n.t('confirm_export_excel') : '确定导出Excel吗';
                layer.confirm(confirmMsg, {shadeClose: true, title: (typeof I18n !== 'undefined') ? I18n.t('prompt') : '提示', btn: [(typeof I18n !== 'undefined') ? I18n.t('confirm') : '确定', (typeof I18n !== 'undefined') ? I18n.t('cancel') : '取消']}, function(index){
                    layer.close(index); // Close the confirm dialog
                    var titles=[];
                    var fields=[];
                    obj.config.cols[0].map(function (col) {
@@ -157,7 +233,7 @@
            case 'detail':
                layer.open({
                    type: 2,
                    title: '详情',
                    title: (typeof I18n !== 'undefined') ? I18n.t('detail') : '详情',
                    maxmin: true,
                    area: [top.detailWidth, top.detailHeight],
                    shadeClose: false,
@@ -222,6 +298,14 @@
            if (res.code === 403) {
                top.location.href = baseUrl+"/";
            }
            if (typeof I18n !== 'undefined') {
                I18n.updatePage($('.layui-table-tool'));
                setTimeout(function() {
                    I18n.updateLayuiPagination();
                }, 50);
            }
            pageCurr=curr;
            if (res.data.length === 0 && count !== 0) {
                tableIns.reload({