var indexOpen; layui.use(['laypage', 'layer', 'table', 'element', 'form', 'upload'], function () { var laypage = layui.laypage //分页 , $ = layui.jquery , 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); }) }) var indexO = table.render({ elem: '#houselist' , url: '/publicuse/allhousecnform' //数据接口 , where: {token: csrfToken} , method: 'post' , page: true //开启分页 , text: '数据加载中' , id: 'houseReload' , cols: [[ //表头 { title: '选择', event: 'check', width: 60, align: 'center', templet: "#checkBox", templet: function (d) { return '
' } }, {type: 'numbers', title: '序号'}, {field: 'name', title: '楼盘名称', align: 'center'}, ]] }); //选择所属楼盘添加 var _data; table.on('tool(houselist)', function (obj) { var layEvent = obj.event, data = obj.data; if (layEvent === 'check') { _data = data; } }); // 提交按钮 $('.xuanzhouse').click(function () { var a = parent.layer.getChildFrame('body', indexOpen); if (a.find('#feng_houseall').length <= 0) { // var a = parent.layer.getChildFrame('body', indexOpen); var _length = a.find('input#hiddenBox[type="hidden"]'); if (_length.length > 0) { _length.remove(); } if (typeof _data == 'object') { a.find('#house_name').val(_data.name) a.find('form').append(''); TableClose(); } } else { ; // var checkStatus = table.checkStatus('houseReload'); // var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8}); //数据提交提示 // var a = parent.layer.getChildFrame('body', indexOpen); var _length = a.find('input#hiddenBox[type="hidden"]'); if (_length.length > 0) { _length.remove(); } if (typeof _data == 'object') { var formdat = new FormData(); var htmlStr = ''; // $.each(checkStatus.data,function (key,val) { htmlStr += '' + _data.name + ' 删除'; // }) var tb = $('.layui-table').length; var html = ''; if (a.find('.layui-table').length <= 0) { html += ' \n' + ' \n' + ' \n' + ' \n' + ' \n' + ' \n' + ' \n' + ' \n' + ' \n' + ' \n' + ' \n' + ' \n' + ' \n' + htmlStr + ' \n' + ' \n' + '
楼盘名称操作
'; } if (a.find('.layui-table').length > 0) { a.find('.layui-table').append(htmlStr); } else { a.find('#feng_houseall').append(html); } TableClose(); return false; } layer.msg('请选择楼盘', {icon: 5}); return false; var _length = a.find('input#hiddenBox[type="hidden"]'); if (_length.length > 0) { _length.remove(); } if (typeof _data == 'object') { a.find('#house_name').val(_data.name) a.find('form').append(''); TableClose(); } } }) });