feat(platform): route vehicle searches to detail
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Badge, Button, Input, Nav, Space, Tag, Typography } from '@douyinfe/semi-ui';
|
||||
import { Badge, Button, Input, Nav, Space, Tag, Toast, Typography } from '@douyinfe/semi-ui';
|
||||
import {
|
||||
IconActivity,
|
||||
IconBarChartHStroked,
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
IconSetting
|
||||
} from '@douyinfe/semi-icons';
|
||||
import type { ReactNode } from 'react';
|
||||
import { useState } from 'react';
|
||||
|
||||
export type PageKey = 'dashboard' | 'vehicles' | 'realtime' | 'detail' | 'history' | 'mileage' | 'quality';
|
||||
|
||||
@@ -26,12 +27,25 @@ const navItems = [
|
||||
export function AppShell({
|
||||
activePage,
|
||||
onChange,
|
||||
onVehicleSearch,
|
||||
children
|
||||
}: {
|
||||
activePage: PageKey;
|
||||
onChange: (page: PageKey) => void;
|
||||
onVehicleSearch: (keyword: string) => void;
|
||||
children: ReactNode;
|
||||
}) {
|
||||
const [keyword, setKeyword] = useState('');
|
||||
|
||||
const search = () => {
|
||||
const value = keyword.trim();
|
||||
if (!value) {
|
||||
Toast.warning('请输入 VIN / 车牌 / 手机号');
|
||||
return;
|
||||
}
|
||||
onVehicleSearch(value);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="vp-app">
|
||||
<div className="vp-shell">
|
||||
@@ -50,8 +64,15 @@ export function AppShell({
|
||||
<main className="vp-main">
|
||||
<header className="vp-topbar">
|
||||
<Space spacing={12}>
|
||||
<Input prefix={<IconSearch />} placeholder="搜索 VIN / 车牌 / 手机号" style={{ width: 320 }} />
|
||||
<Button theme="solid" type="primary">查询车辆</Button>
|
||||
<Input
|
||||
prefix={<IconSearch />}
|
||||
placeholder="搜索 VIN / 车牌 / 手机号"
|
||||
value={keyword}
|
||||
onChange={setKeyword}
|
||||
onEnterPress={search}
|
||||
style={{ width: 320 }}
|
||||
/>
|
||||
<Button theme="solid" type="primary" onClick={search}>查询车辆</Button>
|
||||
</Space>
|
||||
<Space spacing={12}>
|
||||
<Tag color="blue">生产环境</Tag>
|
||||
|
||||
Reference in New Issue
Block a user