index.blade.php 12 KB

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