queryclerk.html 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. <?php foreach( $ds as $row ){ ?>
  9. <tr>
  10. <td><img src='{$row['avatar']}' style='width:30px;height:30px;padding1px;border:1px solid #ccc' /> {$row['nickname']}</td>
  11. <td>{$row['mobile']}</td>
  12. <td style="width:80px;"><a href="javascript:;" class="choose_dan_link" data-json='{:json_encode($row);}'>选择</a></td>
  13. </tr>
  14. <?php } ?>
  15. <?php if( count($ds)<=0){ ?>
  16. <tr>
  17. <td colspan='4' align='center'>未找到可分配的司机</td>
  18. </tr>
  19. <?php } ?>
  20. </tbody>
  21. </table>
  22. </div>
  23. <script>
  24. var query_kwd = '{$kwd}';
  25. var query_url = "{:U('delivery/queryclerk', array('is_not_hexiao' => $is_not_hexiao))}";
  26. var can_next = true;
  27. $(document).delegate(".choose_dan_link","click",function(){
  28. var json_obj = JSON.parse($(this).attr('data-json'));
  29. var p_html = '';
  30. p_html+= '<div class="input-group " style="margin: 0;">';
  31. p_html+= ' <div class="layadmin-text-center choose_user">';
  32. p_html+= ' <img style="" src="'+json_obj.avatar+'">';
  33. p_html+= ' <div class="layadmin-maillist-img" style="">'+json_obj.name+'</div>';
  34. p_html+= ' <button type="button" class="layui-btn layui-btn-sm" onclick="cancle_bind(this)"><i class="layui-icon">&#xe640;</i></button>';
  35. p_html+= ' </div>';
  36. p_html+= '</div>';
  37. $(cur_open_div).parent().siblings().remove();
  38. $(cur_open_div).parent().after(p_html);
  39. $(cur_open_div).val( json_obj.id );
  40. layer.close(layer.index);
  41. });
  42. $(".select-btn").click(function(){
  43. query_kwd = $.trim($("#select-url-kw").val());
  44. if(!can_next)
  45. {
  46. return false;
  47. }
  48. can_next = false;
  49. $.ajax({
  50. url:query_url,
  51. type:'post',
  52. dataType:'json',
  53. data:{keyword:query_kwd,page:1,is_ajax:1},
  54. success:function(ret){
  55. console.log(ret);
  56. if(ret.code == 0)
  57. {
  58. $('.supplyquery tbody').html(ret.html);
  59. }
  60. can_next = true;
  61. }
  62. })
  63. });
  64. $("body").delegate(".pagination a","click",function(){
  65. var s_page = $(this).attr('page');
  66. if(!can_next)
  67. {
  68. return false;
  69. }
  70. can_next = false;
  71. $.ajax({
  72. url:query_url,
  73. type:'post',
  74. dataType:'json',
  75. data:{keyword:query_kwd, page:s_page, is_ajax:1},
  76. success:function(ret){
  77. if(ret.code == 0)
  78. {
  79. $('.supplyquery tbody').html(ret.html);
  80. }
  81. can_next = true;
  82. }
  83. })
  84. })
  85. </script>