Browse Source

add search

GGican 8 years ago
parent
commit
ae953d6eac

+ 25 - 0
app/Http/Controllers/Admin/SearchController.php

xqd
@@ -0,0 +1,25 @@
+<?php
+
+namespace App\Http\Controllers\Admin;
+
+use App\Http\Requests\JobRequest;
+use App\Model\Adminuser;
+use App\Model\Tablelist;
+use Illuminate\Support\Facades\Crypt;
+use Illuminate\Support\Facades\Input;
+use Illuminate\Support\Facades\Validator;
+use App\Http\Controllers\Admin\CommonController;
+use Session;
+use Symfony\Component\HttpFoundation\Request;
+
+class SearchController extends CommonController
+{
+
+    public function table_search($tabel_type_id)
+    {
+
+        return view('amdin.sta.sta_one');
+
+    }
+
+}

+ 37 - 0
app/Http/Requests/SearchRequest.php

xqd
@@ -0,0 +1,37 @@
+<?php
+
+namespace App\Http\Requests;
+
+use App\Http\Requests\Request;
+
+class SearchRequest extends Request
+{
+    /**
+     * Determine if the user is authorized to make this request.
+     *
+     * @return bool
+     */
+    public function authorize()
+    {
+        return false;
+    }
+
+    /**
+     * Get the validation rules that apply to the request.
+     *
+     * @return array
+     */
+    public function rules()
+    {
+        return [
+
+        ];
+    }
+
+    public function messages()
+    {
+        return [
+
+        ];
+    }
+}

+ 3 - 0
app/Http/routes.php

xqd
@@ -25,6 +25,9 @@ Route::group(['namespace'=>'Admin','middleware'=>['admin.login']],function() {
     Route::get('/search/show', 'IndexController@search_show');
     Route::any('/upload','CommonController@upload');
 
+    //any_table_search
+    Route::get('/table_search/{id}','SearchController@table_search');
+
 //    Route::get('/table','TableController@index');
     Route::get('/table','TableController@on_table');
     Route::get('/on_table','TableController@on_table');

+ 2 - 0
resources/views/layouts/datatable.blade.php

xqd
@@ -20,6 +20,8 @@
     <!-- Main content -->
     <section class="content">
 
+        @include('layouts.search')
+
         @yield('table')
 
     </section>

+ 51 - 0
resources/views/layouts/search.blade.php

xqd
@@ -0,0 +1,51 @@
+
+<?php
+        $url = Request::url();
+        $table_type_id = substr($url, -1);
+?>
+
+<div class='box'>
+    <div class="box-header">
+        <h3 class="box-title">案件搜索</h3>
+    </div>
+    <div class="box-body">
+        <div class="row">
+            <form action="{{ url('/table_search/'.$table_type_id) }}">
+                <div class="col-sm-3">
+                    <input name="name" class="form-control" placeholder="按姓名搜索">
+                </div>
+                <div class="col-sm-3">
+                    <select class="form-control" name="project_name">
+                        <option value="">按项目搜索</option>
+                        @foreach($project as $pro)
+                            <option value="{{ $pro->project_name }}">{{ $pro->project_name }}</option>
+                        @endforeach
+                    </select>
+                </div>
+                <div class="col-sm-3">
+                    <input id="startTime" type="text" name="start_time"  readonly class="form-control form_datetime" placeholder="开始日期,不输入则显示全部">
+                </div>
+                <div class="col-sm-3" style="margin-bottom: 1%">
+                    <input id="endTime" type="text" name="end_time" readonly class="form-control form_datetime" placeholder="结束日期,不输入则显示全部">
+                </div>
+                <div style="text-align: center">
+                    <button id="sub" type="submit" class="btn btn-primary">搜索</button>
+                </div>
+
+                <script type="text/javascript">
+                    $('#sub').click(function(){
+                        $('#startTime').val( $('#startTime').val().replace(/-/g,''));
+                        $('#endTime').val( $('#endTime').val().replace(/-/g,''));
+                    })
+                    $(".form_datetime").datetimepicker({
+                        language: 'zh',
+                        format: 'yyyy-mm-dd',
+                        minView:'month'
+                    }).on('changeDate',function(){
+                        $(".datetimepicker").hide();
+                    });
+                </script>
+            </form>
+        </div>
+    </div>
+</div>