自动化立体仓库 - WMS系统
lty
2026-01-22 35b1b26f1fe16550b4ee2881a26d599456fe59b4
src/main/webapp/static/js/wrkMastLog/wrkMastLog.js
@@ -9,30 +9,95 @@
    var form = layui.form;
    // 数据渲染
    tableIns = table.render({
        elem: '#wrkMastLog',
        headers: {token: localStorage.getItem('token')},
        url: baseUrl+'/wrkMastLog/list/auth',
        page: true,
        limit: 16,
        limits: [16, 30, 50, 100, 200, 500],
        even: true,
        toolbar: '#toolbar',
        cellMinWidth: 50,
        cols: [[
    function initTable() {
        tableIns = table.render({
            elem: '#wrkMastLog',
            headers: {token: localStorage.getItem('token')},
            url: baseUrl+'/wrkMastLog/list/auth',
            page: true,
            limit: 16,
            limits: [16, 30, 50, 100, 200, 500],
            even: true,
            toolbar: '#toolbar',
            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
                }
            },
            response: {
                statusCode: 200
            },
            done: doneCallback
        });
    }
    if (I18n.isReady()) {
        initTable();
    } else {
        $(document).on('i18n:ready', initTable);
    }
    var doneCallback = function(res, curr, count) {
        if (res.code === 403) {
            top.location.href = baseUrl+"/";
        }
        pageCurr=curr;
        limit();
        form.on('checkbox(tableCheckbox)', function (data) {
            var _index = $(data.elem).attr('table-index')||0;
            if(data.elem.checked){
                res.data[_index][data.value] = 'Y';
            }else{
                res.data[_index][data.value] = 'N';
            }
        });
        setTimeout(function() {
            if (typeof I18n !== 'undefined') {
                I18n.updatePage($('.layui-table-view'));
                I18n.updateLayuiPagination();
            }
        }, 50);
    };
    $(document).on('i18n:languageChanged', function() {
        tableIns.reload({
            cols: getCol(),
            done: doneCallback
        });
    });
    function getCol() {
        return [[
            // {type: 'checkbox'}
//            ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80}
//             ,{field: 'id', align: 'center',title: '编号'}
            {field: 'wrkNo', align: 'center',title: '工作号',event: 'wrkNo', sort: true}
            ,{field: 'ioTime$', align: 'center',title: '工作时间', width:160, sort: true}
            ,{field: 'wrkSts$', align: 'center',title: '工作状态', width:160}
            ,{field: 'ioType$', align: 'center',title: '入出库类型', width:160}
            ,{field: 'ioPri', align: 'center',title: '优先级'}
            ,{field: 'crnNo$', align: 'center',title: '堆垛机号'}
            ,{field: 'sourceStaNo$', align: 'center',title: '源站'}
            ,{field: 'staNo$', align: 'center',title: '目标站'}
            ,{field: 'sourceLocNo$', align: 'center',title: '源库位'}
            ,{field: 'locNo$', align: 'center',title: '目标库位'}
            {field: 'wrkNo', align: 'center',title: I18n.t('work_no'),event: 'wrkNo', sort: true}
            ,{field: 'ioTime$', align: 'center',title: I18n.t('work_time'), width:160, sort: true}
            ,{field: 'wrkSts', align: 'center',title: I18n.t('work_status'), width:160, templet: function(d) {
                var key = 'wrk_status_' + d.wrkSts;
                var text = I18n.t(key);
                return text === key ? d.wrkSts$ : text;
            }}
            ,{field: 'ioType', align: 'center',title: I18n.t('transaction_type'), width:160, templet: function(d) {
                var key = 'io_type_' + d.ioType;
                var text = I18n.t(key);
                return text === key ? d.ioType$ : text;
            }}
            ,{field: 'ioPri', align: 'center',title: I18n.t('priority')}
            ,{field: 'crnNo$', align: 'center',title: I18n.t('crane_no')}
            ,{field: 'sourceStaNo$', align: 'center',title: I18n.t('source_station')}
            ,{field: 'staNo$', align: 'center',title: I18n.t('target_station')}
            ,{field: 'sourceLocNo$', align: 'center',title: I18n.t('source_location')}
            ,{field: 'locNo$', align: 'center',title: I18n.t('target_location')}
            // ,{field: 'picking', align: 'center',title: '拣料', templet:function(row){
            //         var html = "<input value='picking' type='checkbox' lay-skin='primary' lay-filter='tableCheckbox' table-index='"+row.LAY_TABLE_INDEX+"'";
            //         if(row.picking === 'Y'){html += " checked ";}
@@ -55,11 +120,11 @@
            // ,{field: 'crnStrTime$', align: 'center',title: '堆垛机启动时间'}
            // ,{field: 'crnEndTime$', align: 'center',title: '堆垛机停止时间'}
            // ,{field: 'plcStrTime$', align: 'center',title: '拣料时间'}
            ,{field: 'modiUser$', align: 'center',title: '修改人员', hide:true}
            ,{field: 'modiTime$', align: 'center',title: '修改时间', hide:true}
            ,{field: 'modiUser$', align: 'center',title: I18n.t('modifier'), hide:true}
            ,{field: 'modiTime$', align: 'center',title: I18n.t('modify_time'), hide:true}
            // ,{field: 'appeUser$', align: 'center',title: '创建者',event: 'appeUser', style: 'cursor:pointer'}
            // ,{field: 'appeTime$', align: 'center',title: '添加时间'}
            ,{field: 'barcode', align: 'center',title: '条码'}
            ,{field: 'barcode', align: 'center',title: I18n.t('barcode')}
            // ,{field: 'fullPlt', align: 'center',title: '满板', templet:function(row){
            //         var html = "<input value='fullPlt' type='checkbox' lay-skin='primary' lay-filter='tableCheckbox' table-index='"+row.LAY_TABLE_INDEX+"'";
            //         if(row.fullPlt === 'Y'){html += " checked ";}
@@ -67,39 +132,11 @@
            //         return html;
            //     }}
            ,{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
            }
        },
        response: {
            statusCode: 200
        },
        done: function(res, curr, count) {
            if (res.code === 403) {
                top.location.href = baseUrl+"/";
            }
            pageCurr=curr;
            limit();
            form.on('checkbox(tableCheckbox)', function (data) {
                var _index = $(data.elem).attr('table-index')||0;
                if(data.elem.checked){
                    res.data[_index][data.value] = 'Y';
                }else{
                    res.data[_index][data.value] = 'N';
                }
            });
        }
    });
            ,{fixed: 'right', title: I18n.t('operation'), align: 'center', width: 80, templet: function(d) {
                return '<a class="layui-btn layui-btn-xs btn-detlShow" lay-event="detlShow" data-i18n="detail">' + I18n.t('detail') + '</a>';
            }}
        ]];
    }
    // 监听排序事件
    table.on('sort(wrkMastLog)', function (obj) {
@@ -120,6 +157,10 @@
                }
                pageCurr=curr;
                limit();
                if (typeof I18n !== 'undefined') {
                    I18n.updatePage($('.layui-table-view'));
                    I18n.updateLayuiPagination();
                }
            }
        });
    });
