batchsend.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. {extend name="common/common2" /}
  2. {block name="main"}
  3. <div class="row">
  4. <div class="col-sm-12">
  5. <div class="ibox float-e-margins">
  6. <div class="ibox-content">
  7. <form method="post" action="{:url('batchsend',[],'')}/id/{$id}/mode/{$mode}" class="form-horizontal">
  8. <div class="form-group">
  9. <label class="col-sm-2 control-label">备注</label>
  10. <div class="col-sm-6">
  11. <textarea name="todo_content" id="todo_content" class="form-control" cols="30" rows="3" ></textarea>
  12. </div>
  13. </div>
  14. <div class="form-group">
  15. <label class="col-sm-2 control-label">执行人<span class="text-danger">*</span></label>
  16. <div class="col-sm-6">
  17. <input type="text" class="form-control" oninput="changeSearch(this)" placeholder="搜索运送员">
  18. </div>
  19. </div>
  20. <div class="form-group">
  21. <label class="col-sm-2 control-label"></label>
  22. <div class="col-sm-10">
  23. <table class="table table-striped">
  24. <thead>
  25. <tr>
  26. <th><input type="checkbox" class="check-all"></th>
  27. <th>运送员名称</th>
  28. <th>性别</th>
  29. <th>今日送达次数</th>
  30. <th>上次位置</th>
  31. <th>上次修改时间</th>
  32. </tr>
  33. </thead>
  34. <tbody class="layer-photos" id="layer-photos">
  35. {foreach ($user_list as $key => $value)}
  36. <tr>
  37. <td><input name="to_user_id[]" type="checkbox" class="ids" value="{$value['id']}"></td>
  38. <td style="cursor: pointer;color: #023894;text-decoration:underline" onclick="oneU('{$value.id}')">{$value['real_name']}</td>
  39. <td>{$value['sex_name']}</td>
  40. <td>{$value['nums']}</td>
  41. <td>{$value['title']}</td>
  42. <td>{$value['addr_time']}</td>
  43. </tr>
  44. {/foreach}
  45. </tbody>
  46. </table>
  47. </div>
  48. </div>
  49. <div class="hr-line-dashed"></div>
  50. <div class="form-group">
  51. <div class="col-sm-6 col-sm-offset-2">
  52. <button class="btn btn-primary ajax-post" data-layer="1" data-reload="1" target-form="form-horizontal" type="submit">确 定</button>
  53. <button class="btn cancel-btn btn-default" type="button">取 消</button>
  54. </div>
  55. </div>
  56. </form>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. {/block}
  62. {block name="script"}
  63. <script>
  64. function oneU(id){
  65. layer.confirm('是否确认选择?', {
  66. btn: ['YES', 'NO'], //按钮
  67. shade: false //不显示遮罩
  68. }, function() {
  69. var url = "{:url('onesend',[],'')}/id/{$id}/mode/{$mode}";
  70. var todo_content = $("#todo_content").val();
  71. console.log(todo_content);
  72. $.post(url,{to_user_id:id,todo_content:todo_content},function (res){
  73. if(res.code==1){
  74. parent.layer.closeAll();
  75. }else {
  76. layer.msg(res.msg);
  77. return;
  78. }
  79. },'json')
  80. }, function() {
  81. parent.layer.closeAll();
  82. });
  83. }
  84. var lists = {:json_encode($user_list)};
  85. function changeSearch(_self) {
  86. var keyword = $(_self).val();
  87. var str = '';
  88. for (let o in lists){
  89. if(keyword){
  90. if(lists[o].real_name.indexOf(keyword) != -1){
  91. str += '<tr>';
  92. str += '<td><input name="to_user_id[]" type="checkbox" class="ids" value="'+lists[o].id+'"></td>';
  93. str += '<td onclick="oneU('+lists[o].id+')">'+lists[o].real_name+'</td>';
  94. str += '<td>'+lists[o].sex_name+'</td>';
  95. str += '<td>'+lists[o].nums+'</td>';
  96. str += '<td>'+lists[o].title+'</td>';
  97. str += '<td>'+lists[o].addr_time+'</td>';
  98. str += '</tr>';
  99. }
  100. }else{
  101. str += '<tr>';
  102. str += '<td><input name="to_user_id[]" type="checkbox" class="ids" value="'+lists[o].id+'"></td>';
  103. str += '<td onclick="oneU('+lists[o].id+')">'+lists[o].real_name+'</td>';
  104. str += '<td>'+lists[o].sex_name+'</td>';
  105. str += '<td>'+lists[o].nums+'</td>';
  106. str += '<td>'+lists[o].title+'</td>';
  107. str += '<td>'+lists[o].addr_time+'</td>';
  108. str += '</tr>';
  109. }
  110. }
  111. $('#layer-photos').html(str);
  112. console.log(keyword);
  113. }
  114. //全选的实现
  115. $(".check-all").click(function(){
  116. $(".ids").prop("checked", this.checked);
  117. });
  118. $(".ids").click(function(){
  119. var option = $(".ids");
  120. option.each(function(i){
  121. if(!this.checked){
  122. $(".check-all").prop("checked", false);
  123. return false;
  124. }else{
  125. $(".check-all").prop("checked", true);
  126. }
  127. });
  128. });
  129. </script>
  130. {/block}