layui.define([ 'form', 'laydate', 'table' ], function(exports) { var form = layui.form; var laydate = layui.laydate; var table = layui.table; var itemTable = null; var data = {}; var sortFlag = 0; var view ={ init:function(e){ data = e; this.initTable(); }, initTable:function(){ itemTable = table.render({ elem : '#itemTable', method : 'post', url : Common.ctxPath+ '/admin/setting/item/querIteml.json' //数据接口 ,page : true //开启分页 ,limit : 10, where: data, parseData :function(res){ //res 即为原始返回的数据 if(res.data.length == 0){ Common.info('并没有数据'); } return res; }, cols : [ [ //表头 { field: 'sort', title : '排序', width : 120, },{ field : 'title', title : '类别', width : 120, templet : function (d) { console.log(d); return ''; } }/*, { field : 'picture', title : '图片', width : 180, templet : function (d) { return '' } }*/,{ field: '', title: '操作', templet: function (data) { var tmp = ''; if(data.parentId != null) tmp = '&parentId='+data.parentId; return '编辑' + '' } } ] ] }); } } // 搜索 $("#search").click(function () { data = {'name':$("#name").val(), 'phone':$("#phone").val(),'userType':ut}; view.init(data); }); exports('index',view); });