123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473 |
- @extends('admin.layouts.app')
- @section('header')
- <script src="/base/js/plugins/fileDownload/jquery.fileDownload.js"></script>
- @endsection
- @section('content')
- <div class="row">
- <div class="col-sm-12">
- <div class="ibox float-e-margins">
- <div class="ibox-title">
- <h5>我的线索</h5>
- <div class="ibox-tools">
- <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
- </a>
- </div>
- </div>
- <div class="ibox-content">
- <div class="form-group">
- <div class="col-sm-8 pull-right">
- <span class="btn btn-primary pull-right fa fa-phone"
- data-toggle="modal"
- data-target="#myModal2" style="display: none">添加到待导列表</span>
- <span class="btn btn-success pull-right fa fa-table"
- style="display: none" data-toggle="modal"
- data-target="#myModal1">导出到Excel</span>
- </div>
- </div>
- </div>
- {{--添加过滤条件--}}
- <table class="table table-striped table-bordered table-hover dataTables-example dataTable">
- <tr>
- <th> 过滤条件</th>
- <form method="GET" action="" accept-charset="UTF-8" id="filter_threads">
- <th>
- <select name="process" class="form-control" onchange="filter_threads()">
- <option value="">有无跟进</option>
- <option value="1">有</option>
- <option value="2">无</option>
- </select>
- </th>
- <th>
- <div class="input-group">
- <input type="text" class="form-control" value="{{Request::get('keyword')}}"
- placeholder="请输入企业名称或电话"
- name="keyword">
- <span class="input-group-append">
- <button type="button" class="btn btn-sm btn-default"
- onclick="filter_threads()">搜索</button>
- </span>
- </div>
- </th>
- </form>
- </tr>
- </table>
- <div id="threads-list">
- @include('admin.user.threads.data')
- </div>
- </div>
- </div>
- <div class="modal inmodal" id="myModal2" tabindex="-1" role="dialog" aria-hidden="true">
- <div class="modal-dialog">
- <div class="modal-content animated flipInY">
- <div class="modal-header">
- <h4 class="modal-title">添加到待导列表</h4></div>
- <small class="font-bold">
- <div class="modal-body">
- <div class="ibox float-e-margins">
- <div class="ibox-content">
- <div class="form-group">
- <label> 标签</label>
- <div class="col-sm-9">
- <input type="text" name="label" id="calllist_label" class="form-control">
- </div>
- </div>
- <div class="form-group">
- <label> 拨打IP:</label>
- <select name="ip" class="form-control" id="ip">
- <option value="172.31.20.181">172.31.20.181</option>
- <option value="172.31.20.182">172.31.20.182</option>
- <option value="172.31.20.183">172.31.20.183</option>
- <option value="172.31.20.184">172.31.20.184</option>
- <option value="172.31.20.185">172.31.20.185</option>
- <option value="172.31.20.186">172.31.20.186</option>
- <option value="172.31.20.187">172.31.20.187</option>
- <option value="172.31.20.188">172.31.20.188</option>
- </select>
- </div>
- <div class="form-group">
- <label class="control-label col-sm-3"> </label>
- <div class="col-sm-9">
- <input type="submit" class="btn btn-success" style="margin-right:20px;"
- id="addCallList">
- <input type="reset" class="btn btn-default">
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
- </div>
- </small>
- </div>
- <small class="font-bold">
- </small>
- </div>
- <small class="font-bold">
- </small>
- </div>
- <div class="modal inmodal" id="myModal1" tabindex="-1" role="dialog" aria-hidden="true">
- <div class="modal-dialog">
- <div class="modal-content animated flipInY">
- <div class="modal-header">
- <h4 class="modal-title">选择要导出的字段</h4></div>
- <small class="font-bold">
- <div class="modal-body">
- <div class="ibox float-e-margins">
- <div class="ibox-content">
- <div class="form-group">
- <form action="" id="check-fields">
- <div class="row">
- <div class="col-sm-6">
- <h4 style="color: #ccc">联系方式:</h4>
- </div>
- </div>
- <div class="row">
- <div class="col-sm-3">
- <div class="checkbox checkbox-success">
- <input class="check-fields" type="checkbox" checked="checked"
- name="phone" disabled>
- <label>
- 电话
- </label>
- </div>
- </div>
- <div class="col-sm-3">
- <div class="checkbox checkbox-success">
- <input class="check-fields" type="checkbox" checked="checked"
- name="email">
- <label>
- Email
- </label>
- </div>
- </div>
- <div class="col-sm-3">
- <div class="checkbox checkbox-success">
- <input class="check-fields" type="checkbox" checked="checked"
- name="qq">
- <label>
- qq
- </label>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-sm-6">
- <h4 style="color: #ccc">其他字段:</h4>
- </div>
- </div>
- <div class="row">
- <div class="col-sm-3">
- <div class="checkbox checkbox-success">
- <input class="check-fields" type="checkbox" checked="checked"
- name="company_name" disabled>
- <label>
- 企业名称
- </label>
- </div>
- </div>
- <div class="col-sm-3">
- <div class="checkbox checkbox-success">
- <input class="check-fields" type="checkbox" checked="checked"
- name="ower_name">
- <label>
- 线索拥有者
- </label>
- </div>
- </div>
- <div class="col-sm-3">
- <div class="checkbox checkbox-success">
- <input class="check-fields" type="checkbox" checked="checked"
- name="website">
- <label>
- 企业网址
- </label>
- </div>
- </div>
- <div class="col-sm-3">
- <div class="checkbox checkbox-success">
- <input class="check-fields" type="checkbox" checked="checked"
- name="legal_person">
- <label>
- 法人
- </label>
- </div>
- </div>
- <div class="col-sm-3">
- <div class="checkbox checkbox-success">
- <input class="check-fields" type="checkbox" checked="checked"
- name="reg_capital">
- <label>
- 注册资本
- </label>
- </div>
- </div>
- <div class="col-sm-3">
- <div class="checkbox checkbox-success">
- <input class="check-fields" type="checkbox" checked="checked"
- name="reg_addr">
- <label>
- 注册地址
- </label>
- </div>
- </div>
- <div class="col-sm-3">
- <div class="checkbox checkbox-success">
- <input class="check-fields" type="checkbox" checked="checked"
- name="lastest">
- <label>
- 最新跟进
- </label>
- </div>
- </div>
- <div class="col-sm-3">
- <div class="checkbox checkbox-success">
- <input class="check-fields" type="checkbox" checked="checked"
- name="created_at">
- <label>
- 领取时间
- </label>
- </div>
- </div>
- </div>
- </form>
- </div>
- <div class="form-group">
- <label class="control-label col-sm-3"> </label>
- <div class="col-sm-9">
- <input type="submit" class="btn btn-success" style="margin-right:20px;"
- id="export_threads">
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
- </div>
- </small>
- </div>
- <small class="font-bold">
- </small>
- </div>
- <small class="font-bold">
- </small>
- </div>
- </div>
- @endsection
- @section('js')
- <script type="text/javascript">
- var checkedIds = []
- /*电话全选功能*/
- $('body').on('click', '#checkAll', function () {
- items = $('.contacts');
- isChecked = $(this).prop('checked');
- items.prop('checked', isChecked);
- items.each(function () {
- saveChecked($(this))
- });
- if (checkedIds.length) {
- $('.fa-phone').show()
- $('.fa-table').show()
- } else {
- $('.fa-phone').hide()
- $('.fa-table').hide()
- }
- });
- $('body').on('click', '#checkTotal', function () {
- items = $('.contacts');
- isChecked = $(this).prop('checked')
- items.prop('checked', isChecked)
- if (isChecked == true) {
- $('.fa-phone').show()
- checkedIds = [{{ $allIds }}][0]
- $('.fa-table').show()
- $('#checkAll').prop('checked', true)
- } else {
- $('.fa-phone').hide()
- $('#checkAll').prop('checked', false)
- checkedIds = []
- }
- })
- $('body').on('click', '.contacts', function () {
- items = $('.contacts');
- checkedLength = $('.contacts:checked').length
- if (checkedLength) {
- $('.fa-phone').show()
- $('.fa-table').show()
- } else {
- $('.fa-phone').hide()
- $('.fa-table').hide()
- }
- if (items.length == checkedLength) {
- $('#checkAll').prop('checked', true)
- $('.fa-phone').show()
- $('.fa-table').show()
- } else {
- $('#checkAll').prop('checked', false)
- }
- saveChecked($(this))
- console.log(checkedIds)
- });
- /*保存选中的项*/
- 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 = $('.contacts');
- $boxes.each(function () {
- id = $(this).data('id')
- if (checkedIds.indexOf(id, 0) != -1) {
- $(this).prop('checked', true)
- } else {
- $(this).prop('checked', false)
- }
- })
- checkedLength = $('.contacts:checked').length
- if (checkedLength == $boxes.length) {
- $('#checkAll').prop('checked', true)
- }
- }
- /*添加选择的电话到拨打列表*/
- $('#addCallList').click(function () {
- thread_ids = checkedIds
- csrf_token = "{{ csrf_token() }}"
- ip = $('#ip').val()
- label = $('#calllist_label').val()
- $.ajax({
- type: 'post',
- url: '{{ U('Call/List/syncAdd') }}',
- data: {_token: csrf_token, ip: ip, thread_ids: thread_ids, label: label},
- success: function (data) {
- if (data == 200) {
- layer.msg('导入成功', {
- icon: 1,
- time: 2000 //2秒关闭(如果不配置,默认是3秒)
- }, function () {
- window.location.href = window.location.href
- });
- }
- }
- })
- });
- /*导出线索到excel*/
- $('#export_threads').click(function () {
- threads_ids = checkedIds
- csrf_token = "{{ csrf_token() }}";
- check_fields = $('#check-fields').serialize()
- $.ajax({
- type: 'post',
- url: '{{ U('User/Threads/export_threads') }}',
- data: {threads_ids: threads_ids, type: 1, _token: csrf_token, check_fields: check_fields},
- success: function (data) {
- $.fileDownload("{{ U('User/Threads/export_threads') }}", {
- data: {threads_ids: threads_ids, _token: csrf_token, check_fields: check_fields},
- prepareCallback: function (url) {
- console.log("开始下载");
- },
- successCallback: function (url) {
- console.log("正在下载,请稍后...");
- console.log("SUCCESS", "导出完成!");
- },
- failCallback: function (html, url) {
- console.log("正在下载,请稍后...");
- console.log("ERROR", "导出失败,未知的异常!");
- }
- });
- }
- })
- });
- /*线索筛选*/
- function filter_threads() {
- data = $('#filter_threads').serialize()
- $.ajax({
- type: 'get',
- data: data,
- }).done(function (data) {
- $('#threads-list').html(data.html)
- })
- }
- /*Ajax 分页*/
- $('body').on('click', '.pagination a', function (e) {
- e.preventDefault();
- if ($(this).attr('href') != '#') {
- data = $('#filter_threads').serialize()
- $.ajax({
- url: $(this).attr('href'),
- type: 'get',
- data: data,
- }).done(function (data) {
- $('#threads-list').html(data.html)
- setChecked()
- })
- }
- });
- </script>
- @endsection
|