diff --git a/wwwroot/api/bid_task_tree.dspy b/wwwroot/api/bid_task_tree.dspy index a77db28..3a44e0d 100644 --- a/wwwroot/api/bid_task_tree.dspy +++ b/wwwroot/api/bid_task_tree.dspy @@ -233,10 +233,17 @@ async with DBPools().sqlorContext(dbname) as sor: for t in role_tasks: if getattr(t, 'id', '') in reviewed_tids: continue + st = (getattr(t, 'state', '') or '').strip() + if st in ('cancelled', 'failed'): + continue # 失败/取消不算在办 try: qts = json.loads(getattr(t, 'params', '') or '{}').get('qc_types') or [] except Exception: qts = [] + if st in ('approved', 'completed'): + # 早期完成但无审核记录(记录被清理)→ 归遗留组,不算在办 + open_tasks.setdefault('__legacy__', []).append(t) + continue for qt in qts: open_tasks.setdefault(qt, []).append(t) if not qts: @@ -357,15 +364,21 @@ async with DBPools().sqlorContext(dbname) as sor: tid = getattr(t, 'id', '') if tid in reviewed_tids: continue + st0 = (getattr(t, 'state', '') or '').strip() try: qts = json.loads(getattr(t, 'params', '') or '{}').get('qc_types') or [] except Exception: qts = [] - if key == '__legacy__' and qts: - continue - if key != '__legacy__' and key not in qts: - continue - st = getattr(t, 'state', '') or '' + if key == '__legacy__': + # 遗留组:无审核记录的早期终态任务(在办任务归各自类型组) + if st0 in ('submitted', 'running', 'review', 'qc_review', 'waiting'): + continue + else: + if key not in qts: + continue + if st0 in ('cancelled', 'failed', 'approved', 'completed'): + continue # 终态且有审核记录的已在上面;无记录的归遗留组 + st = st0 nodes.append({ "id": tid, "label": "%s [%s] %s" % (_state_icons.get(st, '\u2b1c'),