lineheadquery_delivery.html 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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_delivery' => 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. $('#head_dan_name').val(json_obj.community_name);
  57. $('#head_dan_id').val(json_obj.id);
  58. layer.close(layer.index);
  59. });
  60. </script>