Complete incident selection and 112 to DDS workflow

This commit is contained in:
andreysk0304 2026-09-21 20:10:57 +03:00
commit 68dd83c7c2
21 changed files with 281 additions and 56 deletions

View file

@ -43,6 +43,9 @@ export interface ScenarioSummary {
topics: string[];
modes: SessionMode[];
dds: string | null;
ticket: number | null;
position: number | null;
ekp_group: number | null;
}
export interface SessionInfo {
@ -113,10 +116,23 @@ export interface SignsPage {
incident: { code: string; type: string; notify: string[] } | null;
}
export function useSigns(prefix: string[]) {
const query = prefix.map((sign) => `prefix=${encodeURIComponent(sign)}`).join("&");
export interface IncidentGroupsPage {
version: string;
groups: { id: number; title: string }[];
}
export const useIncidentGroups = () => useQuery({
queryKey: ["ekp-groups"], staleTime: Infinity,
queryFn: () => request<IncidentGroupsPage>("/api/ekp/groups"),
});
export function useSigns(prefix: string[], group: number | null = null) {
const params = new URLSearchParams();
if (group !== null) params.set("group", String(group));
for (const sign of prefix) params.append("prefix", sign);
const query = params.toString();
return useQuery({
queryKey: ["ekp-signs", prefix],
queryKey: ["ekp-signs", group, prefix],
// Справочник не меняется между занятиями — перезапрашивать незачем.
staleTime: Infinity,
queryFn: () => request<SignsPage>(`/api/ekp/signs${query ? `?${query}` : ""}`),

View file

@ -85,6 +85,7 @@ export interface CardBriefing {
text: string;
required_fields: Array<string>;
card?: KIO | null;
handoff_to_dds?: boolean;
}
export interface CardNext {
@ -280,6 +281,7 @@ export interface KIO {
floor?: string | null;
intercom_code?: string | null;
coords?: Coords | null;
incident_group?: number | null;
signs?: Array<string>;
/** Код ЕКП по признакам */
incident_code?: string | null;
@ -423,6 +425,7 @@ export interface ScenarioStart {
group_id?: string | null;
mode: SessionMode;
exercise?: Exercise;
handoff_to_dds?: boolean;
}
/** Коррекция оценки. Автооценка сохраняется рядом. */