index.blade.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  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/Records/addCallList'))
  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. {{--<table class="table table-striped table-bordered table-hover dataTables-example dataTable">--}}
  87. {{--<tr>--}}
  88. {{--<th> 过滤条件</th>--}}
  89. {{--<form method="GET" action="" accept-charset="UTF-8" id="filter_records">--}}
  90. {{--<th>--}}
  91. {{--</th>--}}
  92. {{--<th>--}}
  93. {{--</th>--}}
  94. {{--<th>--}}
  95. {{--</th>--}}
  96. {{--<th>--}}
  97. {{--</th>--}}
  98. {{--</form>--}}
  99. {{--</tr>--}}
  100. {{--</table>--}}
  101. <div id="records-list">
  102. @include('admin.call.records.data')
  103. </div>
  104. </div>
  105. </div>
  106. <div class="modal inmodal" id="myModal2" tabindex="-1" role="dialog" aria-hidden="true">
  107. <div class="modal-dialog">
  108. <div class="modal-content animated flipInY">
  109. <div class="modal-header">
  110. <h4 class="modal-title">选择拨打的IP</h4></div>
  111. <small class="font-bold">
  112. <div class="modal-body">
  113. <div class="ibox float-e-margins">
  114. <div class="ibox-content">
  115. <select name="ip" class="form-control" id="ip">
  116. <option value="172.31.20.181">172.31.20.181</option>
  117. <option value="172.31.20.182">172.31.20.182</option>
  118. <option value="172.31.20.183">172.31.20.183</option>
  119. <option value="172.31.20.184">172.31.20.184</option>
  120. <option value="172.31.20.185">172.31.20.185</option>
  121. <option value="172.31.20.186">172.31.20.186</option>
  122. <option value="172.31.20.187">172.31.20.187</option>
  123. <option value="172.31.20.188">172.31.20.188</option>
  124. </select>
  125. <div class="form-group">
  126. <label class="control-label col-sm-3">&nbsp;</label>
  127. <div class="col-sm-9">
  128. <input type="submit" class="btn btn-success" style="margin-right:20px;"
  129. id="addCallList">
  130. <input type="reset" class="btn btn-default">
  131. </div>
  132. </div>
  133. </div>
  134. </div>
  135. </div>
  136. <div class="modal-footer">
  137. <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
  138. </div>
  139. </small>
  140. </div>
  141. <small class="font-bold">
  142. </small>
  143. </div>
  144. <small class="font-bold">
  145. </small>
  146. </div>
  147. </div>
  148. @endsection
  149. @section('js')
  150. <script type="text/javascript">
  151. var checkedIds = []
  152. /*电话全选功能*/
  153. $('body').on('click', '#checkAll', function () {
  154. items = $('.contacts');
  155. isChecked = $(this).prop('checked')
  156. items.prop('checked', isChecked)
  157. items.each(function () {
  158. saveChecked($(this))
  159. });
  160. if (checkedIds.length) {
  161. $('.fa-phone').show()
  162. } else {
  163. $('.fa-phone').hide()
  164. }
  165. })
  166. $('body').on('click', '#checkTotal', function () {
  167. items = $('.contacts');
  168. isChecked = $(this).prop('checked')
  169. items.prop('checked', isChecked)
  170. if (isChecked == true) {
  171. $('.fa-phone').show()
  172. checkedIds = [{{ $allIds }}][0]
  173. $('#checkAll').prop('checked', true)
  174. } else {
  175. $('.fa-phone').hide()
  176. $('#checkAll').prop('checked', false)
  177. checkedIds = []
  178. }
  179. })
  180. $('body').on('click', '.contacts', function () {
  181. items = $('.contacts');
  182. checkedLength = $('.contacts:checked').length
  183. if (checkedLength) {
  184. $('.fa-phone').show()
  185. } else {
  186. $('.fa-phone').hide()
  187. }
  188. if (items.length == checkedLength) {
  189. $('#checkAll').prop('checked', true)
  190. $('.fa-phone').show()
  191. } else {
  192. $('#checkAll').prop('checked', false)
  193. }
  194. saveChecked($(this))
  195. });
  196. /*添加选择的电话到拨打列表*/
  197. $('#addCallList').click(function () {
  198. contact_phones = checkedIds;
  199. csrf_token = "{{ csrf_token() }}";
  200. ip = $('#ip').val()
  201. $.ajax({
  202. type: 'post',
  203. url: '{{ U('Call/Records/addCallList') }}',
  204. data: {_token: csrf_token, ip: ip,contact_phones: contact_phones},
  205. success: function (data) {
  206. if (data == 200) {
  207. layer.msg('导入成功', {
  208. icon: 1,
  209. time: 2000 //2秒关闭(如果不配置,默认是3秒)
  210. }, function () {
  211. window.location.href = window.location.href
  212. });
  213. }
  214. }
  215. })
  216. });
  217. /*保存选中的项*/
  218. function saveChecked(e) {
  219. if (e.is(":checked") && checkedIds.indexOf(e.data("id"), 0) == -1) {
  220. checkedIds.push(e.data("id"));
  221. } else {
  222. for (var i = 0; i < checkedIds.length; i++) {
  223. if (e.data("id") == checkedIds[i]) {
  224. checkedIds.splice(i, 1);
  225. break;
  226. }
  227. }
  228. }
  229. }
  230. /*翻页后设置选中项*/
  231. function setChecked() {
  232. var $boxes = $('.contacts');
  233. $boxes.each(function () {
  234. id = $(this).data('id')
  235. if (checkedIds.indexOf(id, 0) != -1) {
  236. $(this).prop('checked', true)
  237. } else {
  238. $(this).prop('checked', false)
  239. }
  240. })
  241. checkedLength = $('.contacts:checked').length
  242. if (checkedLength == $boxes.length) {
  243. $('#checkAll').prop('checked', true)
  244. }
  245. }
  246. /*通话纪录筛选*/
  247. function filter_records() {
  248. console.log(1)
  249. data = $('#filter_records').serialize();
  250. $.ajax({
  251. type: 'get',
  252. data: data,
  253. }).done(function (data) {
  254. $('#records-list').html(data.html)
  255. })
  256. }
  257. /*Ajax分页*/
  258. $('body').on('click', '.pagination a', function (e) {
  259. e.preventDefault();
  260. if ($(this).attr('href') != '#') {
  261. data = $('#filter_records').serialize()
  262. $.ajax({
  263. url: $(this).attr('href'),
  264. type: 'get',
  265. data: data,
  266. }).done(function (data) {
  267. $('#records-list').html(data.html)
  268. setChecked()
  269. })
  270. }
  271. });
  272. </script>
  273. @endsection