#
luxiaotao1123
2021-04-13 cf943cb90fde999773267cbc14bf51a70881481a
src/main/webapp/static/js/order/order.js
@@ -39,7 +39,7 @@
            '</p>'].join(''),
        defaultToolbar: [],
        cols: [[
            {field: 'docId', title: '编号', width: 80, align: 'center'},
            {field: 'docId', title: '编号', width: 70, align: 'center'},
            {field: 'docName', title: '单据类型'}
        ]],
        done: function (res, curr, count) {
@@ -48,8 +48,8 @@
    });
    /* 表格搜索 */
    form.on('submit(docTypeTable)', function (data) {
        insTb.reload({where: data.field});
    form.on('submit(docTypeTableSearch)', function (data) {
        insTb.reload({where: {doc_name: data.field.docName}});
        return false;
    });
@@ -75,28 +75,32 @@
    function showEditModel(mData, obj) {
        admin.open({
            type: 1,
            title: (mData ? '修改' : '添加') + '字典',
            content: $('#dictEditDialog').html(),
            title: (mData ? '修改' : '添加') + '单据类型',
            content: $('#docTypeEditDialog').html(),
            success: function (layero, dIndex) {
                // 回显表单数据
                form.val('dictEditForm', mData);
                form.val('docTypeEditForm', mData);
                // 表单提交事件
                form.on('submit(dictEditSubmit)', function (data) {
                form.on('submit(docTypeEditSubmit)', function (data) {
                    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});
                            if (obj) {
                                obj.update(data.field);
                            } else {
                    $.ajax({
                        url: baseUrl+"/docType/"+(mData?'update':'add')+"/auth",
                        headers: {'token': localStorage.getItem('token')},
                        data: data.field,
                        method: 'POST',
                        success: function (res) {
                            layer.close(loadIndex);
                            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 {
                                layer.msg(res.msg, {icon: 2});
                            }
                        } else {
                            layer.msg(res.msg, {icon: 2});
                        }
                    }, 'json');
                    })
                    return false;
                });
            }
@@ -105,30 +109,35 @@
    /* 删除 */
    function doDel(obj) {
        layer.confirm('确定要删除此字典吗?', {
        layer.confirm('确定要删除此单据类型吗?', {
            skin: 'layui-layer-admin',
            shade: .1
        }, function (i) {
            layer.close(i);
            var loadIndex = layer.load(2);
            $.get('../../json/ok.json', {
                id: obj.data.dictId,
            }, function (res) {
                layer.close(loadIndex);
                if (200 === res.code) {
                    layer.msg(res.msg, {icon: 1});
                    obj.del();
                    $('#dictTable+.layui-table-view .layui-table-body tbody>tr:first').trigger('click');
                } else {
                    layer.msg(res.msg, {icon: 2});
            $.ajax({
                url: baseUrl+"/docType/delete/one/auth",
                headers: {'token': localStorage.getItem('token')},
                data: {param: JSON.stringify(obj.data)},
                method: 'POST',
                success: function (res) {
                    layer.close(loadIndex);
                    if (res.code === 200){
                        layer.closeAll();
                        insTb.reload();
                        $('#dictTable+.layui-table-view .layui-table-body tbody>tr:first').trigger('click');
                    } else if (res.code === 403){
                        top.location.href = baseUrl+"/";
                    } else {
                        layer.msg(res.msg, {icon: 2});
                    }
                }
            }, 'json');
            })
        });
    }
    /****************************************** 右边表 *************************************************/
    /* 渲染表格2 */
    var insTb2 = table.render({
@@ -138,7 +147,7 @@
        page: true,
        limit: 16,
        limits: [16, 30, 50, 100, 200, 500],
        toolbar: '#toolbar',
        toolbar: '#orderToolbar',
        height: 'full-100',
        cols: [[
            {type: 'checkbox'}
@@ -147,7 +156,7 @@
            ,{field: 'orderNo', align: 'center',title: '订单编号'}
            ,{field: 'orderTime', align: 'center',title: '单据日期'}
            ,{field: 'docType$', align: 'center',title: '单据类型'}
            ,{field: 'itemId$', align: 'center',title: '项目编号'}
            ,{field: 'itemName', align: 'center',title: '项目'}
            ,{field: 'allotItemId$', align: 'center',title: '调拨项目编号', hide: true}
            ,{field: 'defNumber', align: 'center',title: '初始票据号', hide: true}
            ,{field: 'number', align: 'center',title: '票据号'}
@@ -176,7 +185,6 @@
            // ,{field: 'updateBy$', align: 'center',title: '修改人员',event: 'updateBy', style: 'cursor:pointer'}
            // ,{field: 'updateTime$', align: 'center',title: '修改时间'}
            // ,{field: 'memo', align: 'center',title: '备注'}
            ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:150}
        ]],
        request: {
@@ -194,6 +202,7 @@
        response: {
            statusCode: 200
        },
        size: 'lg',
        done: function(res, curr, count) {
            if (res.code === 403) {
                top.location.href = baseUrl+"/";
@@ -211,8 +220,13 @@
        }
    });
    /* 表格2搜索 */
    form.on('submit(orderTable)', function (data) {
    form.on('submit(orderTbSearch)', function (data) {
        insTb2.reload({where: data.field, page: {curr: 1}});
        return false;
    });
    /* 表格2重置 */
    form.on('submit(orderTbReset)', function (data) {
        insTb2.reload({page: {curr: 1}});
        return false;
    });
@@ -221,24 +235,27 @@
        if (obj.event === 'edit') { // 修改
            showEditModel2(obj.data);
        } else if (obj.event === 'del') { // 删除
            doDel2(obj);
            var ids = [];
            ids.push(obj.id)
            doDelOrder({ids: ids});
        }
    });
    /* 表格2头工具栏点击事件 */
    table.on('toolbar(orderTable)', function (obj) {
        if (obj.event === 'add') { // 添加
            showEditModel2();
            // showEditModel2();
            right();
        } else if (obj.event === 'del') { // 删除
            var checkRows = table.checkStatus('dictDataTable');
            var checkRows = table.checkStatus('orderTable');
            if (checkRows.data.length === 0) {
                layer.msg('请选择要删除的数据', {icon: 2});
                return;
            }
            var ids = checkRows.data.map(function (d) {
                return d.dictDataId;
                return d.id;
            });
            doDel2({ids: ids});
            doDelOrder({ids: ids});
        }
    });
@@ -271,26 +288,32 @@
        });
    }
    /* 删除2 */
    function doDel2(obj) {
    /* 删除订单 */
    function doDelOrder(obj) {
        layer.confirm('确定要删除选中数据吗?', {
            skin: 'layui-layer-admin',
            shade: .1
        }, function (i) {
            layer.close(i);
            var loadIndex = layer.load(2);
            $.get('../../json/ok.json', {
                id: obj.data ? obj.data.dictDataId : '',
                ids: obj.ids ? obj.ids.join(',') : ''
            }, function (res) {
                layer.close(loadIndex);
                if (200 === res.code) {
                    layer.msg(res.msg, {icon: 1});
                    insTb2.reload({page: {curr: 1}});
                } else {
                    layer.msg(res.msg, {icon: 2});
            $.ajax({
                url: baseUrl+"/orders/delete/auth",
                headers: {'token': localStorage.getItem('token')},
                data: {ids: obj.ids},
                method: 'POST',
                success: function (res) {
                    layer.close(loadIndex);
                    if (res.code === 200){
                        layer.msg(res.msg, {icon: 1});
                        $(".layui-laypage-btn")[0].click();
                    } else if (res.code === 403){
                        top.location.href = baseUrl+"/";
                    }else {
                        layer.msg(res.msg, {icon: 2});
                    }
                }
            }, 'json');
            })
        });
    }
@@ -309,88 +332,6 @@
//     // 数据渲染
//     tableIns = table.render({
//         elem: '#order',
//         headers: {token: localStorage.getItem('token')},
//         url: baseUrl+'/order/list/auth',
//         page: true,
//         limit: 16,
//         limits: [16, 30, 50, 100, 200, 500],
//         even: true,
//         toolbar: '#toolbar',
//         cellMinWidth: 50,
//         cols: [[
//             {type: 'checkbox'}
//             // ,{field: 'id', align: 'center',title: 'ID'}
//             // ,{field: 'uuid', align: 'center',title: '编号'}
//             ,{field: 'orderNo', align: 'center',title: '订单编号'}
//             ,{field: 'orderTime', align: 'center',title: '单据日期'}
//             ,{field: 'docType$', align: 'center',title: '单据类型'}
//             ,{field: 'itemId$', align: 'center',title: '项目编号'}
//             ,{field: 'allotItemId$', align: 'center',title: '调拨项目编号', hide: true}
//             ,{field: 'defNumber', align: 'center',title: '初始票据号', hide: true}
//             ,{field: 'number', align: 'center',title: '票据号'}
//             // ,{field: 'cstmr$', align: 'center',title: '客户编号'}
//             ,{field: 'cstmrName', align: 'center',title: '客户', hide: true}
//             ,{field: 'tel', align: 'center',title: '联系方式', hide: true}
//             ,{field: 'operMemb', align: 'center',title: '操作人员'}
//             ,{field: 'totalFee', align: 'center',title: '合计金额'}
//             ,{field: 'discount', align: 'center',title: '优惠率', hide: true}
//             ,{field: 'discountFee', align: 'center',title: '优惠金额', hide: true}
//             ,{field: 'otherFee', align: 'center',title: '销售或采购费用合计', hide: true}
//             ,{field: 'actFee', align: 'center',title: '实付金额', hide: true}
//             ,{field: 'payType$', align: 'center',title: '付款类型'}
//             ,{field: 'salesman', align: 'center',title: '业务员', hide: true}
//             ,{field: 'accountDay', align: 'center',title: '结算天数', hide: true}
//             ,{field: 'postFeeType$', align: 'center',title: '邮费支付类型', hide: true}
//             ,{field: 'postFee', align: 'center',title: '邮费', hide: true}
//             ,{field: 'payTime$', align: 'center',title: '付款时间', hide: true}
//             ,{field: 'sendTime$', align: 'center',title: '发货时间', hide: true}
//             ,{field: 'shipName', align: 'center',title: '物流名称', hide: true}
//             ,{field: 'shipCode', align: 'center',title: '物流单号', hide: true}
//             ,{field: 'settle$', align: 'center',title: '订单状态'}
//             // ,{field: 'status$', align: 'center',title: '状态'}
//             // ,{field: 'createBy$', align: 'center',title: '添加人员',event: 'createBy', style: 'cursor:pointer'}
//             // ,{field: 'createTime$', align: 'center',title: '添加时间'}
//             // ,{field: 'updateBy$', align: 'center',title: '修改人员',event: 'updateBy', style: 'cursor:pointer'}
//             // ,{field: 'updateTime$', align: 'center',title: '修改时间'}
//             // ,{field: 'memo', align: 'center',title: '备注'}
//
//             ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:150}
//         ]],
//         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';
//                 }
//             });
//         }
//     });
//
//     // 监听排序事件
//     table.on('sort(locMast)', function (obj) {
//         var searchData = {};
@@ -668,6 +609,23 @@
});
function right(){
    top.popupRight = top.layui.admin.popupRight({
        id: 'LAY_adminPopupLayerTest'
        , area: '750px'
        , type: 2
        , shade: [0.5,'#000']
        , content:'order/matQuery.html'
        , success: function(){
            // $('#'+ this.id).html('<div style="padding: 20px;">放入内容</div>');
            //admin.view(this.id).render('system/xxx')
        }
        , end: function () {
            $(".layui-laypage-btn")[0].click();
        }
    });
}
// 关闭动作
$(document).on('click','#data-detail-close', function () {
    parent.layer.closeAll();