xxxrrrdddd 3 年之前
父節點
當前提交
7987c41def

+ 12 - 1
application/admin/controller/Mobile.php

@@ -27,6 +27,7 @@ class Mobile extends Backend
      * @var \app\admin\model\Mobile
      */
     protected $model = null;
+    protected $relationSearch=true;
 
     public function _initialize()
     {
@@ -65,12 +66,21 @@ class Mobile extends Backend
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
             $list = $this->model
-                    
+                    ->with('info')
                     ->where($where)
                     ->order($sort, $order)
                     ->paginate($limit);
 
             foreach ($list as $row) {
+                $rules=[];
+                foreach (MobileConstant::getFilters() as $rule=>$field){
+                    foreach (array_values($field) as $column){
+                        if($row[$column]==1){
+                            $rules[]=$rule;
+                        }
+                    }
+                }
+                $row['rules']=array_unique($rules);
             }
 
             $result = array("total" => $list->total(), "rows" => $list->items());
@@ -79,6 +89,7 @@ class Mobile extends Backend
         }
         $this->assign('no_type',array_column(MobileConstant::getNoType(),'name','id'));
         $this->assign('network',array_column(MobileConstant::getNetwork(),'name','id'));
+        $this->assign('filters',MobileConstant::getFilters());
         return $this->view->fetch();
     }
 

+ 4 - 0
application/admin/model/Mobile.php

@@ -10,4 +10,8 @@ class Mobile extends \app\common\model\Mobile
     // 追加属性
     protected $append = [
     ];
+    public function info()
+    {
+        return parent::info()->setEagerlyType(0); // TODO: Change the autogenerated stub
+    }
 }

+ 1 - 0
application/admin/view/mobile/index.html

@@ -50,4 +50,5 @@
 <script>
     var no_type={:json_encode($no_type)};
     var network={:json_encode($network)};
+    var filters={:json_encode($filters)};
 </script>

+ 5 - 0
public/assets/js/backend/mobile.js

@@ -36,6 +36,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'city', title: __('归属地')},
                         {field: 'network', title: __('运营商'),formatter: Table.api.formatter.label},
                         {field: 'proxy', title: __('代理商'),formatter: Table.api.formatter.label},
+                        {field: 'brand', title: __('卡品牌'),formatter: Table.api.formatter.label},
+                        {field: 'rules', title: __('规律'),searchList: Object.keys(filters),formatter(a){
+                            return a.join('<br>')
+                            }},
+                        {field: 'info.describe', title: __('套餐信息'),operate: "like"},
 
 
                         {field: 'name', title: __('Name')},