feat(ui): 统一面板空状态引导

This commit is contained in:
2026-07-30 14:34:43 +08:00
parent 8836549697
commit 04557b9363
21 changed files with 400 additions and 435 deletions
@@ -43,6 +43,7 @@ import Timeline from "@components/olmap/core/Controls/Timeline";
import { SchemeRecord, SchemaItem } from "./types";
import { FLOW_DISPLAY_UNIT } from "@utils/units";
import { useSchemeCreatorName } from "@components/olmap/core/useSchemeCreatorName";
import { SchemeQueryEmptyState } from "@components/olmap/common/PanelEmptyState";
interface SchemeQueryProps {
schemes?: SchemeRecord[];
@@ -61,6 +62,7 @@ export interface FlushingSchemeQueryState {
showTimeline: boolean;
selectedDate: Date | undefined;
timeRange: { start: Date; end: Date } | undefined;
hasQueried: boolean;
}
export const createFlushingSchemeQueryState =
@@ -71,6 +73,7 @@ export const createFlushingSchemeQueryState =
showTimeline: false,
selectedDate: undefined,
timeRange: undefined,
hasQueried: false,
});
const SchemeQuery: React.FC<SchemeQueryProps> = ({
@@ -92,6 +95,7 @@ const SchemeQuery: React.FC<SchemeQueryProps> = ({
showTimeline,
selectedDate,
timeRange,
hasQueried,
} = queryState;
const [internalSchemes, setInternalSchemes] = useState<SchemeRecord[]>([]);
const [loading, setLoading] = useState<boolean>(false);
@@ -298,6 +302,7 @@ const SchemeQuery: React.FC<SchemeQueryProps> = ({
schemeDetail: item.scheme_detail,
}));
setSchemes(nextSchemes);
setQueryField("hasQueried", true);
if (filteredResults.length === 0) {
open?.({
@@ -371,7 +376,10 @@ const SchemeQuery: React.FC<SchemeQueryProps> = ({
control={
<Checkbox
checked={queryAll}
onChange={(e) => setQueryField("queryAll", e.target.checked)}
onChange={(e) => {
setQueryField("queryAll", e.target.checked);
setQueryField("hasQueried", false);
}}
size="small"
/>
}
@@ -384,9 +392,12 @@ const SchemeQuery: React.FC<SchemeQueryProps> = ({
>
<DatePicker
value={queryDate}
onChange={(value) =>
value && dayjs.isDayjs(value) && setQueryField("queryDate", value)
}
onChange={(value) => {
if (value && dayjs.isDayjs(value)) {
setQueryField("queryDate", value);
setQueryField("hasQueried", false);
}
}}
format="YYYY-MM-DD"
disabled={queryAll}
slotProps={{
@@ -414,39 +425,7 @@ const SchemeQuery: React.FC<SchemeQueryProps> = ({
{/* Results List */}
<Box className="flex-1 overflow-auto">
{sortedSchemes.length === 0 ? (
<Box className="flex flex-col items-center justify-center h-full text-gray-400">
<Box className="mb-4">
<svg
width="80"
height="80"
viewBox="0 0 80 80"
fill="none"
className="opacity-40"
>
<rect
x="10"
y="20"
width="60"
height="45"
rx="2"
stroke="currentColor"
strokeWidth="2"
/>
<line
x1="10"
y1="30"
x2="70"
y2="30"
stroke="currentColor"
strokeWidth="2"
/>
</svg>
</Box>
<Typography variant="body2"> 0 </Typography>
<Typography variant="body2" className="mt-1">
No data
</Typography>
</Box>
<SchemeQueryEmptyState hasQueried={hasQueried} />
) : (
<Box className="space-y-2 p-2">
<Typography variant="caption" className="text-gray-500 px-2">