feat(sensor-placement): add scheme engineering editor
This commit is contained in:
@@ -17,7 +17,7 @@ import {
|
||||
} from "@mui/material";
|
||||
import {
|
||||
Info as InfoIcon,
|
||||
LocationOn as LocationIcon,
|
||||
EditLocationAlt as EditIcon,
|
||||
} from "@mui/icons-material";
|
||||
import { DatePicker } from "@mui/x-date-pickers/DatePicker";
|
||||
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
|
||||
@@ -37,19 +37,10 @@ import VectorSource from "ol/source/Vector";
|
||||
import { Style, Icon, Circle, Fill, Stroke } from "ol/style";
|
||||
import Feature, { FeatureLike } from "ol/Feature";
|
||||
import { bbox, featureCollection } from "@turf/turf";
|
||||
import type { SchemeRecord } from "./types";
|
||||
import { useSchemeCreatorName } from "@components/olmap/core/useSchemeCreatorName";
|
||||
import { SchemeQueryEmptyState } from "@components/olmap/common/PanelEmptyState";
|
||||
|
||||
interface SchemeRecord {
|
||||
id: number;
|
||||
schemeName: string;
|
||||
sensorNumber: number;
|
||||
minDiameter: number;
|
||||
user: string;
|
||||
create_time: string;
|
||||
sensorLocation?: string[];
|
||||
}
|
||||
|
||||
interface SchemaItem {
|
||||
id: number;
|
||||
scheme_name: string;
|
||||
@@ -63,7 +54,7 @@ interface SchemaItem {
|
||||
interface SchemeQueryProps {
|
||||
schemes?: SchemeRecord[];
|
||||
onSchemesChange?: (schemes: SchemeRecord[]) => void;
|
||||
onLocate?: (id: number) => void;
|
||||
onEdit?: (id: number) => void;
|
||||
network?: string;
|
||||
state?: MonitoringSchemeQueryState;
|
||||
onStateChange?: (state: MonitoringSchemeQueryState) => void;
|
||||
@@ -87,7 +78,7 @@ export const createMonitoringSchemeQueryState =
|
||||
const SchemeQuery: React.FC<SchemeQueryProps> = ({
|
||||
schemes: externalSchemes,
|
||||
onSchemesChange,
|
||||
onLocate,
|
||||
onEdit,
|
||||
network = NETWORK_NAME,
|
||||
state,
|
||||
onStateChange,
|
||||
@@ -205,7 +196,7 @@ const SchemeQuery: React.FC<SchemeQueryProps> = ({
|
||||
schemeName: item.scheme_name,
|
||||
sensorNumber: item.sensor_number,
|
||||
minDiameter: item.min_diameter,
|
||||
user: item.username,
|
||||
username: item.username,
|
||||
create_time: item.create_time,
|
||||
sensorLocation: item.sensor_location,
|
||||
}));
|
||||
@@ -275,15 +266,6 @@ const SchemeQuery: React.FC<SchemeQueryProps> = ({
|
||||
setQueryField("expandedId", expandedId === id ? null : id);
|
||||
};
|
||||
|
||||
// 保存方案(示例功能)
|
||||
const handleSaveScheme = (scheme: SchemeRecord) => {
|
||||
open?.({
|
||||
type: "success",
|
||||
message: "保存成功",
|
||||
description: `方案 "${scheme.schemeName}" 已保存`,
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<Box className="flex flex-col h-full">
|
||||
{/* 查询条件 - 单行布局 */}
|
||||
@@ -379,8 +361,8 @@ const SchemeQuery: React.FC<SchemeQueryProps> = ({
|
||||
variant="caption"
|
||||
className="text-gray-500 block"
|
||||
>
|
||||
最小半径: {scheme.minDiameter} · 用户:{" "}
|
||||
{creatorName(scheme.user)} · 日期:{" "}
|
||||
最小管径: {scheme.minDiameter} · 用户:{" "}
|
||||
{creatorName(scheme.username)} · 日期:{" "}
|
||||
{formatShortDate(scheme.create_time)}
|
||||
</Typography>
|
||||
</Box>
|
||||
@@ -405,16 +387,6 @@ const SchemeQuery: React.FC<SchemeQueryProps> = ({
|
||||
<InfoIcon fontSize="small" />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
{/* <Tooltip title="定位">
|
||||
<IconButton
|
||||
size="small"
|
||||
onClick={() => onLocate?.(scheme.id)}
|
||||
color="primary"
|
||||
className="p-1"
|
||||
>
|
||||
<LocationIcon fontSize="small" />
|
||||
</IconButton>
|
||||
</Tooltip> */}
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
@@ -445,7 +417,7 @@ const SchemeQuery: React.FC<SchemeQueryProps> = ({
|
||||
variant="caption"
|
||||
className="text-gray-600 min-w-[70px]"
|
||||
>
|
||||
最小半径:
|
||||
最小管径:
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="caption"
|
||||
@@ -471,7 +443,7 @@ const SchemeQuery: React.FC<SchemeQueryProps> = ({
|
||||
variant="caption"
|
||||
className="font-medium text-gray-900"
|
||||
>
|
||||
{creatorName(scheme.user)}
|
||||
{creatorName(scheme.username)}
|
||||
</Typography>
|
||||
</Box>
|
||||
<Box className="flex items-center gap-2">
|
||||
@@ -552,13 +524,14 @@ const SchemeQuery: React.FC<SchemeQueryProps> = ({
|
||||
fullWidth
|
||||
size="small"
|
||||
className="bg-blue-600 hover:bg-blue-700"
|
||||
onClick={() => handleSaveScheme(scheme)}
|
||||
startIcon={<EditIcon />}
|
||||
onClick={() => onEdit?.(scheme.id)}
|
||||
sx={{
|
||||
textTransform: "none",
|
||||
fontWeight: 500,
|
||||
}}
|
||||
>
|
||||
保存方案
|
||||
打开结果编辑
|
||||
</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
Reference in New Issue
Block a user