kuaifan 5 年 前
コミット
9744c89884

+ 17 - 0
app/Http/Controllers/Api/UsersController.php

@@ -100,6 +100,23 @@ class UsersController extends Controller
             $whereRaw.= $whereRaw ? ' AND ' : '';
             $whereRaw.= "`username` IN (SELECT username FROM `" . env('DB_PREFIX') . "project_users` WHERE `type`='成员' AND `projectid`=" . intval($keys['projectid']) .")";
         }
+        if ($keys['nousername']) {
+            $nousername = [];
+            foreach (explode(",", $keys['nousername']) AS $name) {
+                $name = trim($name);
+                if ($name && !in_array($name, $nousername)) {
+                    $nousername[] = $name;
+                }
+            }
+            if ($nousername) {
+                $whereRaw.= $whereRaw ? ' AND ' : '';
+                $whereRaw.= "(`username` NOT IN ('" . implode("','", $nousername) . "'))";
+            }
+        }
+        if (intval($keys['noprojectid']) > 0) {
+            $whereRaw.= $whereRaw ? ' AND ' : '';
+            $whereRaw.= "`username` NOT IN (SELECT username FROM `" . env('DB_PREFIX') . "project_users` WHERE `type`='成员' AND `projectid`=" . intval($keys['noprojectid']) .")";
+        }
         //
         $lists = DBCache::table('users')->select(['id', 'username', 'nickname', 'userimg', 'profession'])
             ->where($whereArr)

+ 18 - 0
resources/assets/js/main/components/UseridInput.vue

@@ -125,6 +125,12 @@
             noidentity: {
                 default: ''
             },
+            nousername: {
+                default: ''
+            },
+            noprojectid: {
+                default: ''
+            },
             projectid: {
                 default: ''
             },
@@ -206,6 +212,12 @@
                         if (typeof this.noidentity === "string") {
                             where['noidentity'] = this.noidentity;
                         }
+                        if (typeof this.nousername === "string") {
+                            where['nousername'] = this.nousername;
+                        }
+                        if (this.noprojectid) {
+                            where['noprojectid'] = this.noprojectid;
+                        }
                         if (this.projectid) {
                             where['projectid'] = this.projectid;
                         }
@@ -331,6 +343,12 @@
                 if (typeof this.noidentity === "string") {
                     where['noidentity'] = this.noidentity;
                 }
+                if (typeof this.nousername === "string") {
+                    where['nousername'] = this.nousername;
+                }
+                if (this.noprojectid) {
+                    where['noprojectid'] = this.noprojectid;
+                }
                 if (this.projectid) {
                     where['projectid'] = this.projectid;
                 }

+ 1 - 1
resources/assets/js/main/components/project/task/detail/detail.vue

@@ -68,7 +68,7 @@
                     <div slot="content">
                         <div style="width:240px">
                             选择负责人
-                            <UseridInput :projectid="detail.projectid" @change="handleTask('username', $event)" placeholder="输入关键词搜索" style="margin:5px 0 3px"></UseridInput>
+                            <UseridInput :projectid="detail.projectid" :nousername="detail.username" @change="handleTask('username', $event)" placeholder="输入关键词搜索" style="margin:5px 0 3px"></UseridInput>
                         </div>
                     </div>
                 </Poptip>

+ 1 - 0
resources/assets/js/main/components/project/users.vue

@@ -230,6 +230,7 @@
                                 props: {
                                     value: this.userValue,
                                     multiple: true,
+                                    noprojectid: this.projectid,
                                     placeholder: '请输入昵称/用户名搜索'
                                 },
                                 on: {

+ 1 - 0
resources/assets/js/main/pages/project.vue

@@ -602,6 +602,7 @@
                             h('UseridInput', {
                                 props: {
                                     value: this.transferValue,
+                                    nousername: item.username,
                                     placeholder: '请输入昵称/用户名搜索'
                                 },
                                 on: {