机器人 无人机绑定 解绑分页查询 筛选 成功
This commit is contained in:
@@ -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
|
||||
})
|
||||
|
||||
@@ -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) => (
|
||||
<Space>
|
||||
<Tooltip title="清除人员绑定">
|
||||
<Button size="small" icon={<DisconnectOutlined />} onClick={() => handleUnbindSmart([record.deviceId || record.id], 1)}>用户</Button>
|
||||
<Button size="small" icon={<DisconnectOutlined />} onClick={() => handleUnbindSmart([record.serialNumber], 1)}>用户</Button>
|
||||
</Tooltip>
|
||||
<Tooltip title="清除场站绑定">
|
||||
<Button size="small" icon={<DisconnectOutlined />} onClick={() => handleUnbindSmart([record.deviceId || record.id], 2)}>场站</Button>
|
||||
<Button size="small" icon={<DisconnectOutlined />} onClick={() => handleUnbindSmart([record.serialNumber], 2)}>场站</Button>
|
||||
</Tooltip>
|
||||
<Tooltip title="清除组织绑定">
|
||||
<Button size="small" icon={<DisconnectOutlined />} onClick={() => handleUnbindSmart([record.deviceId || record.id], 3)}>组织</Button>
|
||||
<Button size="small" icon={<DisconnectOutlined />} onClick={() => handleUnbindSmart([record.serialNumber], 3)}>组织</Button>
|
||||
</Tooltip>
|
||||
</Space>
|
||||
),
|
||||
@@ -533,6 +534,14 @@ export default function DeviceManagementPage() {
|
||||
<>
|
||||
<div style={{ marginBottom: 16 }}>
|
||||
<Space>
|
||||
<Input
|
||||
placeholder="设备码"
|
||||
style={{ width: 240 }}
|
||||
value={smartParams.serialNumber}
|
||||
allowClear
|
||||
onChange={(e) => setSmartParams({ ...smartParams, serialNumber: e.target.value.trim() })}
|
||||
/>
|
||||
<Button icon={<ReloadOutlined />} onClick={() => setSmartParams({ pageNum: 1, pageSize: 10, serialNumber: '' })}>重置</Button>
|
||||
<Button type="primary" icon={<LinkOutlined />} onClick={openBindSmartModal}>绑定装备</Button>
|
||||
<Button disabled={selectedSmartKeys.length === 0} onClick={() => handleUnbindSmart(selectedSmartKeys, 1)}>批量解绑(用户)</Button>
|
||||
<Button disabled={selectedSmartKeys.length === 0} onClick={() => handleUnbindSmart(selectedSmartKeys, 2)}>批量解绑(场站)</Button>
|
||||
|
||||
@@ -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 || []) : [];
|
||||
|
||||
Reference in New Issue
Block a user