Browse Source

供应商汇总列表增加等级筛选

wufeng 2 years ago
parent
commit
0f11ef7098
1 changed files with 9 additions and 1 deletions
  1. 9 1
      app/admin/controller/Supplier.php

+ 9 - 1
app/admin/controller/Supplier.php

@@ -6,7 +6,7 @@ use app\BaseController;
 use think\App;
 use think\facade\Db;
 use app\admin\model\ActionLog;
-class Supplier extends BaseController
+class Supplier extends Base
 {
 public $post = "";
 public function __construct(App $app){
@@ -216,6 +216,14 @@ public function selec(){
         if ($post['companyNo'] != '') $condition [] = ['code', '=', $post['companyNo']];
         if ($post['name'] != '') $condition [] = ['name|a.contector', 'like', '%' . $post['name'] . '%'];
         if ($post['type'] != '') $condition [] = ['type', '=', $post['type']];
+        if ($this->level != 1) {
+            //查询当前账号关联了哪几家公司
+            $userCommon = new \app\admin\common\User();
+            $company = $userCommon->handle('userlist', ['uid' => $this->uid]);
+            $company = json_decode($company, true);
+            $company = array_column($company['data']['list'][0]['company_relaton'], 'companyCode');
+            $condition[] = ['code', 'in', $company];
+        }
 
         $count = Db::name('supplier_info')
             ->alias('a')