Archived
三面拆分④:驾驶舱首页 —— 度量改接 report 真八指标,纠正率/DMN 不再恒为 0
治理台原先调 memory 的五指标版,还把 submissions/corrections/judgements 硬塞 0 —— 仪表在说谎。八指标本就在 report 里算好,这里接上,与工作台汇报同源同口径。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KeDBx2PHLavbURXB8LJJ7m
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import type { UseQueryResult } from '@tanstack/react-query';
|
||||
import type {
|
||||
ClosureReport,
|
||||
GovActivitiesOutput,
|
||||
GovApprovalsOutput,
|
||||
GovChannelsOutput,
|
||||
@@ -21,6 +22,7 @@ import type {
|
||||
GovToolsOutput,
|
||||
GovTriggersOutput,
|
||||
GovWorkflowOutput,
|
||||
ProcessPackage,
|
||||
} from '@contracts';
|
||||
import {
|
||||
browseLedgerRoute,
|
||||
@@ -39,6 +41,7 @@ import {
|
||||
listStaffRoute,
|
||||
listToolsRoute,
|
||||
listTriggersRoute,
|
||||
validateProcessRoute,
|
||||
} from '@contracts';
|
||||
import { call } from '@web-shared/typed-fetch.ts';
|
||||
|
||||
@@ -81,6 +84,27 @@ export const useGovGrants = (positionId: string | undefined): UseQueryResult<Gov
|
||||
export const useGovPackages = (): UseQueryResult<GovPackagesOutput> =>
|
||||
useQuery({ queryKey: ['gov', 'process'], queryFn: () => call<GovPackagesOutput>(listProcessPackagesRoute) });
|
||||
|
||||
/**
|
||||
* 每个包一份闭合报告 —— 磁贴上的「边 n/m」、待补清单、发布门、驾驶舱的未闭合草稿数都读它。
|
||||
* 一处算、多处读:两张首页各算一遍就会各说各话。
|
||||
*/
|
||||
export const useGovPkgReports = (
|
||||
packages: readonly ProcessPackage[],
|
||||
): UseQueryResult<Map<string, ClosureReport>> =>
|
||||
useQuery({
|
||||
queryKey: ['gov', 'process-reports', packages.map((p) => `${p.id}@${p.version}`).join(',')],
|
||||
enabled: packages.length > 0,
|
||||
queryFn: async () => {
|
||||
const entries = await Promise.all(
|
||||
packages.map(
|
||||
async (p) =>
|
||||
[`${p.id}@${p.version}`, await call<ClosureReport>(validateProcessRoute, { body: { pkg: p } })] as const,
|
||||
),
|
||||
);
|
||||
return new Map(entries);
|
||||
},
|
||||
});
|
||||
|
||||
export const useGovTriggers = (): UseQueryResult<GovTriggersOutput> =>
|
||||
useQuery({ queryKey: ['gov', 'triggers'], queryFn: () => call<GovTriggersOutput>(listTriggersRoute) });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user