index.blade.php 12 KB

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