生产管理系统前端 - 瓦力提交代码&文档更新
This commit is contained in:
@@ -10,6 +10,10 @@ import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, Di
|
||||
import { Label } from '../ui/label';
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '../ui/table';
|
||||
import { Switch } from '../ui/switch';
|
||||
import { WaterFertilizerDevice } from './WaterFertilizerDevice';
|
||||
import { WaterFertilizerComponent } from './WaterFertilizerComponent';
|
||||
import { WaterFertilizerParameter } from './WaterFertilizerParameter';
|
||||
import { WaterFertilizerMapping } from './WaterFertilizerMapping';
|
||||
import {
|
||||
Search,
|
||||
Plus,
|
||||
@@ -122,6 +126,26 @@ interface DeviceMapping {
|
||||
}
|
||||
|
||||
export function WaterFertilizerManagement({ activePath }: WaterFertilizerManagementProps) {
|
||||
// 如果是水肥机设备页面,直接渲染专门的设备管理组件
|
||||
if (activePath?.includes('/device')) {
|
||||
return <WaterFertilizerDevice />;
|
||||
}
|
||||
|
||||
// 如果是水肥机部件配置页面,直接渲染专门的部件配置组件
|
||||
if (activePath?.includes('/component')) {
|
||||
return <WaterFertilizerComponent />;
|
||||
}
|
||||
|
||||
// 如果是水肥机参数配置页面,直接渲染专门的参数配置组件
|
||||
if (activePath?.includes('/parameter')) {
|
||||
return <WaterFertilizerParameter />;
|
||||
}
|
||||
|
||||
// 如果是水肥设备映射页面,直接渲染专门的映射管理组件
|
||||
if (activePath?.includes('/mapping')) {
|
||||
return <WaterFertilizerMapping />;
|
||||
}
|
||||
|
||||
const [activeTab, setActiveTab] = useState('device');
|
||||
const [showDeviceDialog, setShowDeviceDialog] = useState(false);
|
||||
const [showComponentDialog, setShowComponentDialog] = useState(false);
|
||||
@@ -134,9 +158,7 @@ export function WaterFertilizerManagement({ activePath }: WaterFertilizerManagem
|
||||
// 根据路径自动切换Tab
|
||||
useEffect(() => {
|
||||
if (activePath) {
|
||||
if (activePath.includes('/device')) {
|
||||
setActiveTab('device');
|
||||
} else if (activePath.includes('/component')) {
|
||||
if (activePath.includes('/component')) {
|
||||
setActiveTab('component');
|
||||
} else if (activePath.includes('/parameter')) {
|
||||
setActiveTab('parameter');
|
||||
|
||||
Reference in New Issue
Block a user