最近搜索

layui table 表格 导出 excel 筛选行显示。打印

浏览:15
管理员 2026-03-12 09:50

image.png

<script th:inline="none">
/*<![CDATA[*/
      layui.use([ 'laydate', 'laypage', 'layer', 'table', 'carousel',
            'upload', 'element' ], function() {
         var laydate = layui.laydate //日期
         , laypage = layui.laypage //分页
         ,layer = layui.layer //弹层
         ,form= layui.form 
         , table = layui.table //表格
         , carousel = layui.carousel //轮播
         , upload = layui.upload //上传
         , element = layui.element; //元素操作
         
           table.render({
             elem: '#table'
             ,url: '/admin/goods/list'
             ,height: 'full-100'
                ,toolbar: '#toolbarDemo' // 开启头部工具栏,并为其绑定左侧模板
                ,defaultToolbar: ['filter', 'exports', 'print'] // 开启内置工具栏:筛选、导出、打印
            ,cols: [[
                {checkbox: true, fixed: true}
                ,{field:'id', title: 'ID', width:60,  style:'font-size: 12px;'}
                      ,{field:'orderNo', title: '排序', width:50,style:'font-size: 12px;', edit: 'text' }
                      ,{field:'imageUrl', title: '封面', width:80, templet: '#format_imageUrl',style:'font-size: 12px;'}
               ,{field:'recommend', title: '推荐位置', width:90,style:'font-size: 12px;'   }

                ,{field:'typeId', title: '分类', width:90,style:'font-size: 12px;',templet: '#format_type' }
               ,{field:'title', title: '标题', width:300,style:'font-size: 12px;', edit: 'text' }
                      ,{field:'name', title: '酒店名称', width:300,style:'font-size: 12px;', edit: 'text' }

                      ,{field:'price', title: '价格', width:60,style:'font-size: 12px;', edit: 'text' }
                   ,{field:'jinbi', title: '赠送金币', width:60,style:'font-size: 12px;', edit: 'text' }
                      ,{field:'baoxian', title: '赠送保险', width:90, templet: '#format_baoxian',style:'font-size: 12px;'  }
                      ,{field:'yuding', title: '预订', width:90, templet: '#format_yuding',style:'font-size: 12px;'  }
                      ,{field:'state', title: '是否审核', width:90, templet: '#format_state',style:'font-size: 12px;'  }
                ,{field:'tag', title: '标签', width:60,style:'font-size: 12px;', edit: 'text' }

               // ,{field:'sales', title: '销量', width:60,style:'font-size: 12px;', edit: 'text' }
               // ,{field:'clickHit', title: '查看次数', width:60,style:'font-size: 12px;', edit: 'text' }
               ,{field:'createDateTime', title: '创建时间', width:140 ,style:'font-size: 12px;'}
               ,{field:'URL', title: '小程序链接', width:90, templet: '#format_url',style:'font-size: 12px;'  }
                  ,{field:'qrUrl', title: '二维码', width:80, templet: '#format_qrUrl',style:'font-size: 12px;'}


                   /*  ,{field:'useIt', title: '是否首页置顶', width:90, templet: '#format_useIt',style:'font-size: 12px;'  } */
               /* 
               ,{field:'clickHit', title: '点击', width:60, style:'font-size: 12px;'  }
               ,{field:'replyHit', title: '回复', width:60,  style:'font-size: 12px;'  } */

               ,{fixed:'right', width:190,title: '操作',  toolbar: '#table_bar'}
                ]]
             ,id: 'table'
             ,page: true
                  ,limits:[50,100,200,300,400,500,1000,2000,3000],
            limit:50
           });

 
 
      
              
            form.render(); //更新全部表单
      });
      /*]]>*/
</script>




核心代码

,toolbar: '#toolbarDemo' // 开启头部工具栏,并为其绑定左侧模板
,defaultToolbar: ['filter', 'exports', 'print'] // 开启内置工具栏:筛选、导出、打印



联系站长

站长微信:xiaomao0055

站长QQ:14496453