个人中心加机器人生成配置界面
This commit is contained in:
@@ -10,6 +10,8 @@ import {
|
||||
message,
|
||||
Modal,
|
||||
Tabs,
|
||||
Card,
|
||||
InputNumber,
|
||||
} from 'antd';
|
||||
import {
|
||||
SearchOutlined,
|
||||
@@ -18,6 +20,7 @@ import {
|
||||
EditOutlined,
|
||||
DeleteOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import SerialNumGenerate from "./SerialNumGenerate"
|
||||
|
||||
// 模拟数据
|
||||
const allDeviceList = [
|
||||
@@ -43,6 +46,8 @@ const tabs = [
|
||||
{ key: 'smart', label: '智能装备', filter: (item) => ['CLEANING_DEVICE', 'ROBOT', 'DRONE'].includes(item.type) },
|
||||
];
|
||||
|
||||
|
||||
|
||||
export default function DeviceManagementPage() {
|
||||
const [activeTab, setActiveTab] = useState('all');
|
||||
const [form] = Form.useForm();
|
||||
@@ -50,7 +55,7 @@ export default function DeviceManagementPage() {
|
||||
const [deviceList, setDeviceList] = useState(allDeviceList);
|
||||
|
||||
// 根据 Tab 过滤数据
|
||||
const filteredByTab = deviceList.filter(tabs.find(t => t.key === activeTab).filter);
|
||||
const filteredByTab = deviceList.filter(tabs.find(t => t.key === activeTab)?.filter || (() => false));
|
||||
|
||||
// 表格列定义
|
||||
const columns = [
|
||||
@@ -144,40 +149,49 @@ export default function DeviceManagementPage() {
|
||||
<Tabs.TabPane key="all" tab="设备管理" />
|
||||
<Tabs.TabPane key="camera" tab="摄像头管理" />
|
||||
<Tabs.TabPane key="smart" tab="智能装备" />
|
||||
<Tabs.TabPane key="serialGenerate" tab="机器人生成" />
|
||||
</Tabs>
|
||||
|
||||
{/* 筛选栏 */}
|
||||
<div style={{ marginBottom: 16 }}>
|
||||
<Form form={form} layout="inline">
|
||||
<Form.Item name="keyword">
|
||||
<Input placeholder="请输入设备名称" style={{ width: 220 }} />
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<Button type="primary" icon={<SearchOutlined />} onClick={handleSearch}>查询</Button>
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<Button icon={<ReloadOutlined />} onClick={handleReset}>重置</Button>
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<Button type="primary" icon={<PlusOutlined />} onClick={handleAdd}>新增</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</div>
|
||||
{/* ====================== 判断显示内容 ====================== */}
|
||||
{activeTab === 'serialGenerate' ? (
|
||||
<SerialNumGenerate />
|
||||
) : (
|
||||
// 显示原来的设备列表
|
||||
<>
|
||||
{/* 筛选栏 */}
|
||||
<div style={{ marginBottom: 16 }}>
|
||||
<Form form={form} layout="inline">
|
||||
<Form.Item name="keyword">
|
||||
<Input placeholder="请输入设备名称" style={{ width: 220 }} />
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<Button type="primary" icon={<SearchOutlined />} onClick={handleSearch}>查询</Button>
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<Button icon={<ReloadOutlined />} onClick={handleReset}>重置</Button>
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<Button type="primary" icon={<PlusOutlined />} onClick={handleAdd}>新增</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</div>
|
||||
|
||||
{/* 表格 */}
|
||||
<Table
|
||||
rowKey="id"
|
||||
columns={columns}
|
||||
dataSource={filteredByTab}
|
||||
loading={loading}
|
||||
pagination={{
|
||||
total: filteredByTab.length,
|
||||
pageSize: 10,
|
||||
showSizeChanger: true,
|
||||
showQuickJumper: true,
|
||||
showTotal: (total) => `共 ${total} 条`,
|
||||
}}
|
||||
/>
|
||||
{/* 表格 */}
|
||||
<Table
|
||||
rowKey="id"
|
||||
columns={columns}
|
||||
dataSource={filteredByTab}
|
||||
loading={loading}
|
||||
pagination={{
|
||||
total: filteredByTab.length,
|
||||
pageSize: 10,
|
||||
showSizeChanger: true,
|
||||
showQuickJumper: true,
|
||||
showTotal: (total) => `共 ${total} 条`,
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user