wesley 6 years ago
parent
commit
413c819bce

+ 16 - 1
app/Http/Controllers/Admin/Company/InfoController.php

xqd xqd
@@ -13,6 +13,8 @@ use App\Http\Controllers\Admin\Controller;
 use App\Imports\CompanyInfoImport;
 use App\Models\CompanyContactsModel;
 use App\Models\CompanyInfoModel;
+use App\Models\CompanyJobsModel;
+use App\Models\CompanySemsModel;
 use App\Models\UserCompanyCollectionModel;
 use Illuminate\Http\Request;
 use App\Repositories\Company\InfoRepository;
@@ -86,7 +88,20 @@ class InfoController extends Controller
     {
         $data = $this->repository->find(request('id'));
         $contacts = $data->contacts()->orderBy('sort', 'desc')->get();
-        return view('admin.company.info.view', compact('data', 'contacts'));
+        $sems = $data->sems()->paginate(10);
+        $jobs = $data->jobs()->paginate(10);
+
+        if ($request->ajax() && $request->get('sem')) {
+            $view = view('admin.company.info.semdata', compact('sems'))->render();
+            return response()->json(['html' => $view]);
+        }
+
+        if ($request->ajax() && $request->get('job')) {
+            $view = view('admin.company.info.jobdata', compact('jobs'))->render();
+            return response()->json(['html' => $view]);
+        }
+
+        return view('admin.company.info.view', compact('data', 'contacts','sems','jobs'));
     }
 
 

+ 42 - 0
app/Models/CompanyDomainsModel.php

xqd
@@ -0,0 +1,42 @@
+<?php
+
+namespace App\Models;
+
+use App\Models\BaseModel;
+
+/**
+ * @description 挖掘线索
+ * @author  system;
+ * @version    1.0
+ * @date 2018-11-19 08:23:08
+ *
+ */
+class CompanyDomainsModel extends BaseModel
+{
+    /**
+     * 数据表名
+     *
+     * @var string
+     *
+     */
+    protected $table = 'company_domains';
+    /**
+     * 主键
+     */
+    protected $primaryKey = 'id';
+
+    //分页
+    protected $perPage = PAGE_NUMS;
+
+    /**
+     * 可以被集体附值的表的字段
+     *
+     * @var string
+     */
+    protected $fillable = [
+        'company_id',
+        'site_domain',
+        'site_home',
+        'site_name',
+    ];
+}

+ 18 - 0
app/Models/CompanyInfoModel.php

xqd
@@ -71,6 +71,24 @@ class CompanyInfoModel extends BaseModel
         return $this->hasMany('App\Models\CompanyContactsModel', 'company_id');
     }
 
+    /***
+     * 营销推广
+     * @return \Illuminate\Database\Eloquent\Relations\HasMany
+     */
+    public function sems()
+    {
+        return $this->hasMany('App\Models\CompanySemsModel', 'company_id');
+    }
+
+    /***
+     * 招聘
+     * @return \Illuminate\Database\Eloquent\Relations\HasMany
+     */
+    public function jobs()
+    {
+        return $this->hasMany('App\Models\CompanyJobsModel', 'company_id');
+    }
+
     /***
      * 表更纪录
      * @return \Illuminate\Database\Eloquent\Relations\HasMany

+ 45 - 0
app/Models/CompanyJobsModel.php

xqd
@@ -0,0 +1,45 @@
+<?php
+
+namespace App\Models;
+
+use App\Models\BaseModel;
+
+/**
+ * @description 挖掘线索
+ * @author  system;
+ * @version    1.0
+ * @date 2018-11-19 08:23:08
+ *
+ */
+class CompanyJobsModel extends BaseModel
+{
+    /**
+     * 数据表名
+     *
+     * @var string
+     *
+     */
+    protected $table = 'company_jobs';
+    /**
+     * 主键
+     */
+    protected $primaryKey = 'id';
+
+    //分页
+    protected $perPage = PAGE_NUMS;
+
+    /**
+     * 可以被集体附值的表的字段
+     *
+     * @var string
+     */
+    protected $fillable = [
+        'company_id',
+        'job_name',
+        'location',
+        'salary',
+        'job_url',
+        'release_date',
+        'source_name',
+    ];
+}

+ 44 - 0
app/Models/CompanySemsModel.php

xqd
@@ -0,0 +1,44 @@
+<?php
+
+namespace App\Models;
+
+use App\Models\BaseModel;
+
+/**
+ * @description 挖掘线索
+ * @author  system;
+ * @version    1.0
+ * @date 2018-11-19 08:23:08
+ *
+ */
+class CompanySemsModel extends BaseModel
+{
+    /**
+     * 数据表名
+     *
+     * @var string
+     *
+     */
+    protected $table = 'company_sems';
+    /**
+     * 主键
+     */
+    protected $primaryKey = 'id';
+
+    //分页
+    protected $perPage = PAGE_NUMS;
+
+    /**
+     * 可以被集体附值的表的字段
+     *
+     * @var string
+     */
+    protected $fillable = [
+        'company_id',
+        'sem_date',
+        'sem_title',
+        'sem_url',
+        'sem_keywords',
+        'source_name',
+    ];
+}

+ 48 - 0
resources/views/admin/company/info/jobdata.blade.php

