From 2223112e0e42fd1f838323bc5db15e0e5c5f7625 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Thu, 3 Sep 2026 18:14:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=9C=A8=E5=8A=9E=E8=AE=A1=E6=95=B0?= =?UTF-8?q?=E6=8E=92=E9=99=A4=E7=BB=88=E6=80=81=E4=BB=BB=E5=8A=A1=EF=BC=88?= =?UTF-8?q?cancelled/failed/approved=E6=97=A0=E8=AE=B0=E5=BD=95=E5=BD=92?= =?UTF-8?q?=E9=81=97=E7=95=99=E7=BB=84=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wwwroot/api/bid_task_tree.dspy | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) 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'),