|
|
@@ -268,26 +268,37 @@ export class ChatActivationComponent implements OnInit, OnDestroy {
|
|
|
memberCount: (this.groupChat.get('member_list') || []).length
|
|
|
});
|
|
|
|
|
|
- // 获取关联的项目(使用include)
|
|
|
+ // 获取关联的项目(使用include,添加防御性检查)
|
|
|
const projectPointer = this.groupChat.get('project');
|
|
|
+ console.log('📋 项目指针:', projectPointer);
|
|
|
+
|
|
|
if (projectPointer) {
|
|
|
- try {
|
|
|
- const pQuery = new Parse.Query('Project');
|
|
|
- pQuery.include('contact');
|
|
|
- pQuery.include('assignee');
|
|
|
- pQuery.include('department');
|
|
|
- pQuery.include('department.leader');
|
|
|
- this.project = await pQuery.get(projectPointer.id);
|
|
|
-
|
|
|
- if (this.project) {
|
|
|
- console.log('✅ 找到项目:', this.project.get('title'));
|
|
|
- this.contact = this.project.get('contact');
|
|
|
- this.projectId = this.project.id;
|
|
|
+ // 检查projectPointer是否有有效的id或objectId
|
|
|
+ const projectId = projectPointer.id || projectPointer.objectId;
|
|
|
+ console.log('📋 提取的项目ID:', projectId);
|
|
|
+
|
|
|
+ if (projectId && projectId !== 'undefined') {
|
|
|
+ try {
|
|
|
+ const pQuery = new Parse.Query('Project');
|
|
|
+ pQuery.include('contact');
|
|
|
+ pQuery.include('assignee');
|
|
|
+ pQuery.include('department');
|
|
|
+ pQuery.include('department.leader');
|
|
|
+ this.project = await pQuery.get(projectId);
|
|
|
+
|
|
|
+ if (this.project) {
|
|
|
+ console.log('✅ 找到项目:', this.project.get('title'));
|
|
|
+ this.contact = this.project.get('contact');
|
|
|
+ this.projectId = this.project.id;
|
|
|
+ }
|
|
|
+ } catch (projectError) {
|
|
|
+ console.warn('⚠️ 加载项目失败:', projectError);
|
|
|
+ console.warn(' 尝试的项目ID:', projectId);
|
|
|
}
|
|
|
- } catch (projectError) {
|
|
|
- console.warn('⚠️ 加载项目失败:', projectError);
|
|
|
+ } else {
|
|
|
+ console.warn('⚠️ 项目ID无效:', projectId);
|
|
|
}
|
|
|
- } else {
|
|
|
+ } else {
|
|
|
console.warn('⚠️ 群聊未关联项目');
|
|
|
}
|
|
|
|