feat: 本次提交更新内容如下

计划列表搜索框优化
This commit is contained in:
笔记本里的永平
2025-07-21 10:09:59 +08:00
parent f6f9e45198
commit 41a3399369
4 changed files with 56 additions and 61 deletions

View File

@@ -1,5 +1,6 @@
{
"name": "nkebao-base",
"license": "MIT",
"version": "0.1.0",
"private": true,
"dependencies": {

View File

@@ -13,6 +13,13 @@ export interface Task {
acquired?: number;
added?: number;
};
reqConf?: {
device?: string[];
selectedDevices?: string[];
};
acquiredCount?: number;
addedCount?: number;
passRate?: number;
}
export interface ApiSettings {

View File

@@ -1,7 +1,5 @@
.scenario-list-page {
padding: 16px;
background: #f5f5f5;
min-height: 100vh;
padding:0 16px;
}
.nav-title {
@@ -33,8 +31,8 @@
.search-bar {
display: flex;
gap: 12px;
margin-bottom: 16px;
align-items: center;
padding: 16px;
}
.search-input-wrapper {

View File

@@ -347,68 +347,59 @@ const ScenarioList: React.FC = () => {
},
];
if (loading) {
return (
<Layout
header={
<NavBar back={null} style={{ background: "#fff" }}>
<div className={style["nav-title"]}></div>
</NavBar>
}
footer={<MeauMobile />}
>
<div className={style["loading"]}>
<SpinLoading color="primary" style={{ fontSize: 32 }} />
<div className={style["loading-text"]}>...</div>
</div>
</Layout>
);
}
const deviceCount = (task: Task) => {
return Array.isArray(task.reqConf?.device)
? task.reqConf!.device.length
: Array.isArray(task.reqConf?.selectedDevices)
? task.reqConf!.selectedDevices.length
: 0;
};
return (
<Layout
header={
<NavBar
back={null}
style={{ background: "#fff" }}
left={<div className={style["nav-title"]}>{pageTitle}</div>}
right={
<>
<NavBar
back={null}
style={{ background: "#fff" }}
left={<div className={style["nav-title"]}>{pageTitle}</div>}
right={
<Button
size="small"
color="primary"
onClick={handleCreateNewPlan}
className={style["new-plan-btn"]}
>
<PlusOutlined />
</Button>
}
/>
{/* 搜索栏 */}
<div className={style["search-bar"]}>
<div className={style["search-input-wrapper"]}>
<Input
placeholder="搜索计划名称"
value={searchTerm}
onChange={(e) => setSearchTerm(e.target.value)}
prefix={<SearchOutlined />}
allowClear
size="large"
/>
</div>
<Button
size="small"
color="primary"
onClick={handleCreateNewPlan}
className={style["new-plan-btn"]}
onClick={handleRefresh}
loading={loadingTasks}
className={style["refresh-btn"]}
>
<PlusOutlined />
<ReloadOutlined />
</Button>
}
/>
</div>
</>
}
footer={<MeauMobile />}
loading={loading}
>
<div className={style["scenario-list-page"]}>
{/* 搜索栏 */}
<div className={style["search-bar"]}>
<div className={style["search-input-wrapper"]}>
<Input
placeholder="搜索计划名称"
value={searchTerm}
onChange={(e) => setSearchTerm(e.target.value)}
prefix={<SearchOutlined />}
allowClear
size="middle"
/>
</div>
<Button
size="small"
onClick={handleRefresh}
loading={loadingTasks}
className={style["refresh-btn"]}
>
<ReloadOutlined />
</Button>
</div>
{/* 计划列表 */}
<div className={style["plan-list"]}>
{filteredTasks.length === 0 ? (
@@ -450,19 +441,19 @@ const ScenarioList: React.FC = () => {
<div className={style["stat-item"]}>
<div className={style["stat-label"]}></div>
<div className={style["stat-value"]}>
{task.stats?.devices || 0}
{deviceCount(task)}
</div>
</div>
<div className={style["stat-item"]}>
<div className={style["stat-label"]}></div>
<div className={style["stat-value"]}>
{task.stats?.acquired || 0}
{task?.acquiredCount || 0}
</div>
</div>
<div className={style["stat-item"]}>
<div className={style["stat-label"]}></div>
<div className={style["stat-value"]}>
{task.stats?.added || 0}
{task.addedCount || 0}
</div>
</div>
<div className={style["stat-item"]}>
@@ -475,9 +466,7 @@ const ScenarioList: React.FC = () => {
<div className={style["plan-footer"]}>
<div className={style["last-execution"]}>
<ClockCircleOutlined />
<span>
: {formatTime(task.updated_at || task.created_at)}
</span>
<span>: {task.lastUpdated || "--"}</span>
</div>
</div>
</Card>