import { Button, Input, Nav, Space, Tag, Toast } from '@douyinfe/semi-ui'; import { IconActivity, IconBarChartHStroked, IconHistogram, IconHome, IconMapPin, IconSearch, IconServer, IconSetting } from '@douyinfe/semi-icons'; import type { ReactNode } from 'react'; import { useState } from 'react'; export type PageKey = 'dashboard' | 'vehicles' | 'realtime' | 'detail' | 'history' | 'mileage' | 'quality'; const navItems = [ { itemKey: 'dashboard', text: '总览工作台', icon: }, { itemKey: 'vehicles', text: '车辆服务', icon: }, { itemKey: 'realtime', text: '实时车辆', icon: }, { itemKey: 'detail', text: '车辆详情', icon: }, { itemKey: 'history', text: '历史数据', icon: }, { itemKey: 'mileage', text: '里程统计', icon: }, { itemKey: 'quality', text: '质量治理', icon: } ]; function linkHealthClassName(count: number | null) { if (count == null) { return ''; } return count > 0 ? 'vp-link-health-button-warning' : 'vp-link-health-button-ok'; } export function AppShell({ activePage, linkIssueCount, onChange, onVehicleSearch, children }: { activePage: PageKey; linkIssueCount: number | null; onChange: (page: PageKey) => void; onVehicleSearch: (keyword: string) => void | Promise; children: ReactNode; }) { const [keyword, setKeyword] = useState(''); const [searching, setSearching] = useState(false); const search = () => { const value = keyword.trim(); if (!value) { Toast.warning('请输入 VIN / 车牌 / 手机号'); return; } setSearching(true); Promise.resolve(onVehicleSearch(value)).finally(() => setSearching(false)); }; return (
} placeholder="搜索 VIN / 车牌 / 手机号" value={keyword} onChange={setKeyword} onEnterPress={search} style={{ width: 320 }} /> 生产环境 多源接入 / 一个车辆服务
{children}
); }