自动化立体仓库 - WMS系统
pjb
2025-08-12 1e6b4d88290ccd79b51bed3acb805750a0ea7d01
src/main/webapp/static/js/basCrnError/basCrnError.js
@@ -1,11 +1,11 @@
var pageCurr;
layui.use(['table','laydate', 'form'], function(){
layui.use(['table','laydate', 'form','upload','layer'], function(){
    var table = layui.table;
    var $ = layui.jquery;
    var layer = layui.layer;
    var layDate = layui.laydate;
    var form = layui.form;
    var upload = layui.upload;
    // 数据渲染
    tableIns = table.render({
        elem: '#basCrnError',
@@ -13,6 +13,7 @@
        url: baseUrl+'/basCrnError/list/auth',
        page: true,
        limit: 16,
        limits: [16, 30, 50, 100, 200, 500],
        even: true,
        toolbar: '#toolbar',
        cellMinWidth: 50,
@@ -45,7 +46,7 @@
        },
        done: function(res, curr, count) {
            if (res.code === 403) {
                top.location.href = baseUrl;
                top.location.href = baseUrl+"/";
            }
            pageCurr=curr;
            limit();
@@ -59,7 +60,26 @@
            });
        }
    });
    upload.render({
        elem: '#uploadExcel', // 绑定元素
        url: baseUrl+'/importCrnErr', // 上传接口,替换为你的后端接口
        headers:{'token': localStorage.getItem('token')},
        accept: 'file', // 允许上传的文件类型
        exts: 'xls|xlsx', // 允许上传的文件后缀
        done: function(res){
            // 上传完毕回调
            if(res.code === 200){
                layer.msg(res.msg);
                console.log('文件数据:', res.data);
            } else {
                layer.msg(res.msg || '上传失败');
            }
        },
        error: function(){
            // 请求异常回调
            layer.msg('上传失败,请重试');
        }
    });
    // 监听排序事件
    table.on('sort(basCrnError)', function (obj) {
        var searchData = {};
@@ -75,7 +95,7 @@
            },
            done: function (res, curr, count) {
                if (res.code === 403) {
                    top.location.href = baseUrl;
                    top.location.href = baseUrl+"/";
                }
                pageCurr=curr;
                limit();
@@ -92,12 +112,12 @@
                    type: 2,
                    title: '新增',
                    maxmin: true,
                    area: [top.detailWidth, top.detailHeight],
                    area: ['500px', top.detailHeight],
                    shadeClose: false,
                    content: 'basCrnError_detail.html',
                    success: function(layero, index){
                        layer.getChildFrame('#data-detail-submit-edit', index).hide();
                        layer.getChildFrame('#errorCode', index).parent().parent().hide();
                        // layer.getChildFrame('#errorCode', index).parent().parent().hide();
                       clearFormVal(layer.getChildFrame('#detail', index));
                        layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
                    }
@@ -128,7 +148,7 @@
                                    layer.closeAll();
                                    tableReload(false);
                                } else if (res.code === 403){
                                    top.location.href = baseUrl;
                                    top.location.href = baseUrl+"/";
                                } else {
                                    layer.msg(res.msg)
                                }
@@ -138,7 +158,7 @@
                }
                break;
            case 'exportData':
                layer.confirm('确定导出Excel吗', function(){
                layer.confirm('确定导出Excel吗', {shadeClose: true}, function(){
                    var titles=[];
                    var fields=[];
                    obj.config.cols[0].map(function (col) {
@@ -167,7 +187,7 @@
                            if (res.code === 200) {
                                table.exportFile(titles,res.data,'xls');
                            } else if (res.code === 403) {
                                top.location.href = baseUrl;
                                top.location.href = baseUrl+"/";
                            } else {
                                layer.msg(res.msg)
                            }
@@ -207,7 +227,7 @@
                    type: 2,
                    title: '修改',
                    maxmin: true,
                    area: [top.detailWidth, top.detailHeight],
                    area: ['500px', top.detailHeight],
                    shadeClose: false,
                    content: 'basCrnError_detail.html',
                    success: function(layero, index){
@@ -339,7 +359,7 @@
                        $(this).val("");
                    });
                } else if (res.code === 403){
                    top.location.href = baseUrl;
                    top.location.href = baseUrl+"/";
                }else {
                    layer.msg(res.msg)
                }
@@ -401,7 +421,7 @@
        },
        done: function (res, curr, count) {
            if (res.code === 403) {
                top.location.href = baseUrl;
                top.location.href = baseUrl+"/";
            }
            pageCurr=curr;
            if (res.data.length === 0 && count !== 0) {