#
luxiaotao1123
2021-08-03 67da83c698e77ccf178669a31e4bd3a4e8fc1ca7
src/main/webapp/static/js/salesOrder/salsesOrder.js
@@ -1,21 +1,23 @@
var pageCurr;
var pageCurr = 1;
var limit = 16;
function getCol() {
    var cols = [];
    cols.push(
        {field: 'orderCode', align: 'center', title: '订单编号'}
        , {field: 'orderDate', align: 'center', title: '订单日期'}
        , {field: 'invCode', align: 'center', title: '物料编码'}
        , {field: 'invName', align: 'center', title: '物料名称'}
        , {field: 'invStd', align: 'center', title: '规格型号'}
        , {field: 'invUnit', align: 'center', title: '单位'}
        , {field: 'orderQty', align: 'center', title: '订单数量'}
        , {field: 'izMrp', align: 'center', title: '是否mrp计算', hide: true}
        , {field: 'productQty', align: 'center', title: '生产任务单数量'}
        , {field: 'izReceive', align: 'center', title: '是否收料', hide: true}
        , {field: 'inQty', align: 'center', title: '产成品入库数量'}
        , {field: 'outQty', align: 'center', title: '发货数量'}
        , {fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width: 80}
        {field: 'orderCode', align: 'center', title: '订单编号', width: 110}
        , {field: 'orderDate', align: 'center', title: '订单日期', width: 120}
        , {field: 'invCode', align: 'center', title: '物料编码', width: 130}
        , {field: 'invName', align: 'center', title: '物料名称', width: 350}
        , {field: 'invStd', align: 'center', title: '规格型号', width: 160}
        , {field: 'invUnit', align: 'center', title: '单位', width: 80, hide: true}
        , {field: 'orderQty', align: 'center', title: '订单数量', width: 120}
        , {field: 'izMrp', align: 'center', title: '大订单(mrp)',width: 115}
        , {field: 'productQty', align: 'center', title: '任务单', width: 110}
        , {field: 'izReceive', align: 'center', title: '小订单', width: 80}
        , {field: 'inQty', align: 'center', title: '入库数量', width: 110}
        , {field: 'disQty', align: 'center', title: '通知单', width: 110}
        , {field: 'outQty', align: 'center', title: '出库数量', width: 110}
    );
    return cols;
}
@@ -32,25 +34,11 @@
    tableIns = table.render({
        elem: '#salesOrder',
        headers: {token: localStorage.getItem('token')},
        // url: baseUrl+'/matCode/list/auth',
        data: [
            {
                "orderCode": 20210315000001,
                "orderDate": "2021-03-26 13:40",
                "invCode": "CPXXX00123",
                "invName": "兰博基尼授权儿童车",
                "invStd": "21×25",
                "invUnit": "辆",
                "orderQty": 300,
                "izMrp": "否",
                "productQty": 150,
                "izReceive": "是",
                "inQty": 50,
                "outQty": 0,
            }
        ],
        url: 'http://192.168.0.253:8073/api/report/getorderreport',
        height: 650,
        width: '100%',
        page: true,
        limit: 16,
        limit: limit,
        limits: [16, 50, 100, 200, 500],
        even: true,
        toolbar: '#toolbar',
@@ -71,11 +59,11 @@
        response: {
            statusCode: 200
        },
        done: function(res, curr, count) {
        done: function (res, curr, count) {
            if (res.code === 403) {
                top.location.href = baseUrl+"/";
                top.location.href = baseUrl + "/";
            }
            pageCurr=curr;
            pageCurr = curr;
        }
    });
@@ -83,6 +71,8 @@
    form.on('submit(reset)', function (data) {
        pageCurr = 1;
        clearFormVal($('#search-box'));
        debugger
        tableReload(false);
    });
@@ -96,7 +86,7 @@
    // 时间选择器
    layDate.render({
        elem: '.layui-laydate-range'
        , type: 'datetime'
        ,style: 'width: 150px'
        , range: true
    });
});
@@ -105,35 +95,41 @@
function tableReload(child) {
    var searchData = {};
    $.each($('#search-box [name]').serializeArray(), function () {
        searchData[this.name] = this.value;
        if (this.name == 'orderCode') {
            searchData.orderCode = this.value;
        }
        if (this.name == 'orderTime') {
            searchData.startTime = this.value.substring(0, 10);
            searchData.endTime = this.value.substring(13, this.value.length);
        }
    });
    console.log('搜索内容', searchData);
    console.log(searchData);
    // (child ? parent.tableIns : tableIns).reload({
    //     where: searchData,
    //     page: {
    //         curr: pageCurr
    //     },
    //     done: function (res, curr, count) {
    //         if (res.code === 403) {
    //             top.location.href = baseUrl + "/";
    //         }
    //         pageCurr = curr;
    //         if (res.data.length === 0 && count !== 0) {
    //             tableIns.reload({
    //                 where: searchData,
    //                 page: {
    //                     curr: pageCurr - 1
    //                 }
    //             });
    //             pageCurr -= 1;
    //         }
    //         limit(child);
    //         // 当前分页数据存储
    //         locNormalList = res.data;
    //     }
    // });
    (child ? parent.tableIns : tableIns).reload({
        where: searchData,
        page: {
            curr: pageCurr
        },
        done: function (res, curr, count) {
            if (res.code === 403) {
                top.location.href = baseUrl + "/";
            }
            pageCurr = curr;
            if (res.data.length === 0 && count !== 0) {
                tableIns.reload({
                    where: searchData,
                    page: {
                        curr: pageCurr - 1
                    }
                });
                pageCurr -= 1;
            }
            limit(child);
            // 当前分页数据存储
            locNormalList = res.data;
        }
    });
}
/* 监听回车事件 */