Files
smart-crop-ui/src/types/field.ts

217 lines
4.9 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 地块信息管理系统类型定义
// 地块基本信息
export interface Field {
id: string;
code: string; // 地块编号
name: string; // 地块名称
area: number; // 面积(亩)
perimeter: number; // 周长(米)
// 位置信息
location: string; // 所在位置
coordinates: GeoCoordinate[]; // 边界坐标点
centerPoint: {
lat: number;
lng: number;
};
// 土地属性
soilType: SoilType; // 土壤类型
landUseType: LandUseType; // 土地利用类型
plantingMode: PlantingMode; // 种植模式
// 权属信息
owner: string; // 权属人
ownerPhone?: string; // 联系电话
contractStartDate?: string; // 承包开始日期
contractEndDate?: string; // 承包结束日期
contractPeriod?: number; // 承包期限(年)
certificateNumber?: string; // 确权证号
// 标签和分类
tags: string[]; // 标签
category?: string; // 分类
// 附件
photos: string[]; // 照片
documents: FieldDocument[]; // 文档(合同扫描件等)
// 状态
status: 'normal' | 'pending'; // 使用状态:正常、待确认
// 元数据
createdAt: string;
updatedAt: string;
createdBy: string;
currentVersion: number; // 当前版本号
// 额外属性
elevation?: number; // 海拔(米)
slope?: number; // 坡度(度)
aspect?: string; // 坡向
waterSource?: string; // 水源情况
remarks?: string; // 备注
}
// 地理坐标
export interface GeoCoordinate {
lat: number;
lng: number;
}
// 土壤类型
export type SoilType =
| 'sandy' // 沙土
| 'loamy' // 壤土
| 'clay' // 粘土
| 'silt' // 淤泥土
| 'peat' // 泥炭土
| 'saline' // 盐碱土
| 'other'; // 其他
// 土地利用类型
export type LandUseType =
| 'farmland' // 耕地
| 'garden' // 园地
| 'forestland' // 林地
| 'grassland' // 草地
| 'other'; // 其他
// 种植模式
export type PlantingMode =
| 'open-field' // 露地
| 'greenhouse' // 大棚
| 'orchard' // 果园
| 'paddy' // 水田
| 'dryland'; // 旱地
// 灌溉方式
export type IrrigationType =
| 'drip' // 滴灌
| 'sprinkler' // 喷灌
| 'flood' // 漫灌
| 'micro-sprinkler' // 微喷
| 'none'; // 无灌溉
// 地块文档
export interface FieldDocument {
id: string;
name: string;
type: 'contract' | 'certificate' | 'permit' | 'other'; // 文档类型
url: string;
size: number; // 文件大小(字节)
uploadedAt: string;
uploadedBy: string;
}
// 地块版本历史
export interface FieldVersion {
id: string;
fieldId: string;
version: number;
changeType: 'create' | 'update-boundary' | 'update-attributes' | 'merge' | 'split';
changes: FieldVersionChange[];
coordinates?: GeoCoordinate[]; // 历史边界
attributes?: Partial<Field>; // 历史属性
changedBy: string;
changedAt: string;
remarks?: string;
}
// 版本变更详情
export interface FieldVersionChange {
field: string; // 字段名
oldValue: any;
newValue: any;
}
// 地块标签
export interface FieldTag {
id: string;
name: string;
color: string;
category?: string; // 标签分类
description?: string;
createdAt: string;
}
// 地块分类
export interface FieldCategory {
id: string;
name: string;
parentId?: string;
children?: FieldCategory[];
icon?: string;
color?: string;
}
// 地图图层类型
export type MapLayerType =
| 'satellite' // 卫星影像
| 'street' // 电子地图
| 'terrain' // 地形图
| 'hybrid'; // 混合
// 绘制工具类型
export type DrawToolType =
| 'none' // 无
| 'point' // 点
| 'line' // 线
| 'polygon' // 多边形
| 'rectangle' // 矩形
| 'circle'; // 圆形
// 编辑模式
export type EditMode =
| 'view' // 查看
| 'draw' // 绘制
| 'edit' // 编辑
| 'split' // 分割
| 'merge'; // 合并
// GIS文件格式
export type GISFileFormat = 'kml' | 'shp' | 'geojson' | 'gpx';
// 空间查询类型
export type SpatialQueryType =
| 'point-in-polygon' // 点在面内
| 'polygon-intersect' // 面相交
| 'polygon-adjacent' // 面相邻
| 'buffer'; // 缓冲区
// 遥感影像数据
export interface SatelliteImage {
id: string;
fieldId: string;
date: string; // 影像日期
source: string; // 数据源如Landsat, Sentinel等
cloudCover: number; // 云量百分比
resolution: number; // 分辨率(米)
url: string; // 影像URL
thumbnail?: string; // 缩略图
ndvi?: number; // 归一化植被指数
evi?: number; // 增强型植被指数
}
// 地块统计查询条件
export interface FieldQueryCondition {
soilType?: SoilType[];
plantingMode?: PlantingMode[];
minArea?: number;
maxArea?: number;
tags?: string[];
owner?: string;
status?: Field['status'][];
}
// 地块统计结果
export interface FieldStatistics {
totalCount: number;
totalArea: number;
averageArea: number;
bySoilType: Record<SoilType, number>;
byPlantingMode: Record<PlantingMode, number>;
byStatus: Record<Field['status'], number>;
}