自动化立体仓库 - WMS系统
pang.jiabao
2024-02-28 a8ab542c3f3bbb304f6fd7e66897433df65a2b3e
src/main/webapp/static/js/cool.js
@@ -26,12 +26,24 @@
    }
}
function test() {
}
/**
 * 搜索自动补全 -- input
 */
function autoLoad(val) {
    var inputDomVal = document.querySelector("input[data-key="+val+"]").value;
    var selectDom = document.querySelector("select[data-key="+val+"Select]");
    var type = document.querySelector("input[data-key="+val+"]").getAttribute('data-value');
    if(type){
        inputDomVal = inputDomVal + "," + type;
    }
    if(getForeignKeyQuery(val) === 'orderDetlQuery'){
        inputDomVal = inputDomVal + "," + $('#orderNo').val();
    }
    //debugger;
    selectDom.length = 0;
    var defaultOption = new Option("取消选择", "");
    defaultOption.title = "";
@@ -49,11 +61,17 @@
                for (var i=0;i<list.length;i++){
                    var option = new Option(list[i].value, i);
                    option.title = list[i].id;
                    option.addr = list[i].addr;
                    option.phone = list[i].phone;
                    option.customer = list[i].customer;
                    option.allocate = list[i].allocate;
                    option.weight =  list[i].weight;
                    option.type = list[i].type;
                    selectDom.options[i+1] = option;
                }
                selectDom.style.display='block';
            } else if (res.code === 403){
                top.location.href = baseUrl;
                top.location.href = baseUrl+"/";
            } else {
                layer.msg(res.msg)
            }
@@ -87,8 +105,89 @@
    } else {
        cacd.val(selectOptionDom.html());
        realDom.val(selectOptionDom.attr("title"));
        if(selectOptionDom[0].type === "docType"){
            $('#weight').val("");
            $('#maktxV').val("");
        }
        if(selectOptionDom[0].type === "order" || selectOptionDom[0].type === "locOwner"){
            $('#allocate').val(selectOptionDom[0].allocate ? selectOptionDom[0].allocate : "");
            $('#customer').val(selectOptionDom[0].customer ? selectOptionDom[0].customer : "");
            $('#phone').val(selectOptionDom[0].phone ? selectOptionDom[0].phone : "");
            $('#addr').val(selectOptionDom[0].addr ? selectOptionDom[0].addr : "");
        }
        if(selectOptionDom[0].type === "returned"){
            $('#customer').val(selectOptionDom[0].customer ? selectOptionDom[0].customer : "");
            tableReload();
        }
        if(selectOptionDom[0].type === "orderDetl"){
            $('#weight').val(selectOptionDom[0].weight);
        }
    }
    inputDom.val("");
}
function tableReload(){
    layui.use(['table','laydate', 'form'], function(){
        var form = layui.form;
        var layer = layui.layer;
        var table = layui.table;
        var orderNo = $('#orderNoV').val();
        table.render({
            elem: '#formSSXMTable',
            height: 312,
            headers: {token: localStorage.getItem('token')},
            url: baseUrl+'/plaQty/orderDetail/auth',
            where: {
                orderNo: orderNo
            },
            page: true,
            limit: 16,
            limits: [16, 30, 50, 100, 200, 500],
            cols: [[
                {type: 'checkbox'},
                {field: 'id', title: 'id', hide:true},
                {field: 'batch', title: '批号'},
                {field: 'packageNo', title: '包号'},
                {field: 'orderWeight', title: '重量',edit:true}
            ]],
            request: {
                pageName: 'curr',
                pageSize: 'limit'
            },
            parseData: function (res) {
                console.log(res)
                return {
                    'code': res.code,
                    'msg': res.msg,
                    'count': res.data.total,
                    'data': res.data
                }
            },
            response: {
                statusCode: 200
            },
            done: function(res, curr, count) {
                if (res.code === 403) {
                    top.location.href = baseUrl+"/";
                }
                tableData = table.cache.locDetl;
                console.log(tableData);
                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';
                    }
                });
            }
        });
    })
}
function reviewImg(src) {
@@ -104,6 +203,14 @@
        return str.substring(0, index);
    }
    return str;
}
// 表单值清空
function clearFormVal(el) {
    $(':input', el)
        .val('')
        .removeAttr('checked')
        .removeAttr('selected');
}
var banMsg;
@@ -126,7 +233,7 @@
                layer.close(tips);
                banMsg = null;
            } else if (res.code === 403) {
                top.location.href = baseUrl;
                top.location.href = baseUrl+"/";
            } else if (res.code === 407) {
                banMsg = res.data + "不可用";
                tips = layer.tips(