index.blade.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. @extends('admin.layouts.app')
  2. @section('content')
  3. <div class="row">
  4. <div class="col-sm-12">
  5. <div class="ibox float-e-margins">
  6. <div class="ibox-title">
  7. <h5>通话纪录</h5>
  8. <div class="ibox-tools">
  9. <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
  10. </a>
  11. </div>
  12. </div>
  13. <div class="ibox-content">
  14. <div class="form-group">
  15. @if(role('Call/List/syncAdd'))
  16. <div class="col-sm-8 pull-right">
  17. <span class="btn btn-primary pull-right fa fa-phone" data-toggle="modal"
  18. data-target="#myModal2" style="display: none">添加到待导列表</span>
  19. </div>
  20. @endif
  21. {{--@if(role('Call/Records/create'))--}}
  22. {{--<div class="col-sm-8 pull-right">--}}
  23. {{--<a href="{{ U('Call/Records/create')}}" class="btn btn-primary pull-right">添加</a>--}}
  24. {{--</div>--}}
  25. {{--@endif--}}
  26. </div>
  27. </div>
  28. {{-- 过滤条件 --}}
  29. <div class="col-xl-12" style="padding: 5px">
  30. <form method="GET" action="" accept-charset="UTF-8" id="filter_records">
  31. {{ csrf_field() }}
  32. <div class="row">
  33. <div class="col-sm-1" style="font-weight: 500;text-align: right;color: #999;">
  34. <h4>过滤条件:</h4>
  35. </div>
  36. <div class="col-sm-2">
  37. <select name="ip" class="form-control" onchange="filter_records()">
  38. <option value="">拨打IP</option>
  39. <option value="172.31.20.181">172.31.20.181</option>
  40. <option value="172.31.20.182">172.31.20.182</option>
  41. <option value="172.31.20.183">172.31.20.183</option>
  42. <option value="172.31.20.184">172.31.20.184</option>
  43. <option value="172.31.20.185">172.31.20.185</option>
  44. <option value="172.31.20.186">172.31.20.186</option>
  45. <option value="172.31.20.187">172.31.20.187</option>
  46. <option value="172.31.20.188">172.31.20.188</option>
  47. </select>
  48. </div>
  49. <div class="col-sm-2">
  50. <select name="term_status" class="form-control" onchange="filter_records()">
  51. <option value="">接听状态</option>
  52. <option value="200">已接通</option>
  53. <option value="408">未接通</option>
  54. </select>
  55. </div>
  56. <div class="col-sm-2" id="data_1">
  57. <div class="input-group date">
  58. <span class="input-group-addon">
  59. <i class="fa fa-calendar"></i></span>
  60. <input type="text" id="start" class="form-control" placeholder="开始日期" name="start"
  61. value="{{Request::get('start') ? : ''}}">
  62. </div>
  63. </div>
  64. <div class="col-sm-2" id="data_2">
  65. <div class="input-group date">
  66. <span class="input-group-addon">
  67. <i class="fa fa-calendar"></i></span>
  68. <input type="text" id="end" class="form-control" placeholder="结束日期" name="end"
  69. value="{{Request::get('end') ? : ''}}">
  70. </div>
  71. </div>
  72. <div class="col-sm-2">
  73. <div class="input-group">
  74. <input type="text" class="form-control" value="{{Request::get('phone')}}"
  75. placeholder="请输入电话号码或标签"
  76. name="phone">
  77. <span class="input-group-append">
  78. <button type="button" class="btn btn-sm btn-default"
  79. onclick="filter_records()">搜索</button>
  80. </span>
  81. </div>
  82. </div>
  83. </div>
  84. </form>
  85. </div>
  86. <div id="records-list">
  87. @include('admin.call.records.data')
  88. </div>
  89. </div>
  90. </div>
  91. <div class="modal inmodal" id="myModal2" tabindex="-1" role="dialog" aria-hidden="true">
  92. <div class="modal-dialog">
  93. <div class="modal-content animated flipInY">
  94. <div class="modal-header">
  95. <h4 class="modal-title">选择拨打的IP</h4></div>
  96. <small class="font-bold">
  97. <div class="modal-body">
  98. <div class="ibox float-e-margins">
  99. <div class="ibox-content">
  100. <select name="ip" class="form-control" id="ip">
  101. <option value="172.31.20.181">172.31.20.181</option>
  102. <option value="172.31.20.182">172.31.20.182</option>
  103. <option value="172.31.20.183">172.31.20.183</option>
  104. <option value="172.31.20.184">172.31.20.184</option>
  105. <option value="172.31.20.185">172.31.20.185</option>
  106. <option value="172.31.20.186">172.31.20.186</option>
  107. <option value="172.31.20.187">172.31.20.187</option>
  108. <option value="172.31.20.188">172.31.20.188</option>
  109. </select>
  110. <div class="form-group">
  111. <label class="control-label col-sm-3">&nbsp;</label>
  112. <div class="col-sm-9">
  113. <input type="submit" class="btn btn-success" style="margin-right:20px;"
  114. id="addCallList">
  115. <input type="reset" class="btn btn-default">
  116. </div>
  117. </div>
  118. </div>
  119. </div>
  120. </div>
  121. <div class="modal-footer">
  122. <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
  123. </div>
  124. </small>
  125. </div>
  126. <small class="font-bold">
  127. </small>
  128. </div>
  129. <small class="font-bold">
  130. </small>
  131. </div>
  132. </div>
  133. @endsection
  134. @section('js')
  135. <script type="text/javascript">
  136. var checkedIds = []
  137. /*电话全选功能*/
  138. $('body').on('click', '#checkAll', function () {
  139. items = $('.contacts');
  140. isChecked = $(this).prop('checked')
  141. items.prop('checked', isChecked)
  142. items.each(function () {
  143. saveChecked($(this))
  144. });
  145. if (checkedIds.length) {
  146. $('.fa-phone').show()
  147. } else {
  148. $('.fa-phone').hide()
  149. }
  150. })
  151. $('body').on('click', '#checkTotal', function () {
  152. items = $('.contacts');
  153. isChecked = $(this).prop('checked')
  154. items.prop('checked', isChecked)
  155. if (isChecked == true) {
  156. $('.fa-phone').show()
  157. checkedIds = [{{ $allIds }}][0]
  158. $('#checkAll').prop('checked', true)
  159. } else {
  160. $('.fa-phone').hide()
  161. $('#checkAll').prop('checked', false)
  162. checkedIds = []
  163. }
  164. })
  165. $('body').on('click', '.contacts', function () {
  166. items = $('.contacts');
  167. checkedLength = $('.contacts:checked').length
  168. if (checkedLength) {
  169. $('.fa-phone').show()
  170. } else {
  171. $('.fa-phone').hide()
  172. }
  173. if (items.length == checkedLength) {
  174. $('#checkAll').prop('checked', true)
  175. $('.fa-phone').show()
  176. } else {
  177. $('#checkAll').prop('checked', false)
  178. }
  179. saveChecked($(this))
  180. });
  181. /*添加选择的电话到拨打列表*/
  182. $('#addCallList').click(function () {
  183. contact_phones = checkedIds;
  184. csrf_token = "{{ csrf_token() }}";
  185. ip = $('#ip').val()
  186. $.ajax({
  187. type: 'post',
  188. url: '{{ U('Call/List/syncAdd') }}',
  189. data: {_token: csrf_token, ip: ip,contact_phones: contact_phones},
  190. success: function (data) {
  191. if (data == 200) {
  192. layer.msg('导入成功', {
  193. icon: 1,
  194. time: 2000 //2秒关闭(如果不配置,默认是3秒)
  195. }, function () {
  196. window.location.href = window.location.href
  197. });
  198. }
  199. }
  200. })
  201. });
  202. /*保存选中的项*/
  203. function saveChecked(e) {
  204. if (e.is(":checked") && checkedIds.indexOf(e.data("id"), 0) == -1) {
  205. checkedIds.push(e.data("id"));
  206. } else {
  207. for (var i = 0; i < checkedIds.length; i++) {
  208. if (e.data("id") == checkedIds[i]) {
  209. checkedIds.splice(i, 1);
  210. break;
  211. }
  212. }
  213. }
  214. }
  215. /*翻页后设置选中项*/
  216. function setChecked() {
  217. var $boxes = $('.contacts');
  218. $boxes.each(function () {
  219. id = $(this).data('id')
  220. if (checkedIds.indexOf(id, 0) != -1) {
  221. $(this).prop('checked', true)
  222. } else {
  223. $(this).prop('checked', false)
  224. }
  225. })
  226. checkedLength = $('.contacts:checked').length
  227. if (checkedLength == $boxes.length) {
  228. $('#checkAll').prop('checked', true)
  229. }
  230. }
  231. /*通话纪录筛选*/
  232. function filter_records() {
  233. console.log(1)
  234. data = $('#filter_records').serialize();
  235. $.ajax({
  236. type: 'get',
  237. data: data,
  238. }).done(function (data) {
  239. $('#records-list').html(data.html)
  240. })
  241. }
  242. /*Ajax分页*/
  243. $('body').on('click', '.pagination a', function (e) {
  244. e.preventDefault();
  245. if ($(this).attr('href') != '#') {
  246. data = $('#filter_records').serialize()
  247. $.ajax({
  248. url: $(this).attr('href'),
  249. type: 'get',
  250. data: data,
  251. }).done(function (data) {
  252. $('#records-list').html(data.html)
  253. setChecked()
  254. })
  255. }
  256. });
  257. </script>
  258. @endsection