| xqd
@@ -15,7 +15,7 @@
|
|
|
<div class="form-group">
|
|
|
<div class="row">
|
|
|
<div class="col-sm-4">
|
|
|
- <form method="GET" action="" accept-charset="UTF-8">
|
|
|
+ <form method="GET" action="" accept-charset="UTF-8" id="filter_list">
|
|
|
<div class="input-group">
|
|
|
<input type="text" class="form-control" value="{{Request::get('keyword')}}"
|
|
|
placeholder="请输入关键词"
|
| xqd
@@ -28,66 +28,183 @@
|
|
|
</form>
|
|
|
</div>
|
|
|
|
|
|
- @if(role('Call/List/create'))
|
|
|
- <div class="col-sm-8 pull-right">
|
|
|
+
|
|
|
+ <div class="col-sm-8 pull-right">
|
|
|
+ @if(role('Call/List/create'))
|
|
|
<a href="{{ U('Call/List/create')}}" class="btn btn-primary pull-right">添加</a>
|
|
|
- </div>
|
|
|
- @endif
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ @endif
|
|
|
|
|
|
- <table class="table table-striped table-bordered table-hover dataTables-example dataTable">
|
|
|
- <thead>
|
|
|
- <tr>
|
|
|
-
|
|
|
- <th class="sorting" data-sort="id"> ID</th>
|
|
|
- <th class="sorting" data-sort="phone"> 电话号码</th>
|
|
|
- <th class="sorting" data-sort="ip"> 拨打IP</th>
|
|
|
- <th class="sorting" data-sort="sync"> 是否同步到拨打列表:</th>
|
|
|
- <th class="sorting" data-sort="created_at"> 添加时间</th>
|
|
|
- <th class="sorting" data-sort="updated_at"> 更新时间</th>
|
|
|
- <th width="22%">相关操作</th>
|
|
|
- </tr>
|
|
|
- </thead>
|
|
|
- <tbody>
|
|
|
- @if(isset($list))
|
|
|
- @foreach($list as $key => $item)
|
|
|
- <tr>
|
|
|
-
|
|
|
- <td>{{ $item->id }}</td>
|
|
|
- <td>{{ $item->phone }}</td>
|
|
|
- <td>{{ $item->ip }}</td>
|
|
|
- <td>{{ dict()->get('call_list','sync',$item->sync) }}</td>
|
|
|
- <td>{{ $item->created_at }}</td>
|
|
|
- <td>{{ $item->updated_at }}</td>
|
|
|
- <td>
|
|
|
- @if(role('Call/List/destroy'))
|
|
|
- <a class="btn btn-sm btn-danger"
|
|
|
- href="{{ U('Call/List/destroy',['id'=>$item->id])}}"
|
|
|
- onclick="return confirm('你确定执行删除操作?');">删除</a>
|
|
|
- @endif
|
|
|
- </td>
|
|
|
- </tr>
|
|
|
- @endforeach
|
|
|
- @endif
|
|
|
-
|
|
|
- </tbody>
|
|
|
- </table>
|
|
|
- <div class="row">
|
|
|
- <div class="col-sm-6">
|
|
|
- <div class="dataTables_info" id="DataTables_Table_0_info"
|
|
|
- role="alert" aria-live="polite" aria-relevant="all">每页{{ $list->count() }}
|
|
|
- 条,共{{ $list->lastPage() }}页,总{{ $list->total() }}条。
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="col-sm-6">
|
|
|
- <div class="dataTables_paginate paging_simple_numbers" id="DataTables_Table_0_paginate">
|
|
|
- {!! $list->setPath('')->appends(Request::all())->render() !!}
|
|
|
+ @if(role('Call/List/alldelete'))
|
|
|
+ <button class="btn btn-danger pull-right" id="alldelete" style="display: none">批量删除</button>
|
|
|
+ @endif
|
|
|
</div>
|
|
|
+
|
|
|
+
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <div id="call-list">
|
|
|
+ @include('admin.call.list.data')
|
|
|
+ </div>
|
|
|
+
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+@endsection
|
|
|
+
|
|
|
+@section('js')
|
|
|
+ <script type="text/javascript">
|
|
|
+ var checkedIds = []
|
|
|
+
|
|
|
+ /*电话全选功能*/
|
|
|
+ $('body').on('click', '#checkAll', function () {
|
|
|
+ items = $('.calllist');
|
|
|
+
|
|
|
+ isChecked = $(this).prop('checked')
|
|
|
+ items.prop('checked', isChecked)
|
|
|
+ items.each(function () {
|
|
|
+ saveChecked($(this))
|
|
|
+ });
|
|
|
+ if (checkedIds.length) {
|
|
|
+ $('#alldelete').show()
|
|
|
+ } else {
|
|
|
+ $('#alldelete').hide()
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+
|
|
|
+ $('body').on('click', '#checkTotal', function () {
|
|
|
+ items = $('.calllist');
|
|
|
+
|
|
|
+ isChecked = $(this).prop('checked')
|
|
|
+ items.prop('checked', isChecked)
|
|
|
+
|
|
|
+ if (isChecked == true) {
|
|
|
+ $('#alldelete').show()
|
|
|
+ checkedIds = [{{ $allIds }}][0]
|
|
|
+ $('#checkAll').prop('checked', true)
|
|
|
+ } else {
|
|
|
+ $('#alldelete').hide()
|
|
|
+ $('#checkAll').prop('checked', false)
|
|
|
+ checkedIds = []
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ $('body').on('click', '.calllist', function () {
|
|
|
+ items = $('.calllist');
|
|
|
+
|
|
|
+ checkedLength = $('.calllist:checked').length
|
|
|
+ if (checkedLength) {
|
|
|
+ $('#alldelete').show()
|
|
|
+ } else {
|
|
|
+ $('#alldelete').hide()
|
|
|
+ }
|
|
|
+ if (items.length == checkedLength) {
|
|
|
+ $('#checkAll').prop('checked', true)
|
|
|
+ $('#alldelete').show()
|
|
|
+ } else {
|
|
|
+ $('#checkAll').prop('checked', false)
|
|
|
+ }
|
|
|
+
|
|
|
+ saveChecked($(this))
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ /*批量删除*/
|
|
|
+ $('#alldelete').click(function () {
|
|
|
+ layer.confirm('你确定要删除选择的待导入电话吗?', {
|
|
|
+ btn: ['确定', '取消']//按钮
|
|
|
+ }, function (index) {
|
|
|
+
|
|
|
+ layer.close(index);
|
|
|
+ list_ids = checkedIds;
|
|
|
+ csrf_token = "{{ csrf_token() }}";
|
|
|
+
|
|
|
+ $.ajax({
|
|
|
+ type: 'post',
|
|
|
+ url: '{{ U('Call/list/alldelete') }}',
|
|
|
+ data: {list_ids: list_ids, _token: csrf_token},
|
|
|
+ success: function (data) {
|
|
|
+ if (data == 200) {
|
|
|
+ layer.msg('删除成功', {
|
|
|
+ icon: 1,
|
|
|
+ time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
|
|
+ }, function () {
|
|
|
+ window.location.href = window.location.href
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ /*保存选中的项*/
|
|
|
+ function saveChecked(e) {
|
|
|
+ if (e.is(":checked") && checkedIds.indexOf(e.data("id"), 0) == -1) {
|
|
|
+ checkedIds.push(e.data("id"));
|
|
|
+ } else {
|
|
|
+ for (var i = 0; i < checkedIds.length; i++) {
|
|
|
+ if (e.data("id") == checkedIds[i]) {
|
|
|
+ checkedIds.splice(i, 1);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /*翻页后设置选中项*/
|
|
|
+ function setChecked() {
|
|
|
+ var $boxes = $('.calllist');
|
|
|
+ $boxes.each(function () {
|
|
|
+ id = $(this).data('id')
|
|
|
+ if (checkedIds.indexOf(id, 0) != -1) {
|
|
|
+ $(this).prop('checked', true)
|
|
|
+ } else {
|
|
|
+ $(this).prop('checked', false)
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ checkedLength = $('.calllist:checked').length
|
|
|
+ if (checkedLength == $boxes.length) {
|
|
|
+ $('#checkAll').prop('checked', true)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /*通话纪录筛选*/
|
|
|
+ function filter_records() {
|
|
|
+ data = $('#filter_list').serialize();
|
|
|
+ $.ajax({
|
|
|
+ type: 'get',
|
|
|
+ data: data,
|
|
|
+ }).done(function (data) {
|
|
|
+ $('#call-list').html(data.html)
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /*Ajax分页*/
|
|
|
+ $('body').on('click', '.pagination a', function (e) {
|
|
|
+ e.preventDefault();
|
|
|
+ if ($(this).attr('href') != '#') {
|
|
|
+ data = $('#filter_list').serialize()
|
|
|
+ $.ajax({
|
|
|
+ url: $(this).attr('href'),
|
|
|
+ type: 'get',
|
|
|
+ data: data,
|
|
|
+ }).done(function (data) {
|
|
|
+ $('#call-list').html(data.html)
|
|
|
+ setChecked()
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ </script>
|
|
|
@endsection
|