index.blade.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  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/List/syncAdd'))
  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.181">172.31.20.181</option>
  40. <option value="172.31.20.182">172.31.20.182</option>
  41. <option value="172.31.20.183">172.31.20.183</option>
  42. <option value="172.31.20.184">172.31.20.184</option>
  43. <option value="172.31.20.185">172.31.20.185</option>
  44. <option value="172.31.20.186">172.31.20.186</option>
  45. <option value="172.31.20.187">172.31.20.187</option>
  46. <option value="172.31.20.188">172.31.20.188</option>
  47. </select>
  48. </div>
  49. <div class="col-sm-2">
  50. <select name="term_status" class="form-control" onchange="filter_records()">
  51. <option value="">接听状态</option>
  52. <option value="200">已接通</option>
  53. <option value="408">未接通</option>
  54. </select>
  55. </div>
  56. <div class="col-sm-2" id="data_1">
  57. <div class="input-group date">
  58. <span class="input-group-addon">
  59. <i class="fa fa-calendar"></i></span>
  60. <input type="text" id="start" class="form-control" placeholder="开始日期" name="start"
  61. value="{{Request::get('start') ? : ''}}">
  62. </div>
  63. </div>
  64. <div class="col-sm-2" id="data_2">
  65. <div class="input-group date">
  66. <span class="input-group-addon">
  67. <i class="fa fa-calendar"></i></span>
  68. <input type="text" id="end" class="form-control" placeholder="结束日期" name="end"
  69. value="{{Request::get('end') ? : ''}}">
  70. </div>
  71. </div>
  72. <div class="col-sm-2">
  73. <div class="input-group">
  74. <input type="text" class="form-control" value="{{Request::get('phone')}}"
  75. placeholder="请输入电话号码或标签"
  76. name="phone">
  77. <span class="input-group-append">
  78. <button type="button" class="btn btn-sm btn-default"
  79. onclick="filter_records()">搜索</button>
  80. </span>
  81. </div>
  82. </div>
  83. </div>
  84. </form>
  85. </div>
  86. <div id="records-list">
  87. @include('admin.call.records.data')
  88. </div>
  89. </div>
  90. </div>
  91. <div class="modal inmodal" id="myModal2" tabindex="-1" role="dialog" aria-hidden="true">
  92. <div class="modal-dialog">
  93. <div class="modal-content animated flipInY">
  94. <div class="modal-header">
  95. <h4 class="modal-title">添加到待导列表</h4></div>
  96. <small class="font-bold">
  97. <div class="modal-body">
  98. <div class="ibox float-e-margins">
  99. <div class="ibox-content">
  100. <div class="form-group">
  101. <label>&nbsp;标签</label>
  102. <div class="col-sm-9">
  103. <input type="text" name="label" id="calllist_label" class="form-control">
  104. </div>
  105. </div>
  106. <div class="form-group">
  107. <label>&nbsp;拨打IP:</label>
  108. <select name="ip" class="form-control" id="ip">
  109. <option value="172.31.20.181">172.31.20.181</option>
  110. <option value="172.31.20.182">172.31.20.182</option>
  111. <option value="172.31.20.183">172.31.20.183</option>
  112. <option value="172.31.20.184">172.31.20.184</option>
  113. <option value="172.31.20.185">172.31.20.185</option>
  114. <option value="172.31.20.186">172.31.20.186</option>
  115. <option value="172.31.20.187">172.31.20.187</option>
  116. <option value="172.31.20.188">172.31.20.188</option>
  117. </select>
  118. </div>
  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. label = $('#calllist_label').val()
  196. $.ajax({
  197. type: 'post',
  198. url: '{{ U('Call/List/syncAdd') }}',
  199. data: {_token: csrf_token, ip: ip,contact_phones: contact_phones,label:label},
  200. success: function (data) {
  201. if (data == 200) {
  202. layer.msg('导入成功', {
  203. icon: 1,
  204. time: 2000 //2秒关闭(如果不配置,默认是3秒)
  205. }, function () {
  206. window.location.href = window.location.href
  207. });
  208. }
  209. }
  210. })
  211. });
  212. /*保存选中的项*/
  213. function saveChecked(e) {
  214. if (e.is(":checked") && checkedIds.indexOf(e.data("id"), 0) == -1) {
  215. checkedIds.push(e.data("id"));
  216. } else {
  217. for (var i = 0; i < checkedIds.length; i++) {
  218. if (e.data("id") == checkedIds[i]) {
  219. checkedIds.splice(i, 1);
  220. break;
  221. }
  222. }
  223. }
  224. }
  225. /*翻页后设置选中项*/
  226. function setChecked() {
  227. var $boxes = $('.contacts');
  228. $boxes.each(function () {
  229. id = $(this).data('id')
  230. if (checkedIds.indexOf(id, 0) != -1) {
  231. $(this).prop('checked', true)
  232. } else {
  233. $(this).prop('checked', false)
  234. }
  235. })
  236. checkedLength = $('.contacts:checked').length
  237. if (checkedLength == $boxes.length) {
  238. $('#checkAll').prop('checked', true)
  239. }
  240. }
  241. /*通话纪录筛选*/
  242. function filter_records() {
  243. console.log(1)
  244. data = $('#filter_records').serialize();
  245. $.ajax({
  246. type: 'get',
  247. data: data,
  248. }).done(function (data) {
  249. $('#records-list').html(data.html)
  250. })
  251. }
  252. /*Ajax分页*/
  253. $('body').on('click', '.pagination a', function (e) {
  254. e.preventDefault();
  255. if ($(this).attr('href') != '#') {
  256. data = $('#filter_records').serialize()
  257. $.ajax({
  258. url: $(this).attr('href'),
  259. type: 'get',
  260. data: data,
  261. }).done(function (data) {
  262. $('#records-list').html(data.html)
  263. setChecked()
  264. })
  265. }
  266. });
  267. </script>
  268. @endsection