@@ -131,7 +172,7 @@
            case 'addData':
                layer.open({
                    type: 2,
                    title: '新增',
                    title: I18n.t('add'),
                    maxmin: true,
                    area: [top.detailWidth, top.detailHeight],
                    shadeClose: false,
@@ -154,9 +195,9 @@
            case 'deleteData':
                var data = checkStatus.data;
                if (data.length === 0){
                    layer.msg('请选择数据');
                    layer.msg(I18n.t('please_select_data'));
                } else {
                    layer.confirm('确定删除'+(data.length===1?'此':data.length)+'条数据吗', function(){
                    layer.confirm(I18n.t('confirm_delete_prefix')+(data.length===1?I18n.t('this'):data.length)+I18n.t('confirm_delete_suffix'), function(){
                        $.ajax({
                            url: baseUrl+"/wrkMastLog/delete/auth",
                            headers: {'token': localStorage.getItem('token')},
@@ -178,7 +219,7 @@
                }
                break;
            case 'exportData':
                layer.confirm('确定导出Excel吗', {shadeClose: true}, function(){
                layer.confirm(I18n.t('confirm_export_excel'), {shadeClose: true}, function(){
                    var titles=[];
                    var fields=[];
                    obj.config.cols[0].map(function (col) {
@@ -231,7 +272,7 @@
                // 弹层显示
                layer.open({
                    type: 2,
                    title: '工作明细历史档',
                    title: I18n.t('work_order_detail_history'),
                    maxmin: true,
                    area: [top.detailWidth, top.detailHeight],
                    shadeClose: true,
@@ -244,7 +285,7 @@
            case 'detail':
                layer.open({
                    type: 2,
                    title: '详情',
                    title: I18n.t('detail'),
                    maxmin: true,
                    area: [top.detailWidth, top.detailHeight],
                    shadeClose: false,
@@ -474,6 +515,20 @@
                pageCurr -= 1;
            }
            limit(child);
            setTimeout(function() {
                if (typeof I18n !== 'undefined') {
                    if (child) {
                        // If reloading parent table from iframe
                        if (typeof parent.I18n !== 'undefined') {
                            parent.I18n.updatePage(parent.layui.jquery('.layui-table-view'));
                            parent.I18n.updateLayuiPagination();
                        }
                    } else {
                        I18n.updatePage($('.layui-table-view'));
                        I18n.updateLayuiPagination();
                    }
                }
            }, 50);
        }
    });
}