自动化立体仓库 - WMS系统
lty
2026-01-22 35b1b26f1fe16550b4ee2881a26d599456fe59b4
src/main/webapp/static/js/waitPakin/waitPakin.js
@@ -1,23 +1,74 @@
var pageCurr;
function getCol() {
    var cols = [ {type: 'checkbox'} ];
    cols.push.apply(cols, detlCols);
    cols.push({field: 'locNo', align: 'center',title: '库位号'}
        ,{field: 'status', align: 'center',title: '数据状态', templet:function(row){
                var html = "<input value='status' type='checkbox' lay-skin='switch' lay-text='正常|锁定'' lay-filter='tableCheckbox' disabled='disabled' table-index='"+row.LAY_TABLE_INDEX+"'";
    cols.push.apply(cols, typeof getDetlCols === 'function' ? getDetlCols() : detlCols);
    cols.push({field: 'locNo', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('location_no') : '库位号'}
        ,{field: 'status', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('data_status') : '数据状态', templet:function(row){
                var html = "<input value='status' type='checkbox' lay-skin='switch' lay-text='"+(typeof I18n !== 'undefined' ? I18n.t('normal') : '正常')+"|"+(typeof I18n !== 'undefined' ? I18n.t('locked') : '锁定')+"' lay-filter='tableCheckbox' disabled='disabled' table-index='"+row.LAY_TABLE_INDEX+"'";
                if(row.status === 'Y'){html += " checked ";}
                html += ">";
                return html;
            }, hide: true}
        ,{field: 'ioStatus', align: 'center',title: '入出状态', templet:function(row){
                var html = "<input value='ioStatus' type='checkbox' lay-skin='switch' lay-text='入库中|待入库' lay-filter='tableCheckbox' disabled='disabled' table-index='"+row.LAY_TABLE_INDEX+"'";
        ,{field: 'ioStatus', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('io_status') : '入出状态', templet:function(row){
                var html = "<input value='ioStatus' type='checkbox' lay-skin='switch' lay-text='"+(typeof I18n !== 'undefined' ? I18n.t('inbound') : '入库中')+"|"+(typeof I18n !== 'undefined' ? I18n.t('pending_inbound') : '待入库')+"' lay-filter='tableCheckbox' disabled='disabled' table-index='"+row.LAY_TABLE_INDEX+"'";
                if(row.ioStatus === 'Y'){html += " checked ";}
                html += ">";
                return html;
            }}
        ,{field: 'modiUser$', align: 'center',title: '修改人员', hide:true}
        ,{field: 'modiTime$', align: 'center',title: '修改时间', hide:true})
        ,{field: 'modiUser$', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('modifier') : '修改人员', hide:true}
        ,{field: 'modiTime$', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('modify_time') : '修改时间', hide:true})
    return cols;
}
function updatePagination() {
    if (typeof I18n === 'undefined') return;
    // Update 'Total X items'
    $('.layui-laypage-count').each(function() {
        var text = $(this).text();
        var count = text.match(/\d+/);
        if (count) {
            $(this).text(I18n.t('total_prefix') + count[0] + I18n.t('total_suffix'));
        }
    });
    // Update 'Go to [input] page [button]'
    $('.layui-laypage-skip').each(function() {
        var $this = $(this);
        // Replace "到第" (First text node)
        var contents = $this.contents();
        for (var i = 0; i < contents.length; i++) {
            if (contents[i].nodeType === 3 && contents[i].textContent.trim() !== '') {
                // Assuming the first non-empty text node is "到第"
                contents[i].textContent = I18n.t('jump_to');
                break;
            }
        }
        // Replace "页" (Text node after input)
        var input = $this.find('.layui-input');
        if (input.length) {
            var nextNode = input[0].nextSibling;
            if (nextNode && nextNode.nodeType === 3) {
                nextNode.textContent = I18n.t('page');
            }
        }
        // Replace Button text
        var btn = $this.find('.layui-laypage-btn');
        if (btn.length) {
            btn.text(I18n.t('confirm'));
        }
    });
    // Update 'X items/page'
    $('.layui-laypage-limits select option').each(function() {
        var text = $(this).text();
        var limit = text.match(/\d+/);
        if (limit) {
            $(this).text(limit[0] + I18n.t('items_per_page'));
        }
    });
}
layui.config({
@@ -42,6 +93,9 @@
        toolbar: '#toolbar',
        cellMinWidth: 50,
        cols: [getCol()],
        text: {
            none: typeof I18n !== 'undefined' ? I18n.t('no_data') : '暂无相关数据'
        },
        request: {
            pageName: 'curr',
            pageSize: 'limit'
@@ -62,6 +116,10 @@
            if (res.code === 403) {
                top.location.href = baseUrl+"/";
            }
            if (typeof I18n !== 'undefined') {
                I18n.updatePage($('.layui-table-view'));
                updatePagination();
            }
            pageCurr=curr;
            limit();
            form.on('checkbox(tableCheckbox)', function (data) {
@@ -76,7 +134,7 @@
    });
    // 监听排序事件
    table.on('sort(locMast)', function (obj) {
    table.on('sort(waitPakin)', function (obj) {
        var searchData = {};
        $.each($('#search-box [name]').serializeArray(), function() {
            searchData[this.name] = this.value;
@@ -92,6 +150,9 @@
                if (res.code === 403) {
                    top.location.href = baseUrl+"/";
                }
                if (typeof I18n !== 'undefined') {
                    updatePagination();
                }
                pageCurr=curr;
                limit();
            }
@@ -104,9 +165,12 @@
        switch(obj.event) {
            case 'addWrk':
                if (checkStatus.data.length === 0){
                    layer.msg('请至少选择一条数据', {icon: 2});
                    layer.msg(typeof I18n !== 'undefined' ? I18n.t('select_one_data') : '请至少选择一条数据', {icon: 2});
                } else {
                    layer.confirm('确定生成工作档任务吗', function(){
                    layer.confirm(typeof I18n !== 'undefined' ? I18n.t('confirm_generate_task') : '确定生成工作档任务吗', {
                        title: typeof I18n !== 'undefined' ? I18n.t('prompt') : '提示',
                        btn: [typeof I18n !== 'undefined' ? I18n.t('confirm') : '确定', typeof I18n !== 'undefined' ? I18n.t('cancel') : '取消']
                    }, function(){
                        $.ajax({
                            url: baseUrl+"/create/waitPain/wrkMast/start",
                            headers: {'token': localStorage.getItem('token')},
@@ -132,7 +196,7 @@
            case 'addData':
                layer.open({
                    type: 2,
                    title: '新增',
                    title: typeof I18n !== 'undefined' ? I18n.t('add') : '新增',
                    maxmin: true,
                    area: [top.detailWidth, top.detailHeight],
                    content: 'waitPakin_detail.html',
@@ -146,9 +210,16 @@
            case 'deleteData':
                var data = checkStatus.data;
                if (data.length === 0){
                    layer.msg('请选择数据');
                    layer.msg(typeof I18n !== 'undefined' ? I18n.t('please_select_data') : '请选择数据');
                } else {
                    layer.confirm('确定删除'+(data.length===1?'此':data.length)+'条数据吗', function(){
                    var msg = '确定删除'+(data.length===1?'此':data.length)+'条数据吗';
                    if (typeof I18n !== 'undefined') {
                        msg = I18n.t('confirm_delete_prefix') + " " + data.length + " " + I18n.t('confirm_delete_suffix');
                    }
                    layer.confirm(msg, {
                        title: typeof I18n !== 'undefined' ? I18n.t('prompt') : '提示',
                        btn: [typeof I18n !== 'undefined' ? I18n.t('confirm') : '确定', typeof I18n !== 'undefined' ? I18n.t('cancel') : '取消']
                    }, function(){
                        $.ajax({
                            url: baseUrl+"/waitPakin/delete/auth",
                            headers: {'token': localStorage.getItem('token')},
@@ -170,7 +241,11 @@
                }
                break;
            case 'exportData':
                layer.confirm('确定导出Excel吗', {shadeClose: true}, function(){
                layer.confirm(typeof I18n !== 'undefined' ? I18n.t('confirm_export_excel') : '确定导出Excel吗', {
                    shadeClose: true,
                    title: typeof I18n !== 'undefined' ? I18n.t('prompt') : '提示',
                    btn: [typeof I18n !== 'undefined' ? I18n.t('confirm') : '确定', typeof I18n !== 'undefined' ? I18n.t('cancel') : '取消']
                }, function(){
                    var titles=[];
                    var fields=[];
                    obj.config.cols[0].map(function (col) {
@@ -218,7 +293,7 @@
            case 'detail':
                layer.open({
                    type: 2,
                    title: '详情',
                    title: typeof I18n !== 'undefined' ? I18n.t('detail') : '详情',
                    maxmin: true,
                    area: [top.detailWidth, top.detailHeight],
                    shadeClose: true,
@@ -237,7 +312,7 @@
            case 'edit':
                layer.open({
                    type: 2,
                    title: '修改',
                    title: typeof I18n !== 'undefined' ? I18n.t('edit') : '修改',
                    maxmin: true,
                    area: [top.detailWidth, top.detailHeight],
                    content: 'waitPakin_detail.html',
@@ -255,11 +330,11 @@
            case 'modiUser':
                var param = top.reObject(data).modiUser;
                if (param === undefined) {
                    layer.msg("无数据");
                    layer.msg(typeof I18n !== 'undefined' ? I18n.t('no_data_found') : "无数据");
                } else {
                   layer.open({
                       type: 2,
                       title: '修改人员详情',
                       title: typeof I18n !== 'undefined' ? I18n.t('modifier_detail') : '修改人员详情',
                       maxmin: true,
                       area: [top.detailWidth, top.detailHeight],
                       shadeClose: true,
@@ -291,11 +366,11 @@
            case 'appeUser':
                var param = top.reObject(data).appeUser;
                if (param === undefined) {
                    layer.msg("无数据");
                    layer.msg(typeof I18n !== 'undefined' ? I18n.t('no_data_found') : "无数据");
                } else {
                   layer.open({
                       type: 2,
                       title: '创建者详情',
                       title: typeof I18n !== 'undefined' ? I18n.t('creator_detail') : '创建者详情',
                       maxmin: true,
                       area: [top.detailWidth, top.detailHeight],
                       shadeClose: true,
@@ -422,6 +497,12 @@
        ,range: true
    });
    $(document).on('i18n:updated', function() {
        table.reload('waitPakin', {
            cols: [getCol()]
        });
    });
});
// 关闭动作
@@ -443,6 +524,9 @@
            if (res.code === 403) {
                top.location.href = baseUrl+"/";
            }
            if (typeof I18n !== 'undefined') {
                updatePagination();
            }
            pageCurr=curr;
            if (res.data.length === 0 && count !== 0) {
                tableIns.reload({