chore(maps): update banzone display when alarm

This commit is contained in:
Tran Anh Tuan
2025-09-29 21:11:51 +07:00
parent ef353862e4
commit b44f1a9b29
11 changed files with 386 additions and 20 deletions

View File

@@ -3,11 +3,12 @@ import {
API_GET_GPS,
API_PATH_ENTITIES,
API_PATH_SHIP_INFO,
API_PATH_SHIP_TRACK_POINTS,
API_SOS,
} from '@/constants';
import { request } from '@umijs/max';
function transformEntityResponse(
export function transformEntityResponse(
raw: API.EntityResponse,
): API.TransformedEntity {
return {
@@ -19,7 +20,7 @@ function transformEntityResponse(
};
}
export async function getEntities(): Promise<API.TransformedEntity[]> {
export async function queryEntities(): Promise<API.TransformedEntity[]> {
const rawList = await request<API.EntityResponse[]>(API_PATH_ENTITIES);
return rawList.map(transformEntityResponse);
}
@@ -52,3 +53,7 @@ export async function sendSosMessage(message: string) {
},
});
}
export async function queryShipTrackPoints() {
return await request<API.ShipTrackPoint[]>(API_PATH_SHIP_TRACK_POINTS);
}

View File

@@ -1,4 +1,4 @@
import { API_GET_ALL_LAYER, API_GET_LAYER_INFO } from '@/constants';
import { API_GET_ALL_BANZONES, API_GET_ALL_LAYER, API_GET_LAYER_INFO } from '@/constants';
import { request } from '@umijs/max';
export async function getLayer(name: string) {
@@ -8,3 +8,7 @@ export async function getLayer(name: string) {
export async function getAllLayer() {
return request(API_GET_ALL_LAYER);
}
export async function queryBanzones() {
return request<API.Zone[]>(API_GET_ALL_BANZONES);
}

View File

@@ -124,6 +124,14 @@ declare namespace API {
fishing: boolean;
}
interface ShipTrackPoint {
time: number;
lon: number;
lat: number;
s: number;
h: number;
}
// Trips
interface FishingGear {
name: string;
@@ -328,4 +336,36 @@ declare namespace API {
evtid?: string;
content?: string;
}
// Banzone
export interface Zone {
id?: string;
name?: string;
type?: number;
conditions?: Condition[];
enabled?: boolean;
updated_at?: Date;
geom?: Geom;
}
export interface Condition {
max?: number;
min?: number;
type?: Type;
to?: number;
from?: number;
}
export enum Type {
LengthLimit = 'length_limit',
MonthRange = 'month_range',
}
export interface Geom {
geom_type?: number;
geom_poly?: string;
geom_lines?: string;
geom_point?: string;
geom_radius?: number;
}
}