马铁龙 6 سال پیش
والد
کامیت
b99b111a3a

+ 27 - 2
application/admin/controller/Protector.php

@@ -30,7 +30,7 @@ class Protector extends Backend
      * 无需鉴权的方法,但需要登录
      * @var array
      */
-    protected $noNeedRight = ['again','giveup','showfollow','addfollow','testingname'];
+    protected $noNeedRight = ['again','giveup','showfollow','addfollow','testingname','allsearch'];
 
 
     /**
@@ -517,7 +517,12 @@ class Protector extends Backend
         }
     }
 
-
+    /**
+     * 测试是否可以添加的单位
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
     public function TestingName()
     {
         $unit_name = $this->request->post('unit_name');
@@ -530,6 +535,26 @@ class Protector extends Backend
 
     }
 
+    /**
+     * 全系统搜索
+     * @return string
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function allSearch()
+    {
+        $val = $this->request->post('val');
+
+        $list = $this->model
+            ->whereLike('unit_name',"%$val%")
+            ->select();
+
+        $this->assign('list',$list);
+        return $this->view->fetch('all_search');
+    }
+
 
 
 

+ 30 - 0
application/admin/view/protector/all_search.html

@@ -0,0 +1,30 @@
+<table id="table" class="table table-striped table-bordered table-hover" width="100%">
+    <thead>
+    <tr>
+        <th>公司名称</th>
+        <th>单位性质</th>
+        <th>操作人</th>
+        <th>操作人部门</th>
+        <th>保护时间</th>
+        <th>到期时间</th>
+    </tr>
+
+    </thead>
+    {foreach $list as $k=>$v}
+    <tr>
+        <td>{$v.unit_name}</td>
+        <td>{$v.unit_type}</td>
+        <td>{$v.usr_nickname}</td>
+        <td>{$v.usr_depart}</td>
+        <td>{$v.pro_date}</td>
+        <td>{$v.ex_date}</td>
+    </tr>
+    {/foreach}
+    <tbody>
+
+    </tbody>
+
+
+
+</table>
+

+ 5 - 11
application/admin/view/protector/index.html

@@ -4,25 +4,19 @@
         <div id="myTabContent" class="tab-content">
             <div class="tab-pane fade active in" id="one">
                 <div class="widget-body no-padding">
+
                     <div id="toolbar" class="toolbar">
                         <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
                         {eq name="Think.get.status" value="protect"}
                         <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('protector/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
                         {/eq}
-                        <!--<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('protector/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>-->
-                        <!--<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('protector/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>-->
-                        <!--<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('protector/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>-->
-                        <!--<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('protector/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>-->
 
-                        <div class="dropdown btn-group {:$auth->check('protector/multi')?'':'hide'}">
-                            <!--<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>-->
-                            <ul class="dropdown-menu text-left" role="menu">
-                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
-                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
-                            </ul>
+                        <div class="all-search" style="float: right; width: 200px; margin-left: 50px;">
+                            <input class="form-control input-all-search" type="text" placeholder="全系统搜索" style="width: 70%;margin: 0;float: left;">
+                            <button class="btn btn-info btn-all-search" style="float: left;width: 30%;border-radius: 0;">确定</button>
                         </div>
                     </div>
-                    <table id="table" class="table table-striped table-bordered table-hover" 
+                    <table id="table" class="table table-striped table-bordered table-hover"
                            data-operate-edit="{:$auth->check('protector/edit')}" 
                            data-operate-del="{:$auth->check('protector/del')}" 
                            data-operate-sign="{:$auth->check('protector/sign')}"

+ 18 - 0
public/assets/js/backend/protector.js

@@ -290,6 +290,24 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'selectpage', 'bootst
         }
     });
 
+    // 全系统搜索
+    $('.btn-all-search').click(function () {
+       var val = $('.input-all-search').val();
+        $.ajax({
+            url: 'protector/allSearch',
+            type: 'post',
+            data: { val:val },
+            dataType: 'json',
+            success: function success(res) {
+                Layer.open({
+                    content:res,
+                    area:['800px'],
+                    title:val
+                })
+            }
+        });
+    });
+