侧边栏根据身份显示场站 优化首页加载慢的问题
This commit is contained in:
@@ -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' }}>
|
||||
|
||||
Reference in New Issue
Block a user