Commit 0de83ea9 by luoqi

fix(web): 召回工作台左栏默认进「我的」,空则回落「召回池」

原 rail 默认 tab 写死 pool,而落地页选默认患者是 mine 优先 → 左栏 tab 与所选患者来源不符。
改为默认 view=mine,加载完成后若 total=0 自动回落 pool(autoFellBackRef 只一次,尊重后续手动切换)。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
parent 34283d42
Pipeline #3375 failed in 0 seconds
...@@ -50,7 +50,10 @@ export function PatientPickerRail({ ...@@ -50,7 +50,10 @@ export function PatientPickerRail({
const router = useRouter(); const router = useRouter();
const canViewAll = useHasPermission(Permission.PLAN_VIEW_ALL); const canViewAll = useHasPermission(Permission.PLAN_VIEW_ALL);
const [view, setView] = useState<View>('pool'); // 默认进「我的」;加载后若「我的」为空,自动回落「召回池」(见下方 effect)。
// 与落地页选默认患者同策略(mine 优先,空则 pool)。
const [view, setView] = useState<View>('mine');
const autoFellBackRef = useRef(false); // 只自动回落一次,之后尊重用户手动切换
const [search, setSearch] = useState(''); const [search, setSearch] = useState('');
const [keyword, setKeyword] = useState(''); // 防抖后的值(真正上服务端) const [keyword, setKeyword] = useState(''); // 防抖后的值(真正上服务端)
const composingRef = useRef(false); // 中文输入法组字中(true 时别拿拼音中间态"李石ming"去搜) const composingRef = useRef(false); // 中文输入法组字中(true 时别拿拼音中间态"李石ming"去搜)
...@@ -96,6 +99,16 @@ export function PatientPickerRail({ ...@@ -96,6 +99,16 @@ export function PatientPickerRail({
); );
const { items, total, loading, hasMore, error, loadMore, patchItem } = usePatientPicker(filters); const { items, total, loading, hasMore, error, loadMore, patchItem } = usePatientPicker(filters);
// 默认「我的」加载完成后若为空 → 自动回落「召回池」(只一次)。
// 与落地页 mine 优先、空则 pool 的默认患者策略一致,避免左栏 tab 与所选患者来源不符。
useEffect(() => {
if (autoFellBackRef.current) return;
if (view === 'mine' && !loading && total === 0) {
autoFellBackRef.current = true;
setView('pool');
}
}, [view, loading, total]);
// 右侧详情动作(提交归档等)→ 同步左栏对应行状态(不重拉) // 右侧详情动作(提交归档等)→ 同步左栏对应行状态(不重拉)
const sync = usePlanSyncStore(); const sync = usePlanSyncStore();
useEffect(() => { useEffect(() => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment