index.blade.php 7.6 KB

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