batchsend.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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. <th>状态</th>
  33. </tr>
  34. </thead>
  35. <tbody class="layer-photos" id="layer-photos">
  36. {foreach ($user_list as $key => $value)}
  37. <tr>
  38. <td><input name="to_user_id[]" type="checkbox" class="ids" value="{$value['id']}"></td>
  39. <td style="cursor: pointer;color: #023894;text-decoration:underline" onclick="oneU('{$value.id}')">{$value['real_name']}</td>
  40. <td>{$value['sex_name']}</td>
  41. <td>{$value['nums']}</td>
  42. <td>{$value['title']}</td>
  43. <td>{$value['addr_time']}</td>
  44. <td>
  45. {if $value['cur_status'] == 1}任务中{/if}
  46. {if $value['cur_status'] == 0}空闲{/if}
  47. </td>
  48. </tr>
  49. {/foreach}
  50. </tbody>
  51. </table>
  52. </div>
  53. </div>
  54. <div class="hr-line-dashed"></div>
  55. <div class="form-group">
  56. <div class="col-sm-6 col-sm-offset-2">
  57. <button class="btn btn-primary ajax-post" data-layer="1" data-reload="1" target-form="form-horizontal" type="submit">确 定</button>
  58. <button class="btn cancel-btn btn-default" type="button">取 消</button>
  59. </div>
  60. </div>
  61. </form>
  62. </div>
  63. </div>
  64. </div>
  65. </div>
  66. {/block}
  67. {block name="script"}
  68. <script>
  69. function oneU(id){
  70. layer.confirm('是否确认选择?', {
  71. btn: ['YES', 'NO'], //按钮
  72. shade: false //不显示遮罩
  73. }, function() {
  74. var url = "{:url('onesend',[],'')}/id/{$id}/mode/{$mode}";
  75. var todo_content = $("#todo_content").val();
  76. console.log(todo_content);
  77. $.post(url,{to_user_id:id,todo_content:todo_content},function (res){
  78. if(res.code==1){
  79. parent.layer.closeAll();
  80. }else {
  81. layer.msg(res.msg);
  82. return;
  83. }
  84. },'json')
  85. }, function() {
  86. parent.layer.closeAll();
  87. });
  88. }
  89. var lists = {:json_encode($user_list)};
  90. function changeSearch(_self) {
  91. var keyword = $(_self).val();
  92. var str = '';
  93. for (let o in lists){
  94. if(keyword){
  95. if(lists[o].real_name.indexOf(keyword) != -1){
  96. str += '<tr>';
  97. str += '<td><input name="to_user_id[]" type="checkbox" class="ids" value="'+lists[o].id+'"></td>';
  98. str += '<td onclick="oneU('+lists[o].id+')">'+lists[o].real_name+'</td>';
  99. str += '<td>'+lists[o].sex_name+'</td>';
  100. str += '<td>'+lists[o].nums+'</td>';
  101. str += '<td>'+lists[o].title+'</td>';
  102. str += '<td>'+lists[o].addr_time+'</td>';
  103. str += '</tr>';
  104. }
  105. }else{
  106. str += '<tr>';
  107. str += '<td><input name="to_user_id[]" type="checkbox" class="ids" value="'+lists[o].id+'"></td>';
  108. str += '<td onclick="oneU('+lists[o].id+')">'+lists[o].real_name+'</td>';
  109. str += '<td>'+lists[o].sex_name+'</td>';
  110. str += '<td>'+lists[o].nums+'</td>';
  111. str += '<td>'+lists[o].title+'</td>';
  112. str += '<td>'+lists[o].addr_time+'</td>';
  113. str += '</tr>';
  114. }
  115. }
  116. $('#layer-photos').html(str);
  117. console.log(keyword);
  118. }
  119. //全选的实现
  120. $(".check-all").click(function(){
  121. $(".ids").prop("checked", this.checked);
  122. });
  123. $(".ids").click(function(){
  124. var option = $(".ids");
  125. option.each(function(i){
  126. if(!this.checked){
  127. $(".check-all").prop("checked", false);
  128. return false;
  129. }else{
  130. $(".check-all").prop("checked", true);
  131. }
  132. });
  133. });
  134. </script>
  135. {/block}