自动化立体仓库 - WMS系统
lty
3 天以前 d907a822a940c7ec0fb7de0ca845472bda52229b
src/main/webapp/static/js/waitPakinLog/waitPakinLog.js
@@ -1,4 +1,79 @@
var pageCurr;
function getCol() {
    var cols = [
    ];
    cols.push.apply(cols, typeof getDetlCols === 'function' ? getDetlCols() : detlCols);
    cols.push({field: 'status', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('data_status') : '数据状态', templet:function(row){
                var normal = typeof I18n !== 'undefined' ? I18n.t('normal') : '正常';
                var locked = typeof I18n !== 'undefined' ? I18n.t('locked') : '锁定';
                var html = "<input value='status' type='checkbox' lay-skin='switch' lay-text='"+normal+"|"+locked+"' lay-filter='tableCheckbox' disabled='disabled' table-index='"+row.LAY_TABLE_INDEX+"'";
                if(row.status === 'Y'){html += " checked ";}
                html += ">";
                return html;
            }}
        ,{field: 'ioStatus', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('io_status') : '入出状态', templet:function(row){
                var running = typeof I18n !== 'undefined' ? I18n.t('running') : '运行中';
                var pending = typeof I18n !== 'undefined' ? I18n.t('pending') : '待处理';
                var html = "<input value='ioStatus' type='checkbox' lay-skin='switch' lay-text='"+running+"|"+pending+"' 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: 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() !== '') {
                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.use(['table','laydate', 'form'], function(){
    var table = layui.table;
    var $ = layui.jquery;
@@ -17,25 +92,7 @@
        even: true,
        toolbar: '#toolbar',
        cellMinWidth: 50,
        cols: [[
            // {type: 'checkbox'}
//            ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80}
//             ,{field: 'id', align: 'center',title: '编号'}
            {field: 'pakinId', align: 'center',title: '入库通知号'}
            ,{field: 'barcode', align: 'center',title: '托盘码'}
            ,{field: 'matnr', align: 'center',title: '物料编码'}
            ,{field: 'maktx', align: 'center',title: '物料描述'}
            ,{field: 'anfme', align: 'center',title: '数量'}
            ,{field: 'unit', align: 'center',title: '单位'}
            ,{field: 'status', align: 'center',title: '状态'}
            ,{field: 'memo', align: 'center',title: '备注',hide:true}
            ,{field: 'modiTime$', align: 'center',title: '修改时间',hide:true}
            ,{field: 'modiUser$', align: 'center',title: '修改人员',hide:true}
            // ,{field: 'appeTime$', align: 'center',title: '添加时间'}
            // ,{field: 'appeUser$', align: 'center',title: '创建者',event: 'appeUser', style: 'cursor:pointer'}
            // ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:150}
        ]],
        cols: [getCol()],
        request: {
            pageName: 'curr',
            pageSize: 'limit'
@@ -54,6 +111,10 @@
        done: function(res, curr, count) {
            if (res.code === 403) {
                top.location.href = baseUrl+"/";
            }
            if (typeof I18n !== 'undefined') {
                I18n.updatePage($('.layui-table-view'));
                updatePagination();
            }
            pageCurr=curr;
            limit();
@@ -85,6 +146,10 @@
                if (res.code === 403) {
                    top.location.href = baseUrl+"/";
                }
                if (typeof I18n !== 'undefined') {
                    I18n.updatePage($('.layui-table-view'));
                    updatePagination();
                }
                pageCurr=curr;
                limit();
            }
@@ -98,7 +163,7 @@
            case 'addData':
                layer.open({
                    type: 2,
                    title: '新增',
                    title: typeof I18n !== 'undefined' ? I18n.t('add') : '新增',
                    maxmin: true,
                    area: [top.detailWidth, top.detailHeight],
                    content: 'waitPakinLog_detail.html',
@@ -112,9 +177,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+"/waitPakinLog/delete/auth",
                            headers: {'token': localStorage.getItem('token')},
@@ -128,7 +200,7 @@
                                } else if (res.code === 403){
                                    top.location.href = baseUrl+"/";
                                } else {
                                    layer.msg(res.msg)
                                    layer.msg(typeof I18n !== 'undefined' ? I18n.t(res.msg) : res.msg, {icon: 2})
                                }
                            }
                        })
@@ -136,7 +208,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) {
@@ -167,7 +243,7 @@
                            } else if (res.code === 403) {
                                top.location.href = baseUrl+"/";
                            } else {
                                layer.msg(res.msg)
                                layer.msg(typeof I18n !== 'undefined' ? I18n.t(res.msg) : res.msg, {icon: 2})
                            }
                        }
                    });
@@ -184,7 +260,7 @@
            case 'detail':
                layer.open({
                    type: 2,
                    title: '详情',
                    title: typeof I18n !== 'undefined' ? I18n.t('detail') : '详情',
                    maxmin: true,
                    area: [top.detailWidth, top.detailHeight],
                    shadeClose: true,
@@ -203,7 +279,7 @@
            case 'edit':
                layer.open({
                    type: 2,
                    title: '修改',
                    title: typeof I18n !== 'undefined' ? I18n.t('edit') : '修改',
                    maxmin: true,
                    area: [top.detailWidth, top.detailHeight],
                    content: 'waitPakinLog_detail.html',
@@ -221,11 +297,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({
                    layer.open({
                       type: 2,
                       title: '修改人员详情',
                       title: typeof I18n !== 'undefined' ? I18n.t('modifier_detail') : '修改人员详情',
                       maxmin: true,
                       area: [top.detailWidth, top.detailHeight],
                       shadeClose: true,
@@ -246,7 +322,7 @@
                                   } else if (res.code === 403){
                                       top.location.href = baseUrl+"/";
                                   }else {
                                       layer.msg(res.msg)
                                       layer.msg(typeof I18n !== 'undefined' ? I18n.t(res.msg) : res.msg, {icon: 2})
                                   }
                               }
                           })
@@ -257,11 +333,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({
                    layer.open({
                       type: 2,
                       title: '创建者详情',
                       title: typeof I18n !== 'undefined' ? I18n.t('creator_detail') : '创建者详情',
                       maxmin: true,
                       area: [top.detailWidth, top.detailHeight],
                       shadeClose: true,
@@ -282,7 +358,7 @@
                                   } else if (res.code === 403){
                                       top.location.href = baseUrl+"/";
                                   }else {
                                       layer.msg(res.msg)
                                       layer.msg(typeof I18n !== 'undefined' ? I18n.t(res.msg) : res.msg, {icon: 2})
                                   }
                               }
                           })
@@ -344,7 +420,7 @@
                } else if (res.code === 403){
                    top.location.href = baseUrl+"/";
                }else {
                    layer.msg(res.msg)
                    layer.msg(typeof I18n !== 'undefined' ? I18n.t(res.msg) : res.msg, {icon: 2})
                }
                layer.close(index);
            }
@@ -383,10 +459,45 @@
        elem: '#appeTime\\$',
        type: 'datetime'
    });
    // Initial render
    var lang = (typeof I18n !== 'undefined' && I18n.getLanguage().indexOf('en') > -1) ? 'en' : 'cn';
    layDate.render({
        elem: '.layui-laydate-range'
        ,type: 'datetime'
        ,range: true
        ,lang: lang
    });
    // Add i18n listener
    $(document).on('i18n:languageChanged', function() {
        I18n.updatePage($('#search-box'));
        var lang = (typeof I18n !== 'undefined' && I18n.getLanguage().indexOf('en') > -1) ? 'en' : 'cn';
        // Re-render date picker with new language
        $('.layui-laydate-range').each(function() {
            var $this = $(this);
            var val = $this.val();
            var $newElem = $this.clone();
            $newElem.removeAttr('lay-key');
            $newElem.val(val);
            $this.replaceWith($newElem);
            layDate.render({
                elem: $newElem[0]
                ,type: 'datetime'
                ,range: true
                ,lang: lang
            });
        });
        table.reload('waitPakinLog', {
            cols: [getCol()],
            done: function() {
                if (typeof I18n !== 'undefined') {
                    I18n.updatePage($('.layui-table-view'));
                    updatePagination();
                }
            }
        });
    });
});
@@ -410,6 +521,10 @@
            if (res.code === 403) {
                top.location.href = baseUrl+"/";
            }
            if (typeof I18n !== 'undefined') {
                I18n.updatePage($('.layui-table-view'));
                updatePagination();
            }
            pageCurr=curr;
            if (res.data.length === 0 && count !== 0) {
                tableIns.reload({