设备配置参数(运行速度)
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 = {
|
const envConfig = {
|
||||||
[ENV.DEV]: {
|
[ENV.DEV]: {
|
||||||
//baseURL: 'http://192.168.2.59:8081',//http://192.168.2.56:8081
|
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
|
//baseURL: 'http://1.95.137.212:59015',//http://192.168.2.56:8081
|
||||||
//WS_URL: 'ws://192.168.2.59:9002/ws/',
|
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/',
|
|
||||||
mqtt_url: "ws://1.95.137.212:8083/mqtt",
|
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: 'http://1.95.137.212:59015',//http://192.168.2.56:8081
|
||||||
////baseURL: 'https://serviceri.satabot.com',
|
////baseURL: 'https://serviceri.satabot.com',
|
||||||
|
|||||||
@@ -406,7 +406,7 @@ export function getRouteByTask(params) {
|
|||||||
|
|
||||||
export function deleteRoute(workName) {
|
export function deleteRoute(workName) {
|
||||||
return request({
|
return request({
|
||||||
url: 'iot/workRecord/deleteByWorkName?workName=' + workName,
|
url: '/iot/workRecord/deleteByWorkName?workName=' + workName,
|
||||||
method: 'get',
|
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 SerialNumGenerate from "./SerialNumGenerate"
|
||||||
import { getPlaneDeviceList, bindDrone, unbindDrone, bindSmartDevice, unbindSmartDevice, getAllDevice } from '@/api/device';
|
import { getPlaneDeviceList, bindDrone, unbindDrone, bindSmartDevice, unbindSmartDevice, getAllDevice } from '@/api/device';
|
||||||
import { getOrgList } from '@/api/organization/index';
|
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 { getUser } from '@/api/user/index';
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
import { RootState } from '@/src/store';
|
import { RootState } from '@/src/store';
|
||||||
@@ -73,6 +73,7 @@ export default function DeviceManagementPage() {
|
|||||||
|
|
||||||
// 无人机相关状态
|
// 无人机相关状态
|
||||||
const { userInfo } = useSelector((state: RootState) => state.user);
|
const { userInfo } = useSelector((state: RootState) => state.user);
|
||||||
|
const { stationId } = useSelector((state: RootState) => state.station);
|
||||||
const [droneList, setDroneList] = useState([]);
|
const [droneList, setDroneList] = useState([]);
|
||||||
const [bindModalVisible, setBindModalVisible] = useState(false);
|
const [bindModalVisible, setBindModalVisible] = useState(false);
|
||||||
const [bindForm] = Form.useForm();
|
const [bindForm] = Form.useForm();
|
||||||
@@ -113,6 +114,12 @@ export default function DeviceManagementPage() {
|
|||||||
const [editSmartForm] = Form.useForm();
|
const [editSmartForm] = Form.useForm();
|
||||||
const [currentEditSmart, setCurrentEditSmart] = useState(null);
|
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 () => {
|
const fetchDroneList = async () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
@@ -155,6 +162,55 @@ export default function DeviceManagementPage() {
|
|||||||
setCurrentEditSmart(null);
|
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 () => {
|
const fetchSmartList = async () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
@@ -373,7 +429,6 @@ export default function DeviceManagementPage() {
|
|||||||
title: '操作', width: 280, key: 'action', fixed: 'right',
|
title: '操作', width: 280, key: 'action', fixed: 'right',
|
||||||
render: (_, record) => (
|
render: (_, record) => (
|
||||||
<Space>
|
<Space>
|
||||||
<Button size="small" icon={<EditOutlined />} onClick={() => openEditSmartModal(record)}>编辑</Button>
|
|
||||||
|
|
||||||
<Tooltip title="清除人员绑定">
|
<Tooltip title="清除人员绑定">
|
||||||
<Button size="small" icon={<DisconnectOutlined />} onClick={() => handleUnbindSmart([record.serialNumber], 1)}>用户</Button>
|
<Button size="small" icon={<DisconnectOutlined />} onClick={() => handleUnbindSmart([record.serialNumber], 1)}>用户</Button>
|
||||||
@@ -384,6 +439,8 @@ export default function DeviceManagementPage() {
|
|||||||
<Tooltip title="清除组织绑定">
|
<Tooltip title="清除组织绑定">
|
||||||
<Button size="small" icon={<DisconnectOutlined />} onClick={() => handleUnbindSmart([record.serialNumber], 3)}>组织</Button>
|
<Button size="small" icon={<DisconnectOutlined />} onClick={() => handleUnbindSmart([record.serialNumber], 3)}>组织</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
<Button size="small" icon={<EditOutlined />} onClick={() => openParamModal(record)}>参数</Button>
|
||||||
|
|
||||||
</Space>
|
</Space>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
@@ -688,6 +745,33 @@ export default function DeviceManagementPage() {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Form>
|
</Form>
|
||||||
</Modal>
|
</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' ? (
|
) : activeTab === 'drone' ? (
|
||||||
<>
|
<>
|
||||||
|
|||||||
Reference in New Issue
Block a user