var indexOpen; layui.use([ 'laypage', 'layer', 'table', 'element','form','upload'], function(){ var laypage = layui.laypage //分页 ,$ = layui.jquery ,layer = layui.layer //弹层 ,table = layui.table //表格 var tableIds = 'videolist'; //表格ID var $ = layui.$, active = { house_reload:function(){ var form = pfgs_serialize($('form')); // console.log(form); table.reload('houseReload',{ where:{ name:form.input_house_text } }) } }; $('.demoTable .layui-btn').on('click', function(){ var type = $(this).data('type'); active[type] ? active[type].call(this) : ''; }); var indexO = table.render({ elem: '#houselist' ,url: '/publicuse/newscolumnform' //数据接口 ,where:{token:csrfToken} ,method:'post' ,page: true //开启分页 ,text:'数据加载中' ,id:'houseReload' ,limit : 20 ,cols: [[ //表头 {type: "checkbox", width:50}, // {title:'选择',event:'checkbox',width:50,align:'center',templet:"#checkBox",templet:function(d){ // return '
' // }}, {type:'numbers',title:'序号'}, {field: 'news_name', title: '资讯名称', align:'center'}, ]] }); //选择所属楼盘添加 var _data = []; table.on('checkbox(houselist)', function(obj){ if(obj.checked == true){ _data.push(obj.data); } // if(obj.checked == false){ // var del = []; // $.each(_data,function(key,val){ // if(val.news_name == obj.data.news_name){ // console.log(val.news_name); // del.push(key); // } // }) // // if(del.length >0){ // $.each(del,function(key,val){ // // console.log(key); // _data.splice(key,1); // console.log(_data); // }) // } // } }); // 提交按钮 $('.xuanzhouse').click(function () { var a = parent.layer.getChildFrame('body', indexOpen); var type = $('#types').html(); // console.log(_data); // return ; if(type == 1){ var _length = a.find('input#hiddenBox[type="hidden"]'); if(_length.length > 0){ _length.remove(); } if(_data.length > 1){ layer.msg('请勿选择多个'); return ; } a.find('#house_name').val(_data[0].news_name) a.find('form').append(''); } else { a.find('tbody').html(''); if(typeof _data == 'object'){ for(var i=0;i<_data.length;i++){ var tr ='