refactor: simplify knowledge map option

This commit is contained in:
xuelong committed 2026-08-26 01:16:38 -07:00
1 parent 988fc66438
commit 968c0bc2be
2 files changed
+4 -66

No files matched your search

+4 -37
View File
@@ -10,7 +10,6 @@ import {
Input,
List,
Modal,
Select,
Space,
Spin,
Steps,
@@ -25,7 +24,6 @@ import {
CheckCircleOutlined,
DeleteOutlined,
EditOutlined,
EnvironmentOutlined,
FolderOutlined,
InboxOutlined,
MoreOutlined,
@@ -48,7 +46,6 @@ import {
type ProjectDeletionImpact,
type ProjectSummary,
type GraphReleaseSummary,
type SpatialMapScope,
} from "./api";
import {
mergeProjectCatalogItem,
@@ -62,7 +59,6 @@ type BasicProjectValues = {
project_id: string;
display_name: string;
map_enabled: boolean;
map_scope: SpatialMapScope;
};
type GraphImportData = {
@@ -79,11 +75,6 @@ const SAFE_RESOURCE_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_.-]{0,127}$/;
const SAFE_SCHEMA_IDENTIFIER_PATTERN = /^[A-Za-z_][A-Za-z0-9_]{0,127}$/;
const SAFE_SCHEMA_VERSION_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
const MAP_SCOPE_LABELS: Record<SpatialMapScope, string> = {
libo: "荔波县知识地图",
guizhou: "贵州省知识地图",
};
const FIELD_TYPE_ALIASES: Record<string, string> = {
str: "string",
text: "string",
@@ -726,7 +717,6 @@ export default function ProjectLanding() {
project_id: values.project_id.trim(),
display_name: values.display_name.trim(),
map_enabled: Boolean(values.map_enabled),
map_scope: values.map_scope || "libo",
};
setCheckingBasics(true);
try {
@@ -837,7 +827,7 @@ export default function ProjectLanding() {
display_name: basicValues.display_name,
spatial_map: {
enabled: basicValues.map_enabled,
scope: basicValues.map_scope,
scope: "libo",
},
schema: schemaResult.value,
graph_data: graphResult.value,
@@ -1071,7 +1061,7 @@ export default function ProjectLanding() {
layout="vertical"
className="project-basic-form"
disabled={checkingBasics}
initialValues={{ map_enabled: false, map_scope: "libo" }}
initialValues={{ map_enabled: false }}
>
<div className="project-form-grid">
<Form.Item
@@ -1097,32 +1087,11 @@ export default function ProjectLanding() {
</Form.Item>
</div>
<div className="project-map-option">
<div className="project-map-option-copy">
<span className="project-map-option-icon"><EnvironmentOutlined /></span>
<div>
<Text strong>在数据大屏显示知识地图</Text>
<Text type="secondary">
适用于包含经纬度的酒店、美食、景点、交通等空间数据;与项目英文标识无关。
</Text>
</div>
</div>
<Text strong>知识地图</Text>
<Form.Item name="map_enabled" valuePropName="checked" noStyle>
<Switch checkedChildren="显示" unCheckedChildren="不显示" />
</Form.Item>
</div>
<Form.Item noStyle shouldUpdate={(previous, current) => previous.map_enabled !== current.map_enabled}>
{({ getFieldValue }) => getFieldValue("map_enabled") ? (
<Form.Item
label="地图展示范围"
name="map_scope"
className="project-map-scope"
>
<Select
options={Object.entries(MAP_SCOPE_LABELS).map(([value, label]) => ({ value, label }))}
/>
</Form.Item>
) : null}
</Form.Item>
<Alert
type="info"
showIcon
@@ -1234,9 +1203,7 @@ export default function ProjectLanding() {
<Descriptions.Item label="项目名称">{basicValues?.display_name || "-"}</Descriptions.Item>
<Descriptions.Item label="项目英文标识">{basicValues?.project_id || "-"}</Descriptions.Item>
<Descriptions.Item label="知识地图" span={2}>
{basicValues?.map_enabled
? `显示 · ${MAP_SCOPE_LABELS[basicValues.map_scope]}`
: "不显示"}
{basicValues?.map_enabled ? "显示" : "不显示"}
</Descriptions.Item>
</Descriptions>
<Alert
-29
View File
@@ -2540,35 +2540,6 @@ body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Ro
background: #f7faff;
}
.project-map-option-copy {
display: flex;
align-items: flex-start;
gap: 12px;
min-width: 0;
}
.project-map-option-copy > div {
display: flex;
flex-direction: column;
gap: 3px;
}
.project-map-option-icon {
display: inline-flex;
align-items: center;
justify-content: center;
flex: 0 0 auto;
width: 32px;
height: 32px;
color: #1677ff;
border-radius: 8px;
background: #e6f4ff;
}
.project-map-scope {
max-width: 360px;
}
.project-json-step {
display: flex;
flex-direction: column;