query_form.html 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <div style='max-height:500px;overflow:auto;min-width:850px;'>
  2. <div class="input-group layui-row" style="margin:10px;">
  3. <input type="text" placeholder="请输入表单名称进行搜索" id="select-url-kw" value="" class="form-control">
  4. <span class="input-group-addon btn btn-default select-btn" data-type="url">搜索</span>
  5. </div>
  6. <table class="table supplyquery table-hover supplyquery" style="min-width:850px;">
  7. <tbody>
  8. <tr>
  9. <th style="color:#000;">表单名称</th>
  10. <th style="color:#000;">表单类型</th>
  11. <th style="color:#000;">操作</th>
  12. </tr>
  13. <?php foreach($data['list'] as $row){ ?>
  14. <tr>
  15. <td>{$row['form_name']}</td>
  16. <td>{$row['form_type_name']}</td>
  17. <td style="width:80px;">
  18. <?php if(!empty($gpc['template']) && $gpc['template'] == 'mult'){ ?>
  19. <a href="javascript:;" class="choose_mult_link" data-json='<?php echo json_encode($row);?>'>选择</a>
  20. <?php }else{ ?>
  21. <a href="javascript:;" class="choose_dan_link" data-json='<?php echo json_encode($row);?>'>选择</a>
  22. <?php } ?>
  23. </td>
  24. </tr>
  25. <?php } ?>
  26. <?php if( count($data['list'])<=0 ){ ?>
  27. <tr>
  28. <td colspan='3' align='center'>未找到表单信息</td>
  29. </tr>
  30. <?php } ?>
  31. </tbody>
  32. <?php if( count($data['list']) > 0 ){ ?>
  33. <tfoot>
  34. <tr>
  35. <td colspan='3' align='center' id="pager_ajax">
  36. {$pager}
  37. </td>
  38. </tr>
  39. </tfoot>
  40. <?php } ?>
  41. </table>
  42. </div>
  43. <script>
  44. var type = "{$data['gpc']['type']}";
  45. var query_kwd = "{$data['gpc']['keyword']}";
  46. var template = "{$data['gpc']['template']}";
  47. var query_url = "{:U('allform/query_form')}";
  48. var can_next = true;
  49. $(document).delegate(".choose_dan_link","click",function(){
  50. //data-json
  51. var json_obj = JSON.parse($(this).attr('data-json'));
  52. $(cur_open_div).val(json_obj.id);
  53. $(cur_open_name).val(json_obj.form_name);
  54. layer.close(child_index);
  55. });
  56. /*$(document).delegate(".choose_mult_users","click",function(){
  57. var is_exist = false;
  58. var json_obj = JSON.parse($(this).attr('data-json'));
  59. $(cur_open_div).parent().parent().find('.mult_choose_userid').each(function(){
  60. var uid = $(this).attr("data-uid");
  61. if(uid == json_obj.user_id){
  62. is_exist = true;
  63. }
  64. });
  65. if(!is_exist){
  66. var p_html = '';
  67. p_html+= '<div class="input-group mult_choose_userid" data-uid="'+json_obj.user_id+'" style="border-radius: 0;float: left;margin: 10px;margin-left:0px;">';
  68. p_html+= ' <div class="layadmin-text-center choose_user">';
  69. p_html+= ' <img style="" src="'+json_obj.avatar+'">';
  70. p_html+= ' <div class="layadmin-maillist-img" style="">'+json_obj.username+'</div>';
  71. p_html+= ' <button type="button" class="layui-btn layui-btn-sm" onclick="cancle_bind(this)"><i class="layui-icon">&#xe640;</i></button>';
  72. p_html+= ' </div>';
  73. p_html+= '</div>';
  74. $(cur_open_div).parent().after(p_html);
  75. }
  76. });*/
  77. $(".select-btn").click(function(){
  78. query_kwd = $.trim($("#select-url-kw").val());
  79. var s_page = $(this).attr('page');
  80. if(!can_next)
  81. {
  82. return false;
  83. }
  84. can_next = false;
  85. $.ajax({
  86. url:query_url,
  87. type:'post',
  88. dataType:'json',
  89. data:{keyword:query_kwd, page:1,is_ajax:1, template:template, type: type},
  90. success:function(ret){
  91. if(ret.status == 0)
  92. {
  93. $('.supplyquery tbody').html(ret.result.html);
  94. $('#pager_ajax').html(ret.result.pager);
  95. }
  96. can_next = true;
  97. }
  98. })
  99. });
  100. $("body").delegate(".pagination a","click",function(){
  101. var s_page = $(this).attr('page');
  102. if(!can_next)
  103. {
  104. return false;
  105. }
  106. can_next = false;
  107. $.ajax({
  108. url:query_url,
  109. type:'post',
  110. dataType:'json',
  111. data:{keyword:query_kwd, page:s_page,is_ajax:1, template:template, type: type},
  112. success:function(ret){
  113. console.log(ret);
  114. if(ret.status == 0)
  115. {
  116. $('.supplyquery tbody').html(ret.result.html);
  117. $('#pager_ajax').html(ret.result.pager);
  118. }
  119. can_next = true;
  120. },
  121. error: function (XMLHttpRequest, textStatus, errorThrown) {
  122. //弹出报错内容  
  123. console.log(XMLHttpRequest.status+XMLHttpRequest.readyState+textStatus);
  124. }
  125. })
  126. })
  127. $.ajaxSetup({ headers: { 'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content') }})
  128. </script>