lineheadquery_mb_choose.html 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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_mb" 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 s_member_id = '{$s_member_id}';
  30. var query_kwd = '{$kwd}';
  31. var query_url = "{:U('communityhead/lineheadquery', array('is_member_choose' => 1,'is_memberlist' =>1 ))}";
  32. var can_next = true;
  33. $(".select-btn").click(function(){
  34. query_kwd = $.trim($("#select-url-kw").val());
  35. if(!can_next)
  36. {
  37. return false;
  38. }
  39. can_next = false;
  40. $.ajax({
  41. url:query_url,
  42. type:'post',
  43. dataType:'json',
  44. data:{keyword:query_kwd,is_ajax:1},
  45. success:function(ret){
  46. if(ret.code == 0)
  47. {
  48. $('.supplyquery tbody').html(ret.html);
  49. // $('#pager_ajax').html(ret.pager);
  50. }
  51. can_next = true;
  52. }
  53. })
  54. });
  55. $(document).undelegate(".choose_dan_head_mb","click").delegate(".choose_dan_head_mb","click",function(){
  56. var json_obj = JSON.parse($(this).attr('data-json'));
  57. var s_head_id = json_obj.id;
  58. $.ajax({
  59. url:"{:U('user/chose_community', array('s_member_id' => $s_member_id ))}",
  60. type:'post',
  61. data:{head_id:s_head_id},
  62. success:function(ret){
  63. layer.msg('操作成功',{time: 1000,
  64. end:function(){
  65. location.href = location.href;
  66. }
  67. });
  68. }
  69. })
  70. // $(cur_open_div).val( json_obj.id );
  71. });
  72. $(document).undelegate(".choose_dan_head","click").delegate(".choose_dan_head","click",function(){
  73. var json_obj = JSON.parse($(this).attr('data-json'));
  74. var p_html = '';
  75. p_html+= '<div class="multi-audio-item " data-id="'+json_obj.id+'">';
  76. p_html+= ' <div class="input-group">';
  77. p_html+= ' <input type="text" class="form-control img-textname" readonly="" value="'+json_obj.community_name+'">';
  78. p_html+= ' <input type="hidden" value="'+json_obj.id+'" name="head_id[]">';
  79. p_html+= ' <div class="input-group-btn">';
  80. 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>';
  81. p_html+= ' </div>';
  82. p_html+= ' </div>';
  83. p_html+= '</div>';
  84. //$(cur_open_div).val( json_obj.member_id );
  85. // $(cur_open_div).parent().siblings().remove();
  86. $('.multi-audio-details').append(p_html);
  87. // $(cur_open_div).val( json_obj.head_id );
  88. layer.close(layer.index);
  89. });
  90. </script>