两个地方的设备参数 组件 加上授权功能
This commit is contained in:
@@ -3,7 +3,7 @@ import {
|
||||
Layout, Card, Row, Col, Statistic, Tag, Button, Table,
|
||||
Typography, Space, Progress, Badge, Timeline, message,
|
||||
Select, Modal, Space as AntSpace,
|
||||
Input
|
||||
Input, Tooltip
|
||||
} from 'antd';
|
||||
import {
|
||||
EnvironmentOutlined, RobotOutlined, BranchesOutlined,
|
||||
@@ -27,7 +27,8 @@ import AgoraTextTest from '../AgoraRtc.tsx';
|
||||
import { useWebRTCPlayer } from '../useWebRTCStream.tsx';
|
||||
import VideoPlayer from '../VideoPlayer.tsx';
|
||||
import CesiumMap from '../Map.jsx';
|
||||
import { getUAVState, getSiteDevice, getSiteUAVList, getsinglePlan, getRobotTaskList, getDeviceTotalData, updateDeviceAliasApi } from '@/api/device.ts';
|
||||
import DeviceParamModal from './DeviceParamModal';
|
||||
import { getUAVState, getSiteDevice, getSiteUAVList, getsinglePlan, getRobotTaskList, getDeviceTotalData, updateDeviceAliasApi, hasPermission } from '@/api/device.ts';
|
||||
import dayjs from 'dayjs';
|
||||
import { useMqtt } from '@/hooks/useMqtt';
|
||||
import { useSelector } from 'react-redux';
|
||||
@@ -78,6 +79,11 @@ export default function DeviceOverviewPage() {
|
||||
const [currentEditRobot, setCurrentEditRobot] = useState(null);
|
||||
const [editAliasInput, setEditAliasInput] = useState('');
|
||||
const [editLoading, setEditLoading] = useState(false);
|
||||
|
||||
// 设备参数弹窗相关
|
||||
const [paramModalOpen, setParamModalOpen] = useState(false);
|
||||
const [currentParamDevice, setCurrentParamDevice] = useState<any>(null);
|
||||
|
||||
const navigate = useNavigate();
|
||||
console.log('stationId', stationId, currentStation);
|
||||
|
||||
@@ -414,6 +420,23 @@ export default function DeviceOverviewPage() {
|
||||
`webrtc://1.95.137.212/live/livestream/${selectedDevice?.serialNumber}`,
|
||||
);
|
||||
|
||||
const getDevivePermisstion = (data) => {
|
||||
const params = {
|
||||
deviceId: data.serialNumber,
|
||||
}
|
||||
|
||||
hasPermission(params).then(res => {
|
||||
if (res.code == 200) {
|
||||
if (res.data) {
|
||||
setCurrentParamDevice(data);
|
||||
setParamModalOpen(true);
|
||||
} else {
|
||||
utils.message.error('无权限');
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 顶部统计卡片
|
||||
|
||||
//feStatus; 1任务中 / 2空闲
|
||||
@@ -657,7 +680,7 @@ export default function DeviceOverviewPage() {
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 120,
|
||||
width: 150,
|
||||
//fixed: 'right',
|
||||
render: (_, record) => (
|
||||
<Space size={4}>
|
||||
@@ -669,7 +692,17 @@ export default function DeviceOverviewPage() {
|
||||
onClick={() => openEditRobotModal(record)}
|
||||
title="编辑"
|
||||
/>
|
||||
<Button size="small" type="text" icon={<SettingOutlined />} title="设置" />
|
||||
<Tooltip title="设备参数设置">
|
||||
<Button
|
||||
size="small"
|
||||
type="text"
|
||||
icon={<SettingOutlined />}
|
||||
onClick={() => {
|
||||
getDevivePermisstion(record);
|
||||
|
||||
}}
|
||||
/>
|
||||
</Tooltip>
|
||||
</Space>
|
||||
)
|
||||
}]}
|
||||
@@ -1027,6 +1060,19 @@ export default function DeviceOverviewPage() {
|
||||
)}
|
||||
</Modal>
|
||||
|
||||
{/* 设备参数查看与修改弹窗(通用组件) */}
|
||||
<DeviceParamModal
|
||||
open={paramModalOpen}
|
||||
device={currentParamDevice}
|
||||
onCancel={() => {
|
||||
setParamModalOpen(false);
|
||||
setCurrentParamDevice(null);
|
||||
}}
|
||||
onSuccess={() => {
|
||||
fetchAllData();
|
||||
}}
|
||||
/>
|
||||
|
||||
</Content>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user