#
luxiaotao1123
2020-06-23 1934fe348a93da3bd79f07a3b20b23b9db72c612
src/main/webapp/static/js/pakStore/emptyOut.js
@@ -6,25 +6,28 @@
    var layDate = layui.laydate;
    var form = layui.form;
    // 获取可用入库站点
    $.ajax({
        url: baseUrl+"/available/take/site",
        headers: {'token': localStorage.getItem('token')},
        method: 'POST',
        success: function (res) {
            if (res.code === 200){
                var tpl = $("#takeSiteSelectTemplate").html();
                var template = Handlebars.compile(tpl);
                var html = template(res);
                $('#staNoSelect').append(html);
                form.render('select');
            } else if (res.code === 403){
                top.location.href = baseUrl+"/";
            }else {
                layer.msg(res.msg)
    // 获取出库口
    function getOutBound(){
        $.ajax({
            url: baseUrl+"/available/empty/take/site",
            headers: {'token': localStorage.getItem('token')},
            method: 'POST',
            async: false,
            success: function (res) {
                if (res.code === 200){
                    var tpl = $("#takeSiteSelectTemplate").html();
                    var template = Handlebars.compile(tpl);
                    var html = template(res);
                    $('#staNoSelect').append(html);
                    form.render('select');
                } else if (res.code === 403){
                    top.location.href = baseUrl+"/";
                }else {
                    layer.msg(res.msg)
                }
            }
        }
    })
        })
    }
    // 数据渲染
    tableIns = table.render({
@@ -33,6 +36,8 @@
        url: baseUrl+'/locMast/list/auth',
        page: true,
        limit: 16,
        limits: [16, 30, 50, 100, 200, 500],
        where: {loc_type: "D"},
        even: true,
        toolbar: '#toolbar',
        defaultToolbar: ['filter'],
@@ -45,7 +50,7 @@
            ,{field: 'crnNo', align: 'center',title: '堆垛机号'}
            ,{field: 'row1', align: 'center',title: '排'}
            ,{field: 'bay1', align: 'center',title: '列'}
            ,{field: 'lev1', align: 'center',title: '层', sort:true}
            ,{field: 'lev1', align: 'center',title: '层'}
            ,{field: 'fullPlt', align: 'center',title: '满板', templet:function(row){
                    var html = "<input value='fullPlt' type='checkbox' disabled=‘disabled’ lay-skin='primary' lay-filter='tableCheckbox' table-index='"+row.LAY_TABLE_INDEX+"'";
                    if(row.fullPlt === 'Y'){html += " checked ";}
@@ -54,7 +59,6 @@
                },width:80}
            ,{field: 'modiUser$', align: 'center',title: '修改人员',event: 'modiUser'}
            ,{field: 'modiTime$', align: 'center',title: '修改时间'}
        ]],
        request: {
            pageName: 'curr',
@@ -76,6 +80,7 @@
                top.location.href = baseUrl+"/";
            }
            pageCurr=curr;
            getOutBound();
            limit();
            form.on('checkbox(tableCheckbox)', function (data) {
                var _index = $(data.elem).attr('table-index')||0;
@@ -90,12 +95,42 @@
    // 监听头工具栏事件
    table.on('toolbar(locMast)', function (obj) {
        var checkStatus = table.checkStatus(obj.config.id);
        var data = table.checkStatus(obj.config.id).data;
        switch (obj.event) {
            case 'outbound':
                var staNo = $("#staNoSelect").val();
                if (staNo === ""){
                if (staNo === "" || staNo === null){
                    layer.msg("请选择出库口");
                    return;
                }
                var locNos = [];
                data.forEach(function(elem) {
                    locNos.push(elem.locNo);
                });
                if (data.length === 0){
                    layer.msg('请至少选中一行数据');
                } else {
                    $.ajax({
                        url: baseUrl+"/empty/plate/out/start",
                        headers: {'token': localStorage.getItem('token')},
                        data: {
                            outSite: staNo,
                            locNos: locNos
                        },
                        method: 'POST',
                        traditional:true,
                        success: function (res) {
                            if (res.code === 200){
                                tableReload(); // 重载表格
                                getOutBound(); // 重载出库口
                                layer.msg(res.msg);
                            } else if (res.code === 403){
                                top.location.href = baseUrl+"/";
                            } else {
                                layer.msg(res.msg)
                            }
                        }
                    });
                }
                break;
        }
@@ -106,6 +141,7 @@
        pageCurr = 1;
        $('#detlTable').css("display", 'none');
        tableReload(false);
        getOutBound();
    });
    // 搜索栏重置事件
@@ -114,6 +150,7 @@
        clearFormVal($('#search-box'));
        $('#detlTable').css("display", 'none');
        tableReload(false);
        getOutBound();
    });
})
@@ -146,5 +183,3 @@
        }
    });
}