lineheadquery_soli.html 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 table-hover supplyquery" style="min-width:850px;">
  7. <tbody>
  8. <?php foreach( $need_data as $row ){ ?>
  9. <tr>
  10. <td>{$row['community_name']}</td>
  11. <td>{$row['head_name']}</td>
  12. <td>{$row['head_mobile']}</td>
  13. <td>{$row['fullAddress']}</td>
  14. <td style="width:80px;"><a href="javascript:;" class="choose_dan_head" data-json='{:json_encode($row);}'>选择</a></td>
  15. </tr>
  16. <?php } ?>
  17. <?php if( count($need_data)<=0 ){ ?>
  18. <tr>
  19. <td colspan='4' align='center'>未找到可分配的小区</td>
  20. </tr>
  21. <?php } ?>
  22. </tbody>
  23. </table>
  24. </div>
  25. <style>
  26. .supplyquery td{padding-left:5px;}
  27. </style>
  28. <script>
  29. var query_kwd = '{$kwd}';
  30. var query_url = "{:U('communityhead/lineheadquery', array('is_soli' => 1 ))}";
  31. var can_next = true;
  32. $(".select-btn").click(function(){
  33. query_kwd = $.trim($("#select-url-kw").val());
  34. if(!can_next)
  35. {
  36. return false;
  37. }
  38. can_next = false;
  39. $.ajax({
  40. url:query_url,
  41. type:'post',
  42. dataType:'json',
  43. data:{keyword:query_kwd,is_ajax:1},
  44. success:function(ret){
  45. if(ret.code == 0)
  46. {
  47. $('.supplyquery tbody').html(ret.html);
  48. // $('#pager_ajax').html(ret.pager);
  49. }
  50. can_next = true;
  51. }
  52. })
  53. });
  54. $(document).undelegate(".choose_dan_head","click").delegate(".choose_dan_head","click",function(){
  55. var json_obj = JSON.parse($(this).attr('data-json'));
  56. var is_exist = false;
  57. $('.multi-audio-item').each(function(){
  58. var data_id = $(this).attr('data-id');
  59. if(data_id == json_obj.id){
  60. is_exist = true;
  61. return false;
  62. }
  63. });
  64. if(!is_exist){
  65. $('#head_id').val(json_obj.id);
  66. var p_html = '';
  67. p_html+= '<div class="multi-audio-item " data-id="'+json_obj.id+'">';
  68. p_html+= ' <div class="input-group">';
  69. p_html+= ' <input type="text" class="form-control img-textname" readonly="" value="'+json_obj.community_name+'">';
  70. p_html+= ' <input type="hidden" class="mult_heads" value="'+json_obj.id+'" name="head_id[]">';
  71. p_html+= ' <div class="input-group-btn">';
  72. p_html+= ' <button class="btn btn-default" data-id="'+json_obj.id+'" onclick="cancle_head(this, '+json_obj.id+')" type="button"><i class="fa fa-remove"></i></button>';
  73. p_html+= ' </div>';
  74. p_html+= ' </div>';
  75. p_html+= '</div>';
  76. // $(cur_open_div).parent().siblings().remove();
  77. //$('.mult_choose_goodsid').remove();
  78. // $(cur_open_div).val( json_obj.id );
  79. <?php if($is_mult == 1){ ?>
  80. $('.multi-audio-details').append(p_html);
  81. <?php }else{ ?>
  82. $('.multi-audio-details').html(p_html);
  83. layer.close(layer.index);
  84. <?php } ?>
  85. }
  86. });
  87. </script>