自动化立体仓库 - WMS系统
src/main/webapp/static/js/locMast/locMast.js
@@ -1,4 +1,5 @@
var pageCurr;
var batchAreaLocNos = [];
layui.use(['table','laydate', 'form'], function(){
    var table = layui.table;
    var $ = layui.jquery;
@@ -22,8 +23,9 @@
            {type: 'checkbox', fixed: 'left'}
//            ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80}
            ,{field: 'locNo', align: 'center',title: '库位号',sort:true, hide:false}
            ,{field: 'areaId$', align: 'center',title: '库区',sort:true, hide:false}
            ,{field: 'locAlias', align: 'center',title: '库位别名',sort:true, hide:false}
            ,{field: 'locSts$', align: 'center',title: '库位状态',width:200, hide:false}
            ,{field: 'whsType$', align: 'center',title: '库位类型',width:200, hide:false}
            // ,{field: 'pltType', align: 'center',title: ''}
            // ,{field: 'ctnType', align: 'center',title: ''}
            // ,{field: 'locSts', align: 'center',title: ''}
@@ -33,12 +35,6 @@
            ,{field: 'bay1', align: 'center',title: '列', sort:true, hide:false}
            ,{field: 'lev1', align: 'center',title: '层', sort:true, hide:false}
            ,{field: 'gro1', align: 'center',title: '组', sort:true, hide:false}
            ,{field: 'fullPlt', align: 'center',title: '满板', templet:function(row){
                    var html = "<input value='fullPlt' type='checkbox' lay-skin='primary' lay-filter='tableCheckbox' disabled table-index='"+row.LAY_TABLE_INDEX+"'";
                    if(row.fullPlt === 'Y'){html += " checked ";}
                    html += ">";
                    return html;
                },width:80, hide:false}
            // ,{field: 'outEnable', align: 'center',title: ''}
            ,{field: 'ioTime$', align: 'center',title: 'ioTime', hide:true}
            // ,{field: 'firstTime$', align: 'center',title: '', hide:true}
@@ -59,7 +55,7 @@
            ,{field: 'locType2$', align: 'center',title: '宽窄类型', hide:true}
            ,{field: 'locType3$', align: 'center',title: '轻重类型', hide:true}
            ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:100}
            ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:160}
        ]],
        request: {
            pageName: 'curr',
@@ -82,14 +78,6 @@
            }
            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';
                }
            });
        }
    });
@@ -168,6 +156,28 @@
                            }
                        })
                    });
                }
                break;
            case 'batchArea':
                var areaData = checkStatus.data;
                if (areaData.length === 0){
                    layer.msg('请选择数据');
                } else {
                    batchAreaLocNos = areaData.map(function (item) {
                        return item.locNo;
                    });
                    $('#batchAreaId').val('');
                    layer.open({
                        type: 1,
                        title: '批量修改库区',
                        area: ["360px"],
                        maxmin: true,
                        shadeClose: true,
                        content: $("#batchAreaDiv"),
                        success: function () {
                            form.render('select');
                        }
                    })
                }
                break;
            case 'exportData':
@@ -257,6 +267,23 @@
                    }
                });
                break;
            case 'viewPhoto':
                $.ajax({
                    url: baseUrl + "/photo/loc/auth",
                    headers: {'token': localStorage.getItem('token')},
                    data: {locNo: data.locNo},
                    method: 'GET',
                    success: function (res) {
                        if (res.code === 200) {
                            showPhotoViewer(layer, res.data);
                        } else if (res.code === 403) {
                            top.location.href = baseUrl + "/";
                        } else {
                            layer.msg(res.msg);
                        }
                    }
                });
                break;
            // 编辑
            case 'edit':
                layer.open({
@@ -276,42 +303,6 @@
                        layero.find('iframe')[0].contentWindow.layui.form.render('checkbox');
                    }
                });
                break;
            case 'whsType':
                var param = top.reObject(data).whsType;
                if (param === undefined) {
                    layer.msg("无数据");
                } else {
                   layer.open({
                       type: 2,
                       title: '库位详情',
                       maxmin: true,
                       area: [top.detailWidth, top.detailHeight],
                       shadeClose: false,
                       content: '../basWhs/basWhs_detail.html',
                       success: function(layero, index){
                           $.ajax({
                               url: baseUrl+"/basWhs/"+ param +"/auth",
                               headers: {'token': localStorage.getItem('token')},
                               method: 'GET',
                               success: function (res) {
                                   if (res.code === 200){
                                       setFormVal(layer.getChildFrame('#detail', index), res.data, true);
                                       top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true);
                                       layer.getChildFrame('#data-detail-submit-save,#data-detail-submit-edit,#prompt', index).hide();
                                       layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
                                       layero.find('iframe')[0].contentWindow.layui.form.render('select');
                                       layero.find('iframe')[0].contentWindow.layui.form.render('checkbox');
                                   } else if (res.code === 403){
                                       parent.location.href = "/";
                                   }else {
                                       layer.msg(res.msg)
                                   }
                               }
                           })
                       }
                   });
                }
                break;
            case 'modiUser':
                var param = top.reObject(data).modiUser;
@@ -412,6 +403,36 @@
        })
    });
    // 批量修改库区
    form.on('submit(batchAreaDo)', function (data) {
        if (batchAreaLocNos.length === 0) {
            layer.msg('请选择数据');
            return false;
        }
        $.ajax({
            url: baseUrl+"/locMast/batch/area/auth",
            headers: {'token': localStorage.getItem('token')},
            data: JSON.stringify({
                locNos: batchAreaLocNos,
                areaId: data.field.areaId
            }),
            dataType:'json',
            contentType:'application/json;charset=UTF-8',
            method: 'POST',
            success: function (res) {
                if (res.code === 200){
                    layer.closeAll();
                    tableReload(false);
                } else if (res.code === 403){
                    parent.location.href = "/";
                }else {
                    layer.msg(res.msg)
                }
            }
        });
        return false;
    });
    // 数据保存动作
    form.on('submit(save)', function () {
        if (banMsg != null){
@@ -433,6 +454,8 @@
        var data = {
//            id: $('#id').val(),
            locNo: $('#locNo').val(),
            areaId: $('#areaId').val(),
            locAlias: $('#locAlias').val(),
            whsType: $('#whsType').val(),
            pltType: $('#pltType').val(),
            ctnType: $('#ctnType').val(),
@@ -442,6 +465,7 @@
            row1: $('#row1').val(),
            bay1: $('#bay1').val(),
            lev1: $('#lev1').val(),
            gro1: $('#gro1').val(),
            fullPlt: $('#fullPlt').val(),
            locType: $('#locType').val(),
            outEnable: $('#outEnable').val(),
@@ -460,7 +484,8 @@
            barcode: $('#barcode').val(),
            PdcType: $('#PdcType').val(),
            ctnNo: $('#ctnNo').val(),
            frozen: $('#frozen').val(),
            frozenMemo: $('#frozenMemo').val()
        };
        $.ajax({
            url: baseUrl+"/locMast/"+name+"/auth",
@@ -483,16 +508,6 @@
            }
        })
    }
    // 复选框事件
    form.on('checkbox(detailCheckbox)', function (data) {
        var el = data.elem;
        if (el.checked) {
            $(el).val('Y');
        } else {
            $(el).val('N');
        }
    });
    // 搜索栏搜索事件
    form.on('submit(search)', function (data) {