diff --git a/src/api/device.ts b/src/api/device.ts index 04ceb6a..114ba58 100644 --- a/src/api/device.ts +++ b/src/api/device.ts @@ -209,7 +209,7 @@ export function getSiteDevice(data) { export function getAllDevice(data) { return request({ - url: `/iot/device/getDeviceList `, + url: `/iot/device/getDeviceList`, method: 'get', params: data }) diff --git a/src/components/SystemSetting/DeviceManagement.tsx b/src/components/SystemSetting/DeviceManagement.tsx index ef3491f..61fc9e6 100644 --- a/src/components/SystemSetting/DeviceManagement.tsx +++ b/src/components/SystemSetting/DeviceManagement.tsx @@ -31,7 +31,7 @@ import { DisconnectOutlined, } from '@ant-design/icons'; import SerialNumGenerate from "./SerialNumGenerate" -import { getPlaneDeviceList, bindDrone, unbindDrone, bindSmartDevice, unbindSmartDevice, getSiteDevice } from '@/api/device'; +import { getPlaneDeviceList, bindDrone, unbindDrone, bindSmartDevice, unbindSmartDevice, getAllDevice } from '@/api/device'; import { getOrgList } from '@/api/organization/index'; import { getSiteByOrgId, getStationList } from '@/api/stationManage/index'; import { getUser } from '@/api/user/index'; @@ -95,6 +95,7 @@ export default function DeviceManagementPage() { const [smartParams, setSmartParams] = useState({ pageNum: 1, pageSize: 10, + serialNumber: '', }); const [smartTotal, setSmartTotal] = useState(0); @@ -127,7 +128,7 @@ export default function DeviceManagementPage() { const fetchSmartList = async () => { setLoading(true); try { - const res = await getSiteDevice(smartParams); + const res = await getAllDevice(smartParams); if (res.code === 200) { setSmartList(res.rows || []); setSmartTotal(res.total || res.rows.length); @@ -343,13 +344,13 @@ export default function DeviceManagementPage() { render: (_, record) => ( - + - + - + ), @@ -533,6 +534,14 @@ export default function DeviceManagementPage() { <>
+ setSmartParams({ ...smartParams, serialNumber: e.target.value.trim() })} + /> + diff --git a/src/pages/Devices.tsx b/src/pages/Devices.tsx index e8513d5..d3880c0 100644 --- a/src/pages/Devices.tsx +++ b/src/pages/Devices.tsx @@ -3,7 +3,7 @@ import { Layout, Typography, Menu, Tabs } from 'antd'; import { AimOutlined, AppstoreOutlined, SettingOutlined } from '@ant-design/icons'; import DeviceOverviewPage from '../components/devices/DeviceOverviewPage'; import DeviceStatusPage from '../components/devices/DeviceStatusPage'; -import { getDeviceListApi, getSiteUAVList } from '../api/device'; +import { getDeviceListApi, getSiteDevice, getSiteUAVList } from '../api/device'; import { useSelector } from 'react-redux'; import { RootState } from '../store'; import WayLinePage from '../components/devices/WayLinePage'; @@ -40,12 +40,12 @@ export default function DeviceIndexPage() { try { // 1. 同时发请求 const [deviceRes, planeRes] = await Promise.all([ - getDeviceListApi({ tenantName: userInfo.username, deptId: 1 }), + getSiteDevice({ siteId: stationId, pageSize: 9999, pageNum: 1 }), getSiteUAVList(stationId), ]); // 2. 处理普通设备 - const devData = deviceRes?.code === 200 ? (deviceRes.data || []) : []; + const devData = deviceRes?.code === 200 ? (deviceRes.rows || []) : []; // 3. 处理无人机 + 自动补全地图需要的字段(关键改动) let planeData = planeRes?.code === 200 ? (planeRes?.rows || []) : [];