wang..123
2022-03-10 dcd7fcf596005d0c7cf66558bee97edf6c3b03a0
src/main/webapp/static/js/locNormal/locNormal.js
@@ -5,12 +5,14 @@
function getCol() {
    var cols = [];
    cols.push(
        {type: 'checkbox', fixed: 'left'},
        {field: 'anfme', align: 'center', title: '数量', sort: true, edit: 'text'}
    )
    cols.push.apply(cols, locNormalCols);
    cols.push(
        {field: 'warehouse$', align: 'center', title: '库区'}
        , {field: 'state', align: 'center', title: '出入库状态', templet: '#locNormalState'}
        , {field: 'state$', align: 'center', title: '出入库状态', templet: '#locNormalState'}
        ,{field: 'matStatus', align: 'center',title: '物料状态', width: 100, templet: '#matStatus'}
        , {field: 'modiUser$', align: 'center', title: '修改人员', hide: true}
        , {field: 'modiTime$', align: 'center', title: '修改时间', hide: true}
        , {field: 'appeTime$', align: 'center', title: '创建时间', hide: true}
@@ -107,6 +109,45 @@
                    }
                });
                break;
            // 导出
            case 'exportData':
                layer.confirm('确定导出Excel吗', {shadeClose: true}, function(){
                    var fields=[];
                    var titles=[];
                    var exportData = {};
                    obj.config.cols[0].map(function (col) {
                        if (col.type === 'normal' && col.hide === false && col.toolbar == null) {
                            titles.push(col.title);
                            fields.push(col.field);
                        }
                    });
                    $.each($('#search-box [name]').serializeArray(), function() {
                        exportData[this.name] = this.value;
                    });
                    var param = {
                        'exportData': exportData,
                        'fields': fields
                    };
                    $.ajax({
                        url: baseUrl+"/locNormal/export/auth",
                        headers: {'token': localStorage.getItem('token')},
                        data: JSON.stringify(param),
                        dataType:'json',
                        contentType:'application/json;charset=UTF-8',
                        method: 'POST',
                        success: function (res) {
                            layer.closeAll();
                            if (res.code === 200) {
                                table.exportFile(titles,res.data,'xls');
                            } else if (res.code === 403) {
                                top.location.href = baseUrl+"/";
                            } else {
                                layer.msg(res.msg)
                            }
                        }
                    });
                });
                break;
        }
    });
@@ -128,15 +169,6 @@
            pageSize: 'limit'
        },
        parseData: function (res) {
            // 解析库区名称
            var records = res.data.records;
            records.map(function (item) {
                locArea.map(function (d) {
                    if (d.uuid == item.warehouse) {
                        item.warehouse$ = d.name;
                    }
                })
            });
            return {
                'code': res.code,
                'msg': res.msg,
@@ -148,6 +180,7 @@
            statusCode: 200
        },
        done: function (res, curr, count) {
            console.log(res);
            if (res.code === 403) {
                top.location.href = baseUrl + "/";
            }
@@ -258,6 +291,12 @@
        }
        switch (obj.event) {
            case 'outLocNormal':
                var warehourse = data.warehouse;
                if(warehourse !== 'cs'){
                    layer.msg("只能出材料平仓");
                    return;
                }
                layer.confirm('确定要出库[' + data.matnr + ']吗?', {
                    btn: ['确定', '取消'] //可以无限个按钮
                }, function (index, layero) {
@@ -359,4 +398,62 @@
    });
}
var matStatusConfirm;
function showMatStatus1() {
    var layer = layui.layer;
    var table = layui.table;
    // 获取选中行
    var checkStatus = table.checkStatus('locNormal');
    // 选择行数据
    var checkData = checkStatus.data;
    if (checkData.length == 0) {
        layer.msg("请选择数据");
        return;
    }
    matStatusConfirm = layer.open({
        type: 2,
        title: '选择物料状态',
        area: ['300px', '175px'],
        content: '../pakStore/matStatus.html',
        btn: ['确定'],
        success: function (layero, index) {
            // 成功打开弹窗
            // tableReload(false);
        },
        yes: function (index, layero) {
            // 子页面
            var matStatus = layero.find('iframe')[0].contentDocument;
            // 子页面选择数据监控
            var forms = matStatus.forms;
            var cho = forms[0][0].value;
            // 入参拼接
            if (checkData && checkData.length > 0) {
                checkData.map(function (item) {
                    item.matStatus = cho;
                });
            }
            param = {
                list: checkData,
            };
            // 更新物料状态
            console.log('选择数据', checkData);
            $.ajax({
                url: baseUrl+"/locNormal/getAllLocDetlData",
                headers: {'token': localStorage.getItem('token')},
                data: JSON.stringify(param),
                dataType:'json',
                contentType:'application/json;charset=UTF-8',
                method: 'POST',
                success: function (res) {
                    console.log('返回值', res);
                    // 关闭弹窗
                    layer.close(index);
                    // 表格数据重置
                    tableReload(false);
                }
            });
        }
    });
}