index.blade.php 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. var items = $('.contacts')
  76. $('#checkAll').click(function () {
  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. items.click(function () {
  86. checkedLength = $('.contacts:checked').length
  87. if (checkedLength) {
  88. $('#addCallList').show()
  89. } else {
  90. $('#addCallList').hide()
  91. }
  92. if (items.length == checkedLength) {
  93. $('#addCallList').show()
  94. } else {
  95. $('#checkAll').prop('checked', false)
  96. }
  97. })
  98. /*添加选择的电话到拨打列表*/
  99. $('#addCallList').click(function () {
  100. contact_phones = []
  101. csrf_token = "{{ csrf_token() }}"
  102. $('.contacts:checked').each(function () {
  103. contact_phones.push($(this).val())
  104. })
  105. $.ajax({
  106. type: 'post',
  107. url: '{{ U('Call/Records/addCallList') }}',
  108. data: {contact_phones: contact_phones, _token: csrf_token},
  109. success: function (data) {
  110. if (data == 200) {
  111. layer.msg('导入成功', {
  112. icon: 1,
  113. time: 2000 //2秒关闭(如果不配置,默认是3秒)
  114. }, function () {
  115. window.location.href = window.location.href
  116. });
  117. }
  118. }
  119. })
  120. })
  121. /*通话纪录筛选*/
  122. function filter_records(){
  123. data = $('#filter_records').serialize()
  124. $.ajax({
  125. type: 'get',
  126. data: data,
  127. }).done(function (data) {
  128. $('#records-list').html(data.html)
  129. })
  130. }
  131. /*Ajax分页*/
  132. $('body').on('click', '.pagination a', function (e) {
  133. e.preventDefault();
  134. if ($(this).attr('href') != '#') {
  135. data = $('#filter_records').serialize()
  136. $.ajax({
  137. url: $(this).attr('href'),
  138. type: 'get',
  139. data: data,
  140. }).done(function (data) {
  141. $('#records-list').html(data.html)
  142. })
  143. }
  144. });
  145. </script>
  146. @endsection