fix(ui): 任务总览的测试范围显示企业名称而非 ID
/api/tasks/{id}/scope 只返回 company_id,前端无从解析名称,测试范围里的
企业行只能渲染成 "company #4"。
- TaskScope 增加 company_name,ListTaskScope 与 ListTaskScopeWithSources
都 LEFT JOIN companies 带出名称(LEFT 而非 INNER:域名/IP/网段行的
company_id 为 NULL,内连接会把它们全过滤掉)
- 两个查询函数都改,避免结构体字段"一个填一个不填"的不一致
- 前端优先显示名称,公司被删后的残留行仍以「企业 #N」兜底
覆盖图谱的企业节点本就查名显示(task_scope.go 的 BuildCoverageGraph),
不受影响。
Claude-Session: https://claude.ai/code/session_01Q8nhYZfS4H8fsSCBJXxbSy
This commit is contained in:
1 parent
f0c2b43802
commit
76c648d36d
4 files changed
+18
-10
No files matched your search
@@ -41,7 +41,7 @@ function cacheHitRate(cacheRead: number, input: number): string {
|
||||
function scopeValue(row: TaskScopeRow): string {
|
||||
if (row.domain) return row.domain;
|
||||
if (row.net) return row.net;
|
||||
if (row.company_id) return `company #${row.company_id}`;
|
||||
if (row.company_id) return row.company_name || `企业 #${row.company_id}`;
|
||||
return "—";
|
||||
}
|
||||
|
||||
|
||||
@@ -241,6 +241,7 @@ export interface TaskScopeRow {
|
||||
task_id: number;
|
||||
kind: "company" | "root_domain" | "subdomain" | "ip" | "cidr";
|
||||
company_id?: number;
|
||||
company_name?: string; // 后端 JOIN companies 解析,仅 kind=company 有值
|
||||
domain?: string;
|
||||
net?: string;
|
||||
source: "auto" | "agent" | "manual";
|
||||
|
||||
Reference in new issue
Block a user