新增水质模拟模块;移除docker配置文件,现放置到后端项目中
This commit is contained in:
@@ -36,6 +36,7 @@ interface TimelineProps {
|
||||
timeRange?: { start: Date; end: Date };
|
||||
disableDateSelection?: boolean;
|
||||
schemeName?: string;
|
||||
schemeType?: string;
|
||||
}
|
||||
|
||||
const Timeline: React.FC<TimelineProps> = ({
|
||||
@@ -43,6 +44,7 @@ const Timeline: React.FC<TimelineProps> = ({
|
||||
timeRange,
|
||||
disableDateSelection = false,
|
||||
schemeName = "",
|
||||
schemeType = "burst_Analysis",
|
||||
}) => {
|
||||
const data = useData();
|
||||
if (!data) {
|
||||
@@ -100,7 +102,8 @@ const Timeline: React.FC<TimelineProps> = ({
|
||||
queryTime: Date,
|
||||
junctionProperties: string,
|
||||
pipeProperties: string,
|
||||
schemeName: string
|
||||
schemeName: string,
|
||||
schemeType: string
|
||||
) => {
|
||||
const query_time = queryTime.toISOString();
|
||||
let nodeRecords: any = { results: [] };
|
||||
@@ -110,14 +113,14 @@ const Timeline: React.FC<TimelineProps> = ({
|
||||
let linkPromise: Promise<any> | null = null;
|
||||
// 检查node缓存
|
||||
if (junctionProperties !== "" && junctionProperties !== "elevation") {
|
||||
const nodeCacheKey = `${query_time}_${junctionProperties}_${schemeName}`;
|
||||
const nodeCacheKey = `${query_time}_${junctionProperties}_${schemeName}_${schemeType}`;
|
||||
if (nodeCacheRef.current.has(nodeCacheKey)) {
|
||||
nodeRecords = nodeCacheRef.current.get(nodeCacheKey)!;
|
||||
} else {
|
||||
disableDateSelection && schemeName
|
||||
? (nodePromise = fetch(
|
||||
// `${backendUrl}/queryallschemerecordsbytimeproperty/?querytime=${query_time}&type=node&property=${junctionProperties}&schemename=${schemeName}`
|
||||
`${backendUrl}/timescaledb/scheme/query/by-scheme-time-property?scheme_type=burst_Analysis&scheme_name=${schemeName}&query_time=${query_time}&type=node&property=${junctionProperties}`
|
||||
`${backendUrl}/timescaledb/scheme/query/by-scheme-time-property?scheme_type=${schemeType}&scheme_name=${schemeName}&query_time=${query_time}&type=node&property=${junctionProperties}`
|
||||
))
|
||||
: (nodePromise = fetch(
|
||||
// `${backendUrl}/queryallrecordsbytimeproperty/?querytime=${query_time}&type=node&property=${junctionProperties}`
|
||||
@@ -131,14 +134,14 @@ const Timeline: React.FC<TimelineProps> = ({
|
||||
|
||||
// 检查link缓存
|
||||
if (pipeProperties !== "" && pipeProperties !== "diameter") {
|
||||
const linkCacheKey = `${query_time}_${pipeProperties}_${schemeName}`;
|
||||
const linkCacheKey = `${query_time}_${pipeProperties}_${schemeName}_${schemeType}`;
|
||||
if (linkCacheRef.current.has(linkCacheKey)) {
|
||||
linkRecords = linkCacheRef.current.get(linkCacheKey)!;
|
||||
} else {
|
||||
disableDateSelection && schemeName
|
||||
? (linkPromise = fetch(
|
||||
// `${backendUrl}/queryallschemerecordsbytimeproperty/?querytime=${query_time}&type=link&property=${pipeProperties}&schemename=${schemeName}`
|
||||
`${backendUrl}/timescaledb/scheme/query/by-scheme-time-property?scheme_type=burst_Analysis&scheme_name=${schemeName}&query_time=${query_time}&type=link&property=${pipeProperties}`
|
||||
`${backendUrl}/timescaledb/scheme/query/by-scheme-time-property?scheme_type=${schemeType}&scheme_name=${schemeName}&query_time=${query_time}&type=link&property=${pipeProperties}`
|
||||
))
|
||||
: (linkPromise = fetch(
|
||||
// `${backendUrl}/queryallrecordsbytimeproperty/?querytime=${query_time}&type=link&property=${pipeProperties}`
|
||||
@@ -158,7 +161,7 @@ const Timeline: React.FC<TimelineProps> = ({
|
||||
nodeRecords = await nodeResponse.json();
|
||||
// 缓存数据(修复键以包含 schemeName)
|
||||
nodeCacheRef.current.set(
|
||||
`${query_time}_${junctionProperties}_${schemeName}`,
|
||||
`${query_time}_${junctionProperties}_${schemeName}_${schemeType}`,
|
||||
nodeRecords || []
|
||||
);
|
||||
}
|
||||
@@ -169,7 +172,7 @@ const Timeline: React.FC<TimelineProps> = ({
|
||||
linkRecords = await linkResponse.json();
|
||||
// 缓存数据(修复键以包含 schemeName)
|
||||
linkCacheRef.current.set(
|
||||
`${query_time}_${pipeProperties}_${schemeName}`,
|
||||
`${query_time}_${pipeProperties}_${schemeName}_${schemeType}`,
|
||||
linkRecords || []
|
||||
);
|
||||
}
|
||||
@@ -389,10 +392,11 @@ const Timeline: React.FC<TimelineProps> = ({
|
||||
currentTimeToDate(selectedDate, currentTime),
|
||||
junctionText,
|
||||
pipeText,
|
||||
schemeName
|
||||
schemeName,
|
||||
schemeType
|
||||
);
|
||||
}
|
||||
}, [junctionText, pipeText, currentTime, selectedDate]);
|
||||
}, [junctionText, pipeText, currentTime, selectedDate, schemeName, schemeType]);
|
||||
|
||||
// 组件卸载时清理定时器和防抖
|
||||
useEffect(() => {
|
||||
@@ -469,7 +473,8 @@ const Timeline: React.FC<TimelineProps> = ({
|
||||
currentTimeToDate(selectedDate, currentTime),
|
||||
junctionText,
|
||||
pipeText,
|
||||
schemeName
|
||||
schemeName,
|
||||
schemeType
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user