index.blade.php 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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 id="addCallList" class="btn btn-primary pull-right fa fa-phone"
  18. 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. <table class="table table-striped table-bordered table-hover dataTables-example dataTable">
  30. <tr>
  31. <th> 过滤条件</th>
  32. <form method="GET" action="" accept-charset="UTF-8" id="filter_records">
  33. <th>
  34. <select name="ip" class="form-control" onchange="filter_records()">
  35. <option value="">拨打IP</option>
  36. <option value="172.31.20.133">172.31.20.133</option>
  37. <option value="172.31.20.134">172.31.20.134</option>
  38. <option value="172.31.20.135">172.31.20.135</option>
  39. <option value="172.31.20.136">172.31.20.136</option>
  40. <option value="172.31.20.137">172.31.20.137</option>
  41. </select>
  42. </th>
  43. <th>
  44. <select name="term_status" class="form-control" onchange="filter_records()">
  45. <option value="">接听状态</option>
  46. <option value="200">已接通</option>
  47. <option value="408">未接通</option>
  48. </select>
  49. </th>
  50. <th>
  51. <div class="input-group">
  52. <input type="text" class="form-control" value="{{Request::get('phone')}}"
  53. placeholder="请输入电话号码"
  54. name="phone">
  55. <span class="input-group-append">
  56. <span class="btn btn-sm btn-default"
  57. style="height: 100%" onclick="filter_records()">搜索</span>
  58. </span>
  59. </div>
  60. </th>
  61. </form>
  62. </tr>
  63. </table>
  64. <div id="records-list">
  65. @include('admin.call.records.data')
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. @endsection
  72. @section('js')
  73. <script type="text/javascript">
  74. /*电话全选功能*/
  75. $('body').on('click', '#checkAll', function () {
  76. items = $('.contacts');
  77. isChecked = $(this).prop('checked')
  78. items.prop('checked', isChecked)
  79. if (isChecked == true) {
  80. $('#addCallList').show()
  81. } else {
  82. $('#addCallList').hide()
  83. }
  84. })
  85. $('body').on('click','.contacts',function () {
  86. items = $('.contacts');
  87. checkedLength = $('.contacts:checked').length
  88. if (checkedLength) {
  89. $('#addCallList').show()
  90. } else {
  91. $('#addCallList').hide()
  92. }
  93. if (items.length == checkedLength) {
  94. $('#addCallList').show()
  95. } else {
  96. $('#checkAll').prop('checked', false)
  97. }
  98. })
  99. /*添加选择的电话到拨打列表*/
  100. $('#addCallList').click(function () {
  101. contact_phones = [];
  102. csrf_token = "{{ csrf_token() }}";
  103. $('.contacts:checked').each(function () {
  104. contact_phones.push($(this).val())
  105. });
  106. $.ajax({
  107. type: 'post',
  108. url: '{{ U('Call/Records/addCallList') }}',
  109. data: {contact_phones: contact_phones, _token: csrf_token},
  110. success: function (data) {
  111. if (data == 200) {
  112. layer.msg('导入成功', {
  113. icon: 1,
  114. time: 2000 //2秒关闭(如果不配置,默认是3秒)
  115. }, function () {
  116. window.location.href = window.location.href
  117. });
  118. }
  119. }
  120. })
  121. });
  122. /*导出通话纪录到excel*/
  123. {{--$('#export_call').click(function () {--}}
  124. {{--call_ids = [];--}}
  125. {{--csrf_token = "{{ csrf_token() }}";--}}
  126. {{--$('.contacts:checked').each(function () {--}}
  127. {{--call_ids.push($(this).val())--}}
  128. {{--});--}}
  129. {{--$.ajax({--}}
  130. {{--type: 'post',--}}
  131. {{--url: '{{ U('Call/Records/export_call') }}',--}}
  132. {{--data: {call_ids: call_ids, _token: csrf_token},--}}
  133. {{--success: function (data) {--}}
  134. {{--if (data == 200) {--}}
  135. {{--layer.msg('导入成功', {--}}
  136. {{--icon: 1,--}}
  137. {{--time: 2000 //2秒关闭(如果不配置,默认是3秒)--}}
  138. {{--}, function () {--}}
  139. {{--window.location.href = window.location.href--}}
  140. {{--});--}}
  141. {{--}--}}
  142. {{--}--}}
  143. {{--})--}}
  144. {{--});--}}
  145. /*通话纪录筛选*/
  146. function filter_records() {
  147. data = $('#filter_records').serialize();
  148. $.ajax({
  149. type: 'get',
  150. data: data,
  151. }).done(function (data) {
  152. $('#records-list').html(data.html)
  153. })
  154. }
  155. /*Ajax分页*/
  156. $('body').on('click', '.pagination a', function (e) {
  157. e.preventDefault();
  158. if ($(this).attr('href') != '#') {
  159. data = $('#filter_records').serialize()
  160. $.ajax({
  161. url: $(this).attr('href'),
  162. type: 'get',
  163. data: data,
  164. }).done(function (data) {
  165. $('#records-list').html(data.html)
  166. })
  167. }
  168. });
  169. </script>
  170. @endsection