#
luxiaotao1123
2021-05-27 0c639381be63fa0df712015d141f12e4473b23f9
src/main/webapp/static/js/order/order.js
@@ -59,13 +59,20 @@
        if (obj.event === 'add') { // 添加
            showEditModel();
        } else if (obj.event === 'edit') { // 修改
            showEditModel(selObj.data, selObj);
            if (selObj == null) {
                return;
            }
            showEditModel(selObj.data);
        } else if (obj.event === 'del') { // 删除
            if (selObj == null) {
                return;
            }
            doDel(selObj);
        }
    });
    /* 监听行单击事件 */
    var selObj;
    table.on('row(docTypeTable)', function (obj) {
        selObj = obj;
        obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click');
@@ -73,7 +80,7 @@
    });
    /* 显示表单弹窗 */
    function showEditModel(mData, obj) {
    function showEditModel(mData) {
        admin.open({
            type: 1,
            title: (mData ? '修改' : '添加') + '单据类型',
@@ -91,13 +98,14 @@
                        method: 'POST',
                        success: function (res) {
                            layer.close(loadIndex);
                            selObj = null;
                            if (res.code === 200){
                                layer.close(dIndex);
                                layer.msg(res.msg, {icon: 1});
                                insTb.reload();
                            } else if (res.code === 403){
                                top.location.href = baseUrl+"/";
                            }else {
                            } else {
                                layer.msg(res.msg, {icon: 2});
                            }
                        }
@@ -122,6 +130,7 @@
                data: {param: JSON.stringify(obj.data)},
                method: 'POST',
                success: function (res) {
                    selObj = null;
                    layer.close(loadIndex);
                    if (res.code === 200){
                        layer.closeAll();
@@ -153,17 +162,17 @@
        cols: [[
            {type: 'checkbox'}
            // ,{field: 'uuid', align: 'center',title: '编号'}
            ,{field: 'orderNo', align: 'center',title: '订单编号'}
            ,{field: 'orderTime', align: 'center',title: '单据日期'}
            ,{field: 'docType$', align: 'center',title: '单据类型'}
            ,{field: 'itemName', align: 'center',title: '项目'}
            ,{field: 'docType$', align: 'center',title: '类别', templet: '#docTypeTpl', width: 100}
            ,{field: 'orderNo', align: 'center',title: '单据编号', minWidth: 250}
            ,{field: 'orderTime', align: 'center',title: '单据日期', width: 120}
            ,{field: 'itemName', align: 'center',title: '项目', hide: true}
            ,{field: 'allotItemId$', align: 'center',title: '调拨项目编号', hide: true}
            ,{field: 'defNumber', align: 'center',title: '初始票据号', hide: true}
            ,{field: 'number', align: 'center',title: '票据号'}
            ,{field: 'cstmrName', align: 'center',title: '客户', hide: true}
            ,{field: 'number', align: 'center',title: '票据号', hide: true}
            ,{field: 'cstmrName', align: 'center',title: '客户'}
            ,{field: 'tel', align: 'center',title: '联系方式', hide: true}
            ,{field: 'operMemb', align: 'center',title: '操作人员'}
            ,{field: 'totalFee', align: 'center',title: '合计金额'}
            ,{field: 'operMemb', align: 'center',title: '操作人员', hide: true}
            ,{field: 'totalFee', align: 'center',title: '合计金额', hide: true}
            ,{field: 'discount', align: 'center',title: '优惠率', hide: true}
            ,{field: 'discountFee', align: 'center',title: '优惠金额', hide: true}
            ,{field: 'otherFee', align: 'center',title: '销售或采购费用合计', hide: true}
@@ -211,8 +220,25 @@
    });
    /* 表格2重置 */
    form.on('submit(orderTbReset)', function (data) {
        insTb2.reload({page: {curr: 1}});
        insTb2.reload({where: null,page: {curr: 1}});
        return false;
    });
    /* 表格2头工具栏点击事件 */
    table.on('toolbar(orderTable)', function (obj) {
        if (obj.event === 'add') { // 添加
            right();
        } else if (obj.event === 'del') { // 删除
            var checkRows = table.checkStatus('orderTable');
            if (checkRows.data.length === 0) {
                layer.msg('请选择要删除的数据', {icon: 2});
                return;
            }
            var ids = checkRows.data.map(function (d) {
                return d.id;
            });
            doDelOrder({ids: ids});
        }
    });
    /* 表格2工具条点击事件 */
@@ -232,7 +258,6 @@
                    method: 'POST',
                    success: function (res) {
                        layer.close(loadIndex);
                        // 成功
                        if (res.code === 200){
                            layer.open({
                                type: 1
@@ -289,14 +314,10 @@
                break;
            // 打印
            case 'print':
                layer.confirm('开始打印' +data.number + ' 拣货单?', {shadeClose: true}, function(){
                layer.confirm('开始打印' +data.orderNo + ' 拣货单?', {shadeClose: true}, function(){
                    layer.closeAll();
                    printPakouts(data.orderNo);
                })
                break;
            // 修改
            case 'edit':
                showEditModel2(obj.data);
                break;
            // 删除
            case 'del':
@@ -306,53 +327,6 @@
        }
    });
    /* 表格2头工具栏点击事件 */
    table.on('toolbar(orderTable)', function (obj) {
        if (obj.event === 'add') { // 添加
            // showEditModel2();
            right();
        } else if (obj.event === 'del') { // 删除
            var checkRows = table.checkStatus('orderTable');
            if (checkRows.data.length === 0) {
                layer.msg('请选择要删除的数据', {icon: 2});
                return;
            }
            var ids = checkRows.data.map(function (d) {
                return d.id;
            });
            doDelOrder({ids: ids});
        }
    });
    /* 显示表单弹窗2 */
    function showEditModel2(mData) {
        admin.open({
            type: 1,
            title: (mData ? '修改' : '添加') + '数据字典项',
            content: $('#dictDataEditDialog').html(),
            success: function (layero, dIndex) {
                // 回显表单数据
                form.val('dictDataEditForm', mData);
                // 表单提交事件
                form.on('submit(dictDataEditSubmit)', function (data) {
                    data.field.dictId = selObj.data.dictId;
                    var loadIndex = layer.load(2);
                    $.get(mData ? '../../json/ok.json' : '../../json/ok.json', data.field, function (res) {
                        layer.close(loadIndex);
                        if (200 === res.code) {
                            layer.close(dIndex);
                            layer.msg(res.msg, {icon: 1});
                            insTb2.reload({page: {curr: 1}});
                        } else {
                            layer.msg(res.msg, {icon: 2});
                        }
                    }, 'json');
                    return false;
                });
            }
        });
    }
    /* 删除订单 */
    function doDelOrder(obj) {
@@ -383,10 +357,8 @@
        });
    }
    // 生成拣货单
    function stockOut(orderNo) {
        // layer.confirm(number + ' 订单开始拣货?', {shadeClose: true}, function(){
        layer.closeAll();
        $.ajax({
            url: baseUrl+"/work/stock/out/create",
@@ -405,19 +377,6 @@
                        }, function() {
                            layer.closeAll();
                            printPakouts(orderNo);
                        }
                    )
                    // 缺料
                } else if (res.code === 20001) {
                    layer.confirm(res.msg, {
                            shadeClose: true
                            , btn: ['库存调拨', '取消']
                        }, function() {
                            // 库存调拨
                            layer.closeAll();
                        }, function() {
                            alert(number)
                            layer.closeAll();
                        }
                    )
                } else if (res.code === 403){
@@ -485,10 +444,6 @@
        })
    }
//     // 搜索栏搜索事件
//     form.on('submit(search)', function (data) {
//         pageCurr = 1;
@@ -539,11 +494,6 @@
        }
    });
}
// 关闭动作
$(document).on('click','#data-detail-close', function () {
    parent.layer.closeAll();
});
function tableReload(child) {
    var searchData = {};