From f8fef3e40bef53cee3d32f644b31dd70679e4220 Mon Sep 17 00:00:00 2001
From: mmc <1556375442@qq.com>
Date: Wed, 8 Jul 2026 14:17:23 +0800
Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E9=85=8D=E7=BD=AE=E5=8F=82?=
=?UTF-8?q?=E6=95=B0=EF=BC=88=E8=BF=90=E8=A1=8C=E9=80=9F=E5=BA=A6=EF=BC=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
env.js | 20 ++---
src/api/device.ts | 5 +-
src/api/stationManage/index.ts | 35 ++++++++
.../SystemSetting/DeviceManagement.tsx | 88 ++++++++++++++++++-
4 files changed, 135 insertions(+), 13 deletions(-)
diff --git a/env.js b/env.js
index 9fd367d..cac3477 100644
--- a/env.js
+++ b/env.js
@@ -9,17 +9,17 @@ const currentEnv = import.meta.env?.MODE || process.env.NODE_ENV;
// 环境配置映射
const envConfig = {
[ENV.DEV]: {
- //baseURL: 'http://192.168.2.59:8081',//http://192.168.2.56:8081
- ////baseURL: 'http://1.95.137.212:59015',//http://192.168.2.56:8081
- //WS_URL: 'ws://192.168.2.59:9002/ws/',
- //mqtt_url: "ws://1.95.137.212:8083/mqtt",
- //geoserver_url: "http://192.168.2.59:7000/geoserver"
-
- baseURL: 'http://1.95.137.212:8081',//http://192.168.2.56:8081
- //baseURL: 'https://serviceri.satabot.com',
- WS_URL: 'ws://1.95.137.212:9002/ws/',
+ baseURL: 'http://192.168.2.59:8081',//http://192.168.2.56:8081
+ //baseURL: 'http://1.95.137.212:59015',//http://192.168.2.56:8081
+ WS_URL: 'ws://192.168.2.59:9002/ws/',
mqtt_url: "ws://1.95.137.212:8083/mqtt",
- geoserver_url: "http://1.95.137.212:59018/geoserver"
+ geoserver_url: "http://192.168.2.59:7000/geoserver"
+
+ //baseURL: 'http://1.95.137.212:8081',//http://192.168.2.56:8081
+ ////baseURL: 'https://serviceri.satabot.com',
+ //WS_URL: 'ws://1.95.137.212:9002/ws/',
+ //mqtt_url: "ws://1.95.137.212:8083/mqtt",
+ //geoserver_url: "http://1.95.137.212:59018/geoserver"
//baseURL: 'http://1.95.137.212:59015',//http://192.168.2.56:8081
////baseURL: 'https://serviceri.satabot.com',
diff --git a/src/api/device.ts b/src/api/device.ts
index 1463f81..bde7af3 100644
--- a/src/api/device.ts
+++ b/src/api/device.ts
@@ -406,7 +406,7 @@ export function getRouteByTask(params) {
export function deleteRoute(workName) {
return request({
- url: 'iot/workRecord/deleteByWorkName?workName=' + workName,
+ url: '/iot/workRecord/deleteByWorkName?workName=' + workName,
method: 'get',
})
}
@@ -430,3 +430,6 @@ export function addRoute(data) {
+
+
+
diff --git a/src/api/stationManage/index.ts b/src/api/stationManage/index.ts
index f659a7f..7fb0be1 100644
--- a/src/api/stationManage/index.ts
+++ b/src/api/stationManage/index.ts
@@ -77,6 +77,41 @@ export function getSiteByOrgId(params) {
});
}
+//设备参数新增和修改 /iot/deviceRunParam/save
+export function deviceRunParamSave(data) {
+ return request({
+ url: '/iot/deviceRunParam/save',
+ method: 'post',
+ data
+ })
+}
+//设备参数查询/iot/deviceRunParam/list
+//export function deviceRunParamList(data) {
+// return request({
+// url: '/iot/deviceRunParam/list',
+// method: 'post',
+// data
+// })
+//}
+
+//根据设备查询/iot/deviceRunParam/selectByDeviceId
+export function deviceRunParamSelectByDeviceId(params) {
+ return request({
+ url: '/iot/deviceRunParam/selectByDeviceId',
+ method: 'get',
+ params
+ })
+}
+
+//删除设备参数/iot/deviceRunParam/delete
+export function deviceRunParamDelete(data) {
+ return request({
+ url: '/iot/deviceRunParam/delete',
+ method: 'post',
+ data
+ })
+}
+
diff --git a/src/components/SystemSetting/DeviceManagement.tsx b/src/components/SystemSetting/DeviceManagement.tsx
index 255aa5d..7d64fd7 100644
--- a/src/components/SystemSetting/DeviceManagement.tsx
+++ b/src/components/SystemSetting/DeviceManagement.tsx
@@ -33,7 +33,7 @@ import {
import SerialNumGenerate from "./SerialNumGenerate"
import { getPlaneDeviceList, bindDrone, unbindDrone, bindSmartDevice, unbindSmartDevice, getAllDevice } from '@/api/device';
import { getOrgList } from '@/api/organization/index';
-import { getSiteByOrgId, getStationList } from '@/api/stationManage/index';
+import { getSiteByOrgId, getStationList, deviceRunParamSelectByDeviceId, deviceRunParamSave, deviceRunParamDelete } from '@/api/stationManage/index';
import { getUser } from '@/api/user/index';
import { useSelector } from 'react-redux';
import { RootState } from '@/src/store';
@@ -73,6 +73,7 @@ export default function DeviceManagementPage() {
// 无人机相关状态
const { userInfo } = useSelector((state: RootState) => state.user);
+ const { stationId } = useSelector((state: RootState) => state.station);
const [droneList, setDroneList] = useState([]);
const [bindModalVisible, setBindModalVisible] = useState(false);
const [bindForm] = Form.useForm();
@@ -113,6 +114,12 @@ export default function DeviceManagementPage() {
const [editSmartForm] = Form.useForm();
const [currentEditSmart, setCurrentEditSmart] = useState(null);
+ // 设备参数管理相关状态
+ const [paramModalVisible, setParamModalVisible] = useState(false);
+ const [currentParamDevice, setCurrentParamDevice] = useState(null);
+ const [paramData, setParamData] = useState(null);
+ const [paramForm] = Form.useForm();
+
// 获取无人机列表(带分页 + 筛选)
const fetchDroneList = async () => {
setLoading(true);
@@ -155,6 +162,55 @@ export default function DeviceManagementPage() {
setCurrentEditSmart(null);
};
+ // 打开设备参数管理弹窗
+ const openParamModal = async (record) => {
+ setCurrentParamDevice(record);
+ setParamModalVisible(true);
+ await fetchParamData(record.serialNumber);
+ };
+
+ // 获取设备参数
+ const fetchParamData = async (deviceId) => {
+ try {
+ const res = await deviceRunParamSelectByDeviceId({ deviceId });
+ if (res.code == 200) {
+ if (res.data) {
+ setParamData(res.data);
+ paramForm.setFieldsValue({ runSpeed: res.data.runSpeed });
+ } else {
+ setParamData(null);
+ paramForm.setFieldsValue({ runSpeed: null });
+ }
+ } else {
+ utils.message.error(res.msg || '获取参数失败');
+ }
+ } catch (err) {
+ utils.message.error('获取参数失败');
+ }
+ };
+
+ // 保存参数
+ const saveParam = async (values) => {
+ try {
+ const payload = {
+ ...values,
+ deviceId: currentParamDevice.serialNumber,
+ siteId: stationId,
+ orgId: userInfo.orgId
+ };
+ const res = await deviceRunParamSave(payload);
+ if (res.code === 200) {
+ utils.message.success('保存参数成功');
+ setParamModalVisible(false);
+ //await fetchParamData(currentParamDevice.serialNumber);
+ } else {
+ utils.message.error(res.msg || '保存参数失败');
+ }
+ } catch (err) {
+ utils.message.error('操作异常');
+ }
+ };
+
const fetchSmartList = async () => {
setLoading(true);
try {
@@ -373,7 +429,6 @@ export default function DeviceManagementPage() {
title: '操作', width: 280, key: 'action', fixed: 'right',
render: (_, record) => (
- } onClick={() => openEditSmartModal(record)}>编辑
} onClick={() => handleUnbindSmart([record.serialNumber], 1)}>用户
@@ -384,6 +439,8 @@ export default function DeviceManagementPage() {
} onClick={() => handleUnbindSmart([record.serialNumber], 3)}>组织
+ } onClick={() => openParamModal(record)}>参数
+
),
},
@@ -688,6 +745,33 @@ export default function DeviceManagementPage() {
+
+ {/* 设备参数管理弹窗 */}
+ {
+ setParamModalVisible(false);
+ setCurrentParamDevice(null);
+ setParamData(null);
+ }}
+ footer={null}
+ width={500}
+ >
+ {/* 显示和编辑参数 */}
+
+
+
+
+
+
+
+
>
) : activeTab === 'drone' ? (
<>