王佳豪
2021-03-09 b301170fd119b1519b2b2cc8dfabf0c3bb754440
src/main/webapp/static/js/locNormal/locNormal.js
@@ -1,5 +1,6 @@
var pageCurr;
var locNormalList = [];
var locArea = [];
function getCol() {
    var cols = [];
@@ -8,7 +9,8 @@
    )
    cols.push.apply(cols, locNormalCols);
    cols.push(
        {field: 'state', align: 'center', title: '出入库状态', templet: '#locNormalState'}
        {field: 'warehouse', align: 'center', title: '库区'}
        , {field: 'state', align: 'center', title: '出入库状态', templet: '#locNormalState'}
        , {field: 'modiUser$', align: 'center', title: '修改人员', hide: true}
        , {field: 'modiTime$', align: 'center', title: '修改时间', hide: true}
        , {field: 'appeTime$', align: 'center', title: '创建时间', hide: true}
@@ -16,6 +18,19 @@
    );
    return cols;
}
// 获取仓库下拉
$.ajax({
    url: baseUrl+"/locArea/queryAll/auth",
    headers: {'token': localStorage.getItem('token')},
    // data: top.reObject(data),
    method: 'POST',
    success: function (res) {
        if (res.data && res.data.length > 0) {
            locArea = res.data;
        }
    },
});
layui.use(['table', 'laydate', 'form', 'upload'], function () {
    var table = layui.table;
@@ -34,14 +49,14 @@
        , exts: 'xls|excel|xlsx'
        , auto: false
        , bindAction: '#uploadDo'
        , before: function(obj){
        , before: function (obj) {
            layer.closeAll();
            layer.load(1, {shade: [0.1,'#fff']});
            layer.load(1, {shade: [0.1, '#fff']});
        }
        , choose: function(obj){
        , choose: function (obj) {
            $('#uploadDesc').hide();
            $('#uploadDemoView').show();
            obj.preview(function(index, file, result){
            obj.preview(function (index, file, result) {
                $('#fileMame').html(file.name);
            });
        }
@@ -54,15 +69,14 @@
            layer.msg(res.msg);
            tableReload(false);
        }
        , error: function(index, upload){
        , error: function (index, upload) {
            layer.closeAll('loading');
        }
    });
    /* 导入 */
    table.on('toolbar(locNormal)', function (obj) {
        debugger
        switch(obj.event) {
        switch (obj.event) {
            // 导入
            case 'intoData':
                layer.open({
@@ -70,7 +84,7 @@
                    title: '数据导入',
                    shadeClose: true,
                    content: $('#importDataDiv'),
                    success: function(layero, index){
                    success: function (layero, index) {
                        uploader.reload();
                    },
                    end: function () {
@@ -101,11 +115,20 @@
            pageSize: 'limit'
        },
        parseData: function (res) {
            // 解析库区名称
            var records = res.data.records;
            records.map(function (item) {
                locArea.map(function (d) {
                    if (d.id == item.warehouse) {
                        item.warehouse = d.name;
                    }
                })
            });
            return {
                'code': res.code,
                'msg': res.msg,
                'count': res.data.total,
                'data': res.data.records
                'data': res.data.records,
            }
        },
        response: {