video.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. layui.use([ 'laypage', 'layer', 'table', 'element','form','upload'], function(){
  2. var laypage = layui.laypage //分页
  3. ,$ = layui.jquery
  4. ,layer = layui.layer //弹层
  5. ,table = layui.table; //表格
  6. var $ = layui.$, active = {
  7. house_reload:function(){
  8. var form = pfgs_serialize($('form'));
  9. console.log(form);
  10. table.reload('houseReload',{
  11. where:{
  12. name:form.input_house_text
  13. }
  14. })
  15. }
  16. };
  17. $('.demoTable .layui-btn').on('click', function(){
  18. var type = $(this).data('type');
  19. active[type] ? active[type].call(this) : '';
  20. });
  21. table.render({
  22. elem: '#houselist'
  23. ,url: '/publicuse/videoform' //数据接口
  24. ,where:{token:csrfToken}
  25. ,method:'post'
  26. ,page: true //开启分页
  27. ,text:'数据加载中'
  28. ,id:'houseReload'
  29. ,limit:20
  30. ,cols: [[ //表头
  31. {type: "checkbox", width:50},
  32. // {title:'选择',event:'checkbox',width:50,align:'center',templet:"#checkBox",templet:function(d){
  33. // return '<div class="layui-inline" style="width: 100%"><input type="checkbox" name="sex" ></div>'
  34. // }},
  35. {type:'numbers',title:'序号'},
  36. {field: 'title', title: '视频名称', align:'center'},
  37. ]]
  38. });
  39. //选择所属楼盘添加
  40. var _data = [];
  41. // table.on('tool(houselist)', function(obj){
  42. // var layEvent = obj.event,
  43. // data = obj.data;
  44. // if(layEvent === 'check'){
  45. // console.log($(this).children('input'));
  46. //
  47. // if($(this).checked)
  48. // {
  49. // _data.push(data);
  50. // console.log(_data)
  51. // }
  52. // // _data = data;
  53. //
  54. //
  55. // }
  56. // });
  57. table.on('checkbox(houselist)', function(obj){
  58. if(obj.checked == true){
  59. _data.push(obj.data);
  60. }
  61. if(obj.checked == false){
  62. var del = [];
  63. $.each(_data,function(key,val){
  64. console.log(val.city_name);
  65. if(val.city_name == obj.data.city_name){
  66. del.push(key);
  67. }
  68. })
  69. if(del.length >0){
  70. $.each(del,function(key,val){
  71. console.log(key);
  72. _data.splice(key,1);
  73. })
  74. }
  75. }
  76. });
  77. // 提交按钮
  78. $('.xuanzhouse').click(function () {
  79. var a = parent.layer.getChildFrame('body');
  80. var type = $('#types').html();
  81. if(type == 1){
  82. var _length = a.find('input#hiddenBox[type="hidden"]');
  83. if(_length.length > 0){
  84. _length.remove();
  85. }
  86. if(_data.length > 1){
  87. layer.msg('请勿选择多个');
  88. return ;
  89. }
  90. a.find('#house_name').val(_data[0].title)
  91. a.find('form').append('<input type="hidden" id="hiddenBox" name="vid" value="'+_data[0].id+'" />');
  92. } else {
  93. a.find('tbody').html('');
  94. if(typeof _data == 'object'){
  95. for(var i=0;i<_data.length;i++){
  96. var tr ='<tr>'
  97. +'<td lay-event="del">'
  98. +'<div class="layui-table-cell del"><i class="layui-icon" style="font-size: 30px; color: #1E9FFF;cursor: pointer">&#xe640;</i></div>'
  99. +'</td>'
  100. +'<td data-field="matingName" align="center" data-content="">'
  101. +'<div class="layui-table-cell"><input type="text" name="matingName" value="'+_data[i].title+'" autocomplete="off" class="layui-input" ><input type="hidden" name="vid" value="'+_data[i].id+'"></div>'
  102. +'</td>'
  103. +'</tr>'
  104. a.find('tbody').append(tr);
  105. }
  106. }
  107. }
  108. TableClose();
  109. })
  110. });