侧边栏根据身份显示场站 优化首页加载慢的问题

This commit is contained in:
mmc
2026-09-20 13:05:11 +08:00
parent 9017cf9c87
commit 844216c525
14 changed files with 2466 additions and 2173 deletions

View File

@@ -39,6 +39,7 @@ export default function AppLayout() {
// 从 store 中同时取出 stationList(优先级最高,保证最新)
const { currentStation, stationId, stationList: storeStationList } = useSelector((state: RootState) => state.station);
// 真正用于展示和选择的列表:优先用 store 中的(StationManage 编辑后会同步),否则用本地接口的
const mergedStationList = storeStationList?.length ? storeStationList : stationList;
@@ -210,18 +211,21 @@ export default function AppLayout() {
</span>
)}
</div>
<Select
value={stationId}
placeholder={t('layout.selectStation')}
onChange={handleStationChange}
options={mergedStationList.map(s => ({ label: s.siteName, value: s.id }))}
style={{
width: 'clamp(160px, 15vw, 220px)',
backgroundColor: '#0837a8',
color: '#fff',
border: 'none',
}}
/>
{userInfo?.roleKey !== "personal" && (
<Select
value={stationId}
placeholder={t('layout.selectStation')}
onChange={handleStationChange}
options={mergedStationList.map(s => ({ label: s.siteName, value: s.id }))}
style={{
width: 'clamp(160px, 15vw, 220px)',
backgroundColor: '#0837a8',
color: '#fff',
border: 'none',
}}
/>
)}
</Space>
<Space size="middle" style={{ flexWrap: 'wrap' }}>