thêm zustand để cấu hình global state, hook để lấy platform, thêm polyline và polygon b vào map
This commit is contained in:
@@ -2,8 +2,10 @@ import { api } from "@/config";
|
||||
import {
|
||||
API_GET_ALARMS,
|
||||
API_GET_GPS,
|
||||
API_PATH_ENTITIES,
|
||||
API_PATH_SHIP_TRACK_POINTS,
|
||||
} from "@/constants";
|
||||
import { transformEntityResponse } from "@/utils/tranform";
|
||||
|
||||
export async function queryGpsData() {
|
||||
return api.get<Model.GPSResonse>(API_GET_GPS);
|
||||
@@ -16,3 +18,8 @@ export async function queryAlarm() {
|
||||
export async function queryTrackPoints() {
|
||||
return api.get<Model.ShipTrackPoint[]>(API_PATH_SHIP_TRACK_POINTS);
|
||||
}
|
||||
|
||||
export async function queryEntities(): Promise<Model.TransformedEntity[]> {
|
||||
const response = await api.get<Model.EntityResponse[]>(API_PATH_ENTITIES);
|
||||
return response.data.map(transformEntityResponse);
|
||||
}
|
||||
|
||||
6
controller/MapController.ts
Normal file
6
controller/MapController.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { api } from "@/config";
|
||||
import { API_GET_ALL_BANZONES } from "@/constants";
|
||||
|
||||
export async function queryBanzones() {
|
||||
return api.get<Model.Zone[]>(API_GET_ALL_BANZONES);
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import * as AuthController from "./AuthController";
|
||||
|
||||
export { AuthController };
|
||||
import * as DeviceController from "./DeviceController";
|
||||
import * as MapController from "./MapController";
|
||||
export { AuthController, DeviceController, MapController };
|
||||
|
||||
47
controller/typings.d.ts
vendored
47
controller/typings.d.ts
vendored
@@ -33,4 +33,51 @@ declare namespace Model {
|
||||
s: number;
|
||||
h: number;
|
||||
}
|
||||
interface EntityResponse {
|
||||
id: string;
|
||||
v: number;
|
||||
vs: string;
|
||||
t: number;
|
||||
type: string;
|
||||
}
|
||||
interface TransformedEntity {
|
||||
id: string;
|
||||
value: number;
|
||||
valueString: string;
|
||||
time: number;
|
||||
type: string;
|
||||
}
|
||||
|
||||
// Banzones
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user