xqd
@@ -0,0 +1,48 @@
+<div class="panel-body">
+    <h3>招聘信息</h3>
+    @if(!count($jobs))
+        <p style="text-align: center;color: #ccc;font-weight: 500;">
+            暂无相关内容
+        </p>
+    @else
+
+
+        <table class="table table-striped table-bordered table-hover dataTables-example dataTable">
+            <tr>
+                <th>序号</th>
+                <th>发布日期</th>
+                <th>职位</th>
+                <th>地点</th>
+                <th>薪资</th>
+                <th>招聘平台</th>
+            </tr>
+
+            @foreach($jobs as $key =>$item)
+                <tr>
+                    <td>{{ $key+1 }}</td>
+                    <td>{{ $item->release_date }}</td>
+                    <td>{{ $item->job_name }}</td>
+                    <td>{{ $item->location }}</td>
+                    <td>{{ $item->salary }}</td>
+                    <td><a href="{{ $item->job_url }}" target="_blank">{{ $item->source_name }}</a></td>
+                </tr>
+            @endforeach
+
+        </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">每页{{ $jobs->count() }}
+                    条,共{{ $jobs->lastPage() }}页,总{{ $jobs->total() }}条。
+                </div>
+            </div>
+            <div class="col-sm-6">
+                <div class="dataTables_paginate paging_simple_numbers" id="DataTables_Table_0_paginate">
+                    {!! $jobs->setPath('')->appends(Request::all())->render() !!}
+                </div>
+            </div>
+        </div>
+    @endif
+
+</div>

+ 44 - 0
resources/views/admin/company/info/semdata.blade.php

xqd
@@ -0,0 +1,44 @@
+<div class="panel-body">
+    <h3>网络推广</h3>
+    @if(!count($sems))
+        <p style="text-align: center;color: #ccc;font-weight: 500;">
+            暂无相关内容
+        </p>
+    @else
+        <table class="table table-striped table-bordered table-hover dataTables-example dataTable">
+            <tr>
+                <th>序号</th>
+                <th>变更日期</th>
+                <th>变更项目</th>
+                <th>变更前</th>
+                <th>变更后</th>
+            </tr>
+
+            @foreach($sems as $key =>$item)
+                <tr>
+                    <td>{{ $key+1 }}</td>
+                    <td>{{ $item->changed_time }}</td>
+                    <td>{{ $item->changed_name }}</td>
+                    <td>{{ $item->changed_before }}</td>
+                    <td>{{ $item->changed_after }}</td>
+                </tr>
+            @endforeach
+        </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">每页{{ $sems->count() }}
+                    条,共{{ $sems->lastPage() }}页,总{{ $sems->total() }}条。
+                </div>
+            </div>
+            <div class="col-sm-6">
+                <div class="dataTables_paginate paging_simple_numbers" id="DataTables_Table_0_paginate">
+                    {!! $sems->setPath('')->appends(Request::all())->render() !!}
+                </div>
+            </div>
+        </div>
+    @endif
+
+</div>

+ 34 - 14
resources/views/admin/company/info/view.blade.php

xqd xqd xqd xqd
@@ -166,7 +166,7 @@
                                                         <a data-toggle="tab" href="#tab-2" aria-expanded="true">变更纪录</a>
                                                     </li>
                                                     <li>
-                                                        <a data-toggle="tab" href="#tab-3" aria-expanded="true">企业年报</a>
+                                                        <a data-toggle="tab" href="#tab-3" aria-expanded="true">网络推广</a>
                                                     </li>
                                                     <li>
                                                         <a data-toggle="tab" href="#tab-4" aria-expanded="true">知识产权</a>
@@ -333,14 +333,9 @@
                                                         </div>
                                                     </div>
 
-                                                    {{-- 企业年报 --}}
+                                                    {{-- 网络推广 --}}
                                                     <div id="tab-3" class="tab-pane">
-                                                        <div class="panel-body">
-                                                            <h3>企业年报</h3>
-                                                            <p style="text-align: center;color: #ccc;font-weight: 500;">
-                                                                暂无相关内容
-                                                            </p>
-                                                        </div>
+                                                        @include('admin.company.info.semdata')
                                                     </div>
 
 
@@ -356,12 +351,7 @@
 
                                                     {{-- 招聘信息 --}}
                                                     <div id="tab-5" class="tab-pane">
-                                                        <div class="panel-body">
-                                                            <h3>招聘信息</h3>
-                                                            <p style="text-align: center;color: #ccc;font-weight: 500;">
-                                                                暂无相关内容
-                                                            </p>
-                                                        </div>
+                                                        @include('admin.company.info.jobdata')
                                                     </div>
                                                 </div>
 
@@ -503,6 +493,36 @@
                 }
             })
         }
+
+
+        /*Ajax分页*/
+        $('body').on('click', '#tab-5 .pagination a', function (e) {
+            e.preventDefault();
+            if ($(this).attr('href') != '#') {
+                $.ajax({
+                    url: $(this).attr('href'),
+                    data:{'job':1},
+                    type: 'get',
+                }).done(function (data) {
+                    $('#tab-5').html(data.html)
+                })
+            }
+
+        });
+
+        $('body').on('click', '#tab-3 .pagination a', function (e) {
+            e.preventDefault();
+            if ($(this).attr('href') != '#') {
+                $.ajax({
+                    url: $(this).attr('href'),
+                    data:{'sem':1},
+                    type: 'get',
+                }).done(function (data) {
+                    $('#tab-3').html(data.html)
+                })
+            }
+
+        });
     </script>
 
 @endsection