feat(workspace): add unarchived filter and adjust card info items

This commit is contained in:
lidf 2026-04-12 16:43:20 +08:00
parent f31c1eb947
commit d711df312f
3 changed files with 49 additions and 11 deletions

View File

@ -235,3 +235,21 @@
.connector.active { .connector.active {
background: var(--color-success); background: var(--color-success);
} }
/* Report Filter and Status Styles */
.badge.active-filter {
background: var(--color-warning);
color: white;
border-color: var(--color-warning);
}
.status-badge {
font-size: 11px;
}
.status-badge.archived {
color: var(--color-text-tertiary);
}
.status-badge.unarchived {
color: var(--color-error);
font-weight: 600;
}

View File

@ -2,8 +2,14 @@
<!-- History List (Standalone View) --> <!-- History List (Standalone View) -->
<div class="mobile-section"> <div class="mobile-section">
<div class="section-header"> <div class="section-header">
<div style="display: flex; align-items: center; gap: 8px;">
<h3>我的面诊笔记库</h3> <h3>我的面诊笔记库</h3>
<span class="badge">总归档: {{ reports.length }} 份</span> <span class="badge" style="cursor: pointer;" (click)="toggleFilter()" [class.active-filter]="filterState === 'unarchived'">
{{ filterState === 'unarchived' ? '仅看未归档' : '总计: ' + reports.length + ' 份' }}
<svg *ngIf="filterState === 'all'" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="margin-left: 2px"><polygon points="22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"></polygon></svg>
<svg *ngIf="filterState === 'unarchived'" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="margin-left: 2px"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>
</span>
</div>
</div> </div>
<div class="mobile-list"> <div class="mobile-list">
@ -24,7 +30,9 @@
<div class="card-patient"> <div class="card-patient">
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="margin-right:2px"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path><circle cx="12" cy="7" r="4"></circle></svg> <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="margin-right:2px"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path><circle cx="12" cy="7" r="4"></circle></svg>
{{ task.patientName }} {{ task.patientName }}
<span class="text-tertiary ml-1">· {{ task.doctorName }}</span> <span class="text-tertiary ml-1 status-badge" [ngClass]="task.isArchived ? 'archived' : 'unarchived'">
{{ task.isArchived ? '(已归档)' : '(未归档)' }}
</span>
</div> </div>
</div> </div>

View File

@ -14,6 +14,7 @@ import { ApiService } from '../../core/api.service';
}) })
export class WorkspaceDashboard implements OnInit { export class WorkspaceDashboard implements OnInit {
reports: any[] = []; reports: any[] = [];
filterState: 'all' | 'unarchived' = 'all';
private api = inject(ApiService); private api = inject(ApiService);
ngOnInit() { ngOnInit() {
@ -25,14 +26,18 @@ export class WorkspaceDashboard implements OnInit {
try { try {
const res = await this.api.getReportsList(); const res = await this.api.getReportsList();
if (res && res.reports) { if (res && res.reports) {
completedReports = res.reports.map((r: any) => ({ completedReports = res.reports.map((r: any) => {
const rawName = r.data?._meta?.patientName || r.contextId.split('/')[0].replace('recording:', '') || '未知客户';
const isArchived = !rawName.includes('unknown_client') && rawName !== '未知客户';
return {
id: r.id, id: r.id,
coreDemand: r.data?.module1?.insight?.substring(0, 20) + '...' || '面诊分析报告AI', coreDemand: r.data?.module1?.insight?.substring(0, 20) + '...' || '面诊分析报告AI',
createdAt: new Date(r.createdAt * 1000).toLocaleString('zh-CN', { month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' }), createdAt: new Date(r.createdAt * 1000).toLocaleString('zh-CN', { month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' }),
patientName: r.data?._meta?.patientName || r.contextId.split('/')[0].replace('recording:', '') || '未知客户', patientName: isArchived ? rawName : '访客体验号',
doctorName: r.data?._meta?.doctorName || '深维面诊专属医生', isArchived: isArchived,
status: r.status // 'processing', 'completed', 'failed' status: r.status // 'processing', 'completed', 'failed'
})); };
});
} }
} catch (e) { } catch (e) {
console.error('Failed to load reports from API', e); console.error('Failed to load reports from API', e);
@ -43,9 +48,16 @@ export class WorkspaceDashboard implements OnInit {
} }
get recentReports(): any[] { get recentReports(): any[] {
if (this.filterState === 'unarchived') {
return this.reports.filter(r => !r.isArchived);
}
return this.reports; return this.reports;
} }
toggleFilter() {
this.filterState = this.filterState === 'all' ? 'unarchived' : 'all';
}
encodeId(id: string): string { encodeId(id: string): string {
return encodeURIComponent(id); return encodeURIComponent(id);
} }