layui.define([ 'form', 'laydate', 'table' ], function(exports) { var form = layui.form; var laydate = layui.laydate; var table = layui.table; var bannerTable = null; var data = {}; var view ={ init:function(e){ data = e; this.initTable(); window.dataReload = function(){ Lib.doSearchForm($("#bannerTable"),bannerTable) } }, initTable:function(){ bannerTable = table.render({ elem : '#bannerTable', method : 'post', url : Common.ctxPath+ '/admin/setting/banner/queryBannerList.json' //数据接口 ,page : true //开启分页 ,limit : 20, where: data, parseData :function(res){ //res 即为原始返回的数据 if(res.data.length === 0){ Common.info('并没有数据'); } return res; }, cols : [ [ //表头 { field: 'sort', title : '排序', width : 120, },{ field: 'picName', title : '名称', width : 150 },{ field : 'picUrl', title : '图片', width : 120, templet:function (d) { return ''; } }, { field : 'picPath', title : '跳转链接', width : 120, templet: function (d) { if(d.picPath == null || d.picPath.length === 0){ return '/'; } } },{ field: '', title: '操作', templet: function (data) { return '    ' + ''; } } ] ] }); }, } $("#add").click(function () { Common.openDlg("/admin/setting/banner/add.do","banner管理>>添加"); }); // 搜索 $("#search").click(function () { view.init(data); }); exports('index',view); });