问题:组长端显示王刚有2个真实项目,但设计师端(王刚的工作台)没有显示项目。
状态:✅ 已添加详细调试日志
| 端 | 查询方式 | 查询表 |
|---|---|---|
| 组长端 | 查询所有设计师的项目 | ProjectTeam 表 |
| 设计师端 | 查询当前设计师的项目 | ProjectTeam 表 → Project.assignee(降级) |
Profile ID 不匹配
ProjectTeam 表缺少记录
Project.assignee 字段未设置
位置:src/app/pages/designer/dashboard/dashboard.ts
console.log('🔍 开始加载设计师任务');
console.log('📋 当前 Profile ID:', this.currentProfile.id);
console.log('📋 当前 Profile 对象:', this.currentProfile);
位置:src/app/services/designer-task.service.ts
console.log('🔍 开始查询设计师任务,Profile ID:', designerId);
console.log('📋 当前公司 ID:', this.cid);
console.log('🔍 查询 ProjectTeam 表...');
console.log(`✅ ProjectTeam 查询结果: ${teamRecords.length} 条记录`);
console.log('📋 ProjectTeam 记录详情:');
// 详细打印每个项目
console.log('🔍 [降级方案] 从 Project.assignee 查询,Profile ID:', designerId);
console.log('🔍 [降级方案] 查询 Project 表...');
console.log(`✅ [降级方案] 从Project.assignee加载 ${projects.length} 个项目`);
console.log('📋 [降级方案] 项目详情:');
// 详细打印每个项目
按 Ctrl+Shift+R (Windows) 或 Cmd+Shift+R (Mac)
🔍 开始加载设计师任务
📋 当前 Profile ID: m9xAo3sPLu
📋 当前 Profile 对象: Parse.Object {...}
🔍 开始查询设计师任务,Profile ID: m9xAo3sPLu
📋 当前公司 ID: cDL6R1hgSi
🔍 查询 ProjectTeam 表...
✅ ProjectTeam 查询结果: 2 条记录 ← 如果是 0,说明 ProjectTeam 表没有数据
📋 ProjectTeam 记录详情:
1. 项目: {projectId: '...', projectName: '红杉', ...}
2. 项目: {projectId: '...', projectName: '湾尚', ...}
🔍 查询 ProjectTeam 表...
✅ ProjectTeam 查询结果: 0 条记录
⚠️ ProjectTeam 表中未找到该设计师的项目
🔄 尝试降级方案:从 Project.assignee 查询
🔍 [降级方案] 从 Project.assignee 查询,Profile ID: m9xAo3sPLu
🔍 [降级方案] 查询 Project 表...
✅ [降级方案] 从Project.assignee加载 2 个项目 ← 如果是 0,说明 assignee 也未设置
✅ ProjectTeam 查询结果: 0 条记录
⚠️ ProjectTeam 表中未找到该设计师的项目
🔄 尝试降级方案:从 Project.assignee 查询
✅ [降级方案] 从Project.assignee加载 0 个项目
⚠️ [降级方案] 也未找到项目
💡 提示:请检查 ProjectTeam 或 Project.assignee 字段是否正确设置
请在控制台中查找并提供以下信息:
📋 当前 Profile ID: ____________
✅ ProjectTeam 查询结果: ____ 条记录
✅ [降级方案] 从Project.assignee加载 ____ 个项目
📋 ProjectTeam 记录详情:
1. 项目: {projectId: '...', projectName: '...', ...}
症状:
解决方案:
检查 ProjectTeam 表中的 profile 字段,确保指向正确的 Profile ID。
修复方法:
// 在 Parse Dashboard 或通过脚本更新
const teamRecord = /* 找到 ProjectTeam 记录 */;
teamRecord.set('profile', correctProfilePointer);
await teamRecord.save();
症状:
解决方案: 为王刚创建 ProjectTeam 记录。
修复方法:
const Parse = require('parse/node');
// 找到王刚的 Profile
const profileQuery = new Parse.Query('Profile');
profileQuery.equalTo('userid', 'woAs2qCQAAPjkaSBZg3GVdXjlG3vxAOg');
const profile = await profileQuery.first();
// 找到项目
const projectQuery = new Parse.Query('Project');
projectQuery.equalTo('title', '红杉'); // 或其他项目名
const project = await projectQuery.first();
// 创建 ProjectTeam 记录
const ProjectTeam = Parse.Object.extend('ProjectTeam');
const teamRecord = new ProjectTeam();
teamRecord.set('profile', profile);
teamRecord.set('project', project);
teamRecord.set('role', 'designer'); // 或其他角色
await teamRecord.save();
症状:
解决方案: 需要同时设置 ProjectTeam 和 Project.assignee。
建议:优先使用 ProjectTeam 表(更灵活,支持一个项目多个设计师)。
| 字段 | 类型 | 说明 | 示例 |
|---|---|---|---|
profile |
Pointer | 指向 Profile 表 | Profile(m9xAo3sPLu) |
project |
Pointer | 指向 Project 表 | Project(xyz123) |
role |
String | 角色(designer/leader) | "designer" |
isDeleted |
Boolean | 是否删除 | false |
| 字段 | 类型 | 说明 | 示例 |
|---|---|---|---|
assignee |
Pointer | 负责设计师(Profile) | Profile(m9xAo3sPLu) |
company |
String | 公司 ID | "cDL6R1hgSi" |
status |
String | 项目状态 | "进行中" |
currentStage |
String | 当前阶段 | "建模阶段" |
刷新页面,在控制台中查找所有带 🔍、📋、✅、⚠️ 的日志,截图发给我。
登录 Parse Dashboard,检查:
ProjectTeam 表中是否有王刚相关的记录Project 表中的 assignee 字段是否设置告诉我:
如果急需让项目显示出来,可以考虑:
使用组长端的项目分配功能,重新分配项目给王刚。
修改查询逻辑,暂时显示所有项目(仅用于测试):
// 临时修改
const query = new this.Parse.Query('Project');
query.equalTo('company', this.cid);
query.containedIn('status', ['进行中', '待审核']);
通过详细的日志,我们可以准确定位问题所在:
请刷新页面并提供控制台日志截图,我会根据具体情况给出精确的解决方案!🔍