Bladeren bron

feat: team assign with remove

Future 1 dag geleden
bovenliggende
commit
1cf46eabbf

+ 1 - 0
CHANGELOG.md

@@ -15,6 +15,7 @@
 - [ ] 改图工单:改图是独立于初期报价,后期延续的灵活工单,需要独立设计
 - [ ] 员工问卷:专业特长及偏好问卷功能
 - [ ] 方案深化:参考图区分软装、硬装、氛围等用途标签,对应不同分析结果
+- [x] 组员派单:根据新的空间报价,修改派单逻辑,增加已派单成员移除的功能
 
 # CHANGELOG 更新日志
 

+ 5 - 0
src/modules/project/components/team-assign/team-assign.component.html

@@ -167,6 +167,11 @@
         <button class="btn btn-outline" (click)="cancelAssignDialog()">
           取消
         </button>
+        @if (editingTeam) {
+          <button class="btn btn-danger" (click)="confirmDeleteMember()" [disabled]="saving">
+            删除成员
+          </button>
+        }
         <button
           class="btn btn-primary"
           (click)="confirmAssignDesigner()"

+ 5 - 0
src/modules/project/components/team-assign/team-assign.component.scss

@@ -528,6 +528,11 @@
       color: white;
     }
 
+    &.btn-danger {
+      background: #e53e3e;
+      color: white;
+    }
+
     &:disabled { opacity: 0.5; cursor: not-allowed; }
   }
 }

+ 62 - 0
src/modules/project/components/team-assign/team-assign.component.ts

@@ -307,6 +307,68 @@ export class TeamAssignComponent implements OnInit {
     }
   }
 
+  async confirmDeleteMember() {
+    if (!this.editingTeam) return;
+
+    const ok = window.confirm('确定要删除该成员的项目分配吗?');
+    if (!ok) return;
+
+    try {
+      this.saving = true;
+
+      // 软删除 ProjectTeam
+      this.editingTeam.set('isDeleted', true);
+      const data = this.editingTeam.get('data') || {};
+      data.deletedAt = new Date();
+      data.deletedBy = this.currentUser?.id;
+      this.editingTeam.set('data', data);
+      await this.editingTeam.save();
+
+      // 从群聊移除(静默尝试)
+      const profile = this.editingTeam.get('profile');
+      const userId = profile?.get?.('userId');
+      if (userId) {
+        await this.removeMemberFromGroupChat(userId);
+      }
+
+      alert('成员已删除');
+
+      // 刷新列表并收起弹窗
+      await this.loadProjectTeams();
+      this.showAssignDialog = false;
+      this.assigningDesigner = null;
+      this.selectedSpaces = [];
+      this.editingTeam = null;
+    } catch (err) {
+      console.error('删除成员失败:', err);
+      alert('删除失败');
+    } finally {
+      this.saving = false;
+      this.cdr.markForCheck();
+    }
+  }
+
+  async removeMemberFromGroupChat(userId: string) {
+    if (!userId) return;
+
+    try {
+      const groupChat = (this as any).groupChat;
+      if (!groupChat) return;
+
+      const chatId = groupChat.get('chat_id');
+      if (!chatId) return;
+
+      if (typeof (window as any).ww !== 'undefined') {
+        await (window as any).ww.updateEnterpriseChat({
+          chatId: chatId,
+          userIdsToRemove: [userId]
+        });
+      }
+    } catch (err) {
+      console.warn('移除群成员失败或不支持:', err);
+    }
+  }
+
   getMemberSpaces(team: FmodeObject): string {
     const spaces = team.get('data')?.spaces || [];
     return spaces.join('、') || '未分配';

+ 2 - 0
src/modules/project/pages/project-survey/project-survey.component.scss

@@ -86,6 +86,8 @@
 // 主容器
 .survey-container {
   min-height: 100vh;
+  height:100vh;
+  overflow-y:auto;
   padding-top: 56px;
   background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
 }