#
mrzhssss
2022-03-25 3f31d6aa87063f91fd3c2678d32638b3cb3000f6
src/main/webapp/static/js/pickout/pickout.js
@@ -41,6 +41,7 @@
            ,{field: 'userId', align: 'center',title: '用户ID', hide: true}
            ,{field: 'wrkSts$', align: 'center',title: '工作状态' ,templet: '#wrkStsTpl' , width: 100}
            ,{field: 'printTimes', align: 'center', title: '打印次数',width: 90}
            ,{field: 'zpallet', align: 'center',title: '条形码' , hide:true}
            ,{field: 'createTime$', align: 'center',title: '', hide:true}
            ,{field: 'createBy', align: 'center',title: '', hide:true}
@@ -57,6 +58,9 @@
    // 监听行工具事件
    table.on('tool(leftTable)', function(obj){
        var data = obj.data;
        switch (obj.event) {
            case 'printOrder':
                printPick(data);
@@ -64,6 +68,9 @@
            case "del":
                var ids = [data.id];
                del(ids);
                break;
            case "complete":
                donePickOut(data);
                break;
        }
    });
@@ -121,8 +128,73 @@
        tableReload(false);
    });
    function printPick(data){
    function donePickOut(data) {
        $.ajax({
            url:baseUrl + "/pickout/done/auth",
            headers : {'token' : localStorage.getItem('token')},
            data: JSON.stringify(data),
            contentType:'application/json;charset=UTF-8',
            method: 'POST',
            success: function (res) {
                leftTB.reload();
            }
        })
    }
    function printPick(data){
        $.ajax({
            url:baseUrl + "/work/pick/out/print",
            headers : {'token' : localStorage.getItem('token')},
            data: JSON.stringify(data),
            contentType:'application/json;charset=UTF-8',
            method: 'POST',
            success: function (res) {
                    if (res.code === 200){
                        console.log(res);
                        res.data["barcodeUrl"]=baseUrl+"/order/code/auth?type=1&param="+res.data.pickout.wrkNo;
                        var tpl = $('#pakoutPrintTpl').html();
                        var template = Handlebars.compile(tpl);
                        var html = template(res);
                        var box = $("#pakoutPrintBox");
                        box.html(html);box.show();
                        box.print({
                            mediaPrint:true,
                            deferred: $.Deferred().done(function () {
                                layer.confirm('[重要] 打印是否成功?',  {btn: ['Yes', 'No']}, function(){
                                    $.ajax({
                                        url: baseUrl+"/pickout/print/auth",
                                        headers: {'token': localStorage.getItem('token')},
                                        data: JSON.stringify(res.data.pickout),
                                        contentType:'application/json;charset=UTF-8',
                                        method: 'POST',
                                        success: function (res) {
                                            if (res.code === 200){
                                                layer.closeAll();
                                                $(".layui-laypage-btn")[0].click();
                                                layer.msg(res.msg, {icon: 1})
                                            } else if (res.code === 403){
                                                top.location.href = baseUrl+"/";
                                            } else {
                                                layer.msg(res.msg, {icon: 2})
                                            }
                                            leftTB.reload();
                                        }
                                    })
                                });
                            })
                        });
                        box.hide();
                    }
                    else if (res.code === 403){
                        top.location.href = baseUrl+"/";
                    }else {
                        layer.msg(res.msg, {icon: 2})
                    }
            }
        })
    }
@@ -158,7 +230,7 @@
            ,{field: 'price', align: 'center',title: '价格', hide:true}
            ,{field: 'weight', align: 'center',title: '重量', hide:true}
            ,{field: 'status', align: 'center',title: '状态' , hide:true}
            ,{field: 'pickStaff', align: 'center',title: '拣货员ID'}
            ,{field: 'pickStaff$', align: 'center',title: '拣货员ID'}
            ,{field: 'pickStart$', align: 'center',title: '拣货开始时间'}
            ,{field: 'pickEnd$', align: 'center',title: '拣货结束时间'}
            ,{field: 'createTime$', align: 'center',title: '创建时间', hide:true}