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) : ''; }); // $('.The_house').focus(function(){ // indexOpen = parent.layui.layer.open({ // type: 2, // title: '选择需要添加的楼盘', // area: ['','100%'], // content: '/routinevideo/allhouse', // success:function (layero, index) { // }, // end:function(){ // } // }); // parent.layui.layer.full(indexOpen); // //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作) // $(window).on("resize",function(){ // parent.layui.layer.full(indexOpen); // }) // }) table.render({ elem: '#houselist' ,url: '/publicuse/allcity' //数据接口 ,where:{token:csrfToken} ,method:'post' ,page: true //开启分页 ,limit : 20 ,text:'数据加载中' ,id:'houseReload' ,cols: [[ //表头 {type: "checkbox", width:50}, // {title:'选择',event:'checkbox',width:50,align:'center',templet:"#checkBox",templet:function(d){ // return '
' // }}, {type:'numbers',title:'序号'}, {field: 'city_name', title: '区域名称', align:'center'}, ]] }); //选择所属楼盘添加 var _data = []; // table.on('tool(houselist)', function(obj){ // var layEvent = obj.event, // data = obj.data; // if(layEvent === 'check'){ // console.log($(this).children('input')); // // if($(this).checked) // { // _data.push(data); // console.log(_data) // } // // _data = 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){ console.log(val.city_name); if(val.city_name == obj.data.city_name){ del.push(key); } }) if(del.length >0){ $.each(del,function(key,val){ console.log(key); _data.splice(key,1); }) } } }); // 提交按钮 $('.xuanzhouse').click(function () { var a = parent.layer.getChildFrame('body', indexOpen); var type = $('#types').html(); console.log(type); if(type == 1){ var _length = a.find('input#hiddenBox[type="hidden"]'); if(_length.length > 0){ _length.remove(); } if(_data.length > 1){ layer.msg('请勿选择多个'); return ; } console.log(_data[0].city_name); a.find('#house_name').val(_data[0].city_name) a.find('form').append(''); } else { a.find('tbody').html(''); if(typeof _data == 'object'){ for(var i=0;i<_data.length;i++){ var tr ='