设备配置参数(运行速度)
This commit is contained in:
20
env.js
20
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',
|
||||
|
||||
@@ -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) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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) => (
|
||||
<Space>
|
||||
<Button size="small" icon={<EditOutlined />} onClick={() => openEditSmartModal(record)}>编辑</Button>
|
||||
|
||||
<Tooltip title="清除人员绑定">
|
||||
<Button size="small" icon={<DisconnectOutlined />} onClick={() => handleUnbindSmart([record.serialNumber], 1)}>用户</Button>
|
||||
@@ -384,6 +439,8 @@ export default function DeviceManagementPage() {
|
||||
<Tooltip title="清除组织绑定">
|
||||
<Button size="small" icon={<DisconnectOutlined />} onClick={() => handleUnbindSmart([record.serialNumber], 3)}>组织</Button>
|
||||
</Tooltip>
|
||||
<Button size="small" icon={<EditOutlined />} onClick={() => openParamModal(record)}>参数</Button>
|
||||
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
@@ -688,6 +745,33 @@ export default function DeviceManagementPage() {
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
|
||||
{/* 设备参数管理弹窗 */}
|
||||
<Modal
|
||||
title={`设备参数管理 - ${currentParamDevice?.deviceAlias || currentParamDevice?.serialNumber}`}
|
||||
open={paramModalVisible}
|
||||
onCancel={() => {
|
||||
setParamModalVisible(false);
|
||||
setCurrentParamDevice(null);
|
||||
setParamData(null);
|
||||
}}
|
||||
footer={null}
|
||||
width={500}
|
||||
>
|
||||
{/* 显示和编辑参数 */}
|
||||
<Form
|
||||
form={paramForm}
|
||||
layout="vertical"
|
||||
onFinish={saveParam}
|
||||
>
|
||||
<Form.Item label="运行速度" name="runSpeed" rules={[{ required: true, message: '请输入运行速度' }]}>
|
||||
<InputNumber placeholder="请输入运行速度" style={{ width: '100%' }} />
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<Button type="primary" htmlType="submit">保存参数</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
</>
|
||||
) : activeTab === 'drone' ? (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user