基本设备 设备接入接口
This commit is contained in:
@@ -39,6 +39,16 @@ export function addProduct(data) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//协议查询
|
||||||
|
|
||||||
|
export function getConnectTypes(params) {
|
||||||
|
return request({
|
||||||
|
url: '/system/devicemodel/connectTypes',
|
||||||
|
method: 'get',
|
||||||
|
params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -172,222 +172,234 @@ const BasicSettings = () => {
|
|||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
<Row gutter={16}>
|
<Row
|
||||||
|
gutter={16}
|
||||||
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'stretch', // 关键:等高
|
||||||
|
}}
|
||||||
|
>
|
||||||
{/* 左侧主内容 */}
|
{/* 左侧主内容 */}
|
||||||
<Col span={16}>
|
<Col span={16} style={{ display: 'flex', flexDirection: 'column' }}>
|
||||||
{/* 平台参数 */}
|
<div style={{ flex: 1 }}>
|
||||||
<AntdCard title="平台参数" style={{ marginBottom: 16 }}>
|
{/* 平台参数 */}
|
||||||
<Form form={form} layout="vertical">
|
<AntdCard title="平台参数" style={{ marginBottom: 16 }}>
|
||||||
<Row gutter={16}>
|
<Form form={form} layout="vertical">
|
||||||
<Col span={12}>
|
<Row gutter={16}>
|
||||||
<Form.Item label="系统名称" name="systemName">
|
<Col span={12}>
|
||||||
<Input defaultValue="光伏场站智能监控与运维系统" />
|
<Form.Item label="系统名称" name="systemName">
|
||||||
</Form.Item>
|
<Input defaultValue="光伏场站智能监控与运维系统" />
|
||||||
|
</Form.Item>
|
||||||
|
</Col>
|
||||||
|
<Col span={12}>
|
||||||
|
<Form.Item label="默认电站" name="defaultSite">
|
||||||
|
<Select defaultValue="1MW 光伏电站">
|
||||||
|
<Select.Option value="1MW">1MW 光伏电站</Select.Option>
|
||||||
|
</Select>
|
||||||
|
</Form.Item>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
<Row gutter={16}>
|
||||||
|
<Col span={12}>
|
||||||
|
<Form.Item label="数据刷新频率" name="refreshRate">
|
||||||
|
<Select defaultValue="5分钟">
|
||||||
|
<Select.Option value="5">5分钟</Select.Option>
|
||||||
|
</Select>
|
||||||
|
</Form.Item>
|
||||||
|
</Col>
|
||||||
|
<Col span={12}>
|
||||||
|
<Form.Item label="地图服务" name="mapService">
|
||||||
|
<Select defaultValue="高德地图">
|
||||||
|
<Select.Option value="amap">高德地图</Select.Option>
|
||||||
|
</Select>
|
||||||
|
</Form.Item>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
<Form.Item label="AI建议自动生成" valuePropName="checked">
|
||||||
|
<Switch defaultChecked />
|
||||||
|
</Form.Item>
|
||||||
|
</Form>
|
||||||
|
</AntdCard>
|
||||||
|
|
||||||
|
{/* 通知与告警策略 */}
|
||||||
|
<AntdCard title="通知与告警策略" style={{ marginBottom: 16 }}>
|
||||||
|
<Row gutter={16} style={{ marginBottom: 16 }}>
|
||||||
|
<Col span={8}>
|
||||||
|
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '12px 16px', border: '1px solid #e8e8e8', borderRadius: 8 }}>
|
||||||
|
<Text strong>短信</Text>
|
||||||
|
<Switch defaultChecked />
|
||||||
|
</div>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={8}>
|
||||||
<Form.Item label="默认电站" name="defaultSite">
|
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '12px 16px', border: '1px solid #e8e8e8', borderRadius: 8 }}>
|
||||||
<Select defaultValue="1MW 光伏电站">
|
<Text strong>邮件</Text>
|
||||||
<Select.Option value="1MW">1MW 光伏电站</Select.Option>
|
<Switch defaultChecked />
|
||||||
</Select>
|
</div>
|
||||||
</Form.Item>
|
</Col>
|
||||||
|
<Col span={8}>
|
||||||
|
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '12px 16px', border: '1px solid #e8e8e8', borderRadius: 8 }}>
|
||||||
|
<Text strong>企业微信</Text>
|
||||||
|
<Switch defaultChecked />
|
||||||
|
</div>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
<Row gutter={16}>
|
<Row gutter={16}>
|
||||||
<Col span={12}>
|
<Col span={8}>
|
||||||
<Form.Item label="数据刷新频率" name="refreshRate">
|
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '12px 16px', border: '1px solid #e8e8e8', borderRadius: 8 }}>
|
||||||
<Select defaultValue="5分钟">
|
<Text strong>系统通知</Text>
|
||||||
<Select.Option value="5">5分钟</Select.Option>
|
<Switch defaultChecked />
|
||||||
</Select>
|
</div>
|
||||||
</Form.Item>
|
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={8}>
|
||||||
<Form.Item label="地图服务" name="mapService">
|
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '12px 16px', border: '1px solid #e8e8e8', borderRadius: 8 }}>
|
||||||
<Select defaultValue="高德地图">
|
<Text strong>严重告警立即通知</Text>
|
||||||
<Select.Option value="amap">高德地图</Select.Option>
|
<Switch defaultChecked />
|
||||||
</Select>
|
</div>
|
||||||
</Form.Item>
|
</Col>
|
||||||
|
<Col span={8}>
|
||||||
|
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '12px 16px', border: '1px solid #e8e8e8', borderRadius: 8 }}>
|
||||||
|
<Text strong>通信中断通知</Text>
|
||||||
|
<Switch defaultChecked />
|
||||||
|
</div>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
<Form.Item label="AI建议自动生成" valuePropName="checked">
|
</AntdCard>
|
||||||
<Switch defaultChecked />
|
|
||||||
</Form.Item>
|
|
||||||
</Form>
|
|
||||||
</AntdCard>
|
|
||||||
|
|
||||||
{/* 通知与告警策略 */}
|
{/* 用户与权限预览 */}
|
||||||
<AntdCard title="通知与告警策略" style={{ marginBottom: 16 }}>
|
<AntdCard title="用户与权限预览" style={{ marginBottom: 16 }}>
|
||||||
<Row gutter={16} style={{ marginBottom: 16 }}>
|
<Table
|
||||||
<Col span={8}>
|
size="small"
|
||||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '12px 16px', border: '1px solid #e8e8e8', borderRadius: 8 }}>
|
pagination={false}
|
||||||
<Text strong>短信</Text>
|
columns={[
|
||||||
<Switch defaultChecked />
|
{ title: '用户名', dataIndex: 'name' },
|
||||||
</div>
|
{ title: '角色', dataIndex: 'role' },
|
||||||
</Col>
|
{ title: '手机号', dataIndex: 'phone' },
|
||||||
<Col span={8}>
|
{ title: '状态', dataIndex: 'status', render: (text) => <span style={{ color: '#52c41a' }}>{text}</span> },
|
||||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '12px 16px', border: '1px solid #e8e8e8', borderRadius: 8 }}>
|
]}
|
||||||
<Text strong>邮件</Text>
|
dataSource={[
|
||||||
<Switch defaultChecked />
|
{ name: '张运维', role: '超级管理员', phone: '138****0001', status: '在线' },
|
||||||
</div>
|
{ name: '李工程师', role: '运维工程师', phone: '139****0002', status: '在线' },
|
||||||
</Col>
|
{ name: '王班长', role: '巡检主管', phone: '137****0003', status: '在线' },
|
||||||
<Col span={8}>
|
{ name: '赵分析师', role: '数据分析师', phone: '136****0004', status: '在线' },
|
||||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '12px 16px', border: '1px solid #e8e8e8', borderRadius: 8 }}>
|
]}
|
||||||
<Text strong>企业微信</Text>
|
/>
|
||||||
<Switch defaultChecked />
|
</AntdCard>
|
||||||
</div>
|
{/* MQTT接入状态 */}
|
||||||
</Col>
|
<AntdCard title="MQTT接入状态" style={{ marginBottom: 16 }}>
|
||||||
</Row>
|
<div style={{ fontSize: 13, color: '#666', marginBottom: 16 }}>来自 /pv/mqtt/status,后端未登录时显示预览兜底数据</div>
|
||||||
<Row gutter={16}>
|
<Row gutter={16}>
|
||||||
<Col span={8}>
|
{mqttStatusData.map((item, index) => (
|
||||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '12px 16px', border: '1px solid #e8e8e8', borderRadius: 8 }}>
|
<Col span={12} key={index}>
|
||||||
<Text strong>系统通知</Text>
|
<div style={{ border: '1px solid #e8e8e8', borderRadius: 8, padding: 12, marginBottom: 16 }}>
|
||||||
<Switch defaultChecked />
|
<div style={{ fontSize: 13, color: '#666', marginBottom: 4 }}>{item.name}</div>
|
||||||
</div>
|
<div style={{ fontSize: 16, fontWeight: 600, color: item.statusColor || '#333' }}>{item.value}</div>
|
||||||
</Col>
|
</div>
|
||||||
<Col span={8}>
|
</Col>
|
||||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '12px 16px', border: '1px solid #e8e8e8', borderRadius: 8 }}>
|
))}
|
||||||
<Text strong>严重告警立即通知</Text>
|
</Row>
|
||||||
<Switch defaultChecked />
|
</AntdCard>
|
||||||
</div>
|
|
||||||
</Col>
|
|
||||||
<Col span={8}>
|
|
||||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '12px 16px', border: '1px solid #e8e8e8', borderRadius: 8 }}>
|
|
||||||
<Text strong>通信中断通知</Text>
|
|
||||||
<Switch defaultChecked />
|
|
||||||
</div>
|
|
||||||
</Col>
|
|
||||||
</Row>
|
|
||||||
</AntdCard>
|
|
||||||
|
|
||||||
{/* 用户与权限预览 */}
|
{/* MQTT消息日志 */}
|
||||||
<AntdCard title="用户与权限预览">
|
<AntdCard title="MQTT消息日志" style={{ marginBottom: 16 }}>
|
||||||
<Table
|
<div style={{ fontSize: 13, color: '#666', marginBottom: 16 }}>阶段3A用于验证遥测原始消息落库</div>
|
||||||
size="small"
|
<Table
|
||||||
pagination={false}
|
size="small"
|
||||||
columns={[
|
pagination={false}
|
||||||
{ title: '用户名', dataIndex: 'name' },
|
columns={[
|
||||||
{ title: '角色', dataIndex: 'role' },
|
{ title: 'Topic', dataIndex: 'topic' },
|
||||||
{ title: '手机号', dataIndex: 'phone' },
|
{ title: '设备', dataIndex: 'device' },
|
||||||
{ title: '状态', dataIndex: 'status', render: (text) => <span style={{ color: '#52c41a' }}>{text}</span> },
|
{ title: '类型', dataIndex: 'type' },
|
||||||
]}
|
{ title: '解析', dataIndex: 'parse' },
|
||||||
dataSource={[
|
]}
|
||||||
{ name: '张运维', role: '超级管理员', phone: '138****0001', status: '在线' },
|
dataSource={mqttLogData}
|
||||||
{ name: '李工程师', role: '运维工程师', phone: '139****0002', status: '在线' },
|
/>
|
||||||
{ name: '王班长', role: '巡检主管', phone: '137****0003', status: '在线' },
|
</AntdCard>
|
||||||
{ name: '赵分析师', role: '数据分析师', phone: '136****0004', status: '在线' },
|
<AntdCard title="系统维护" style={{ marginBottom: 0 }}>
|
||||||
]}
|
<Row gutter={16}>
|
||||||
/>
|
<Col span={12} style={{ marginBottom: 16 }}>
|
||||||
</AntdCard>
|
<Button style={{ width: '100%' }} icon={<DeleteOutlined />}>清理缓存</Button>
|
||||||
|
</Col>
|
||||||
|
<Col span={12} style={{ marginBottom: 16 }}>
|
||||||
|
<Button style={{ width: '100%' }} icon={<RestOutlined />}>重启服务</Button>
|
||||||
|
</Col>
|
||||||
|
<Col span={12}>
|
||||||
|
<Button style={{ width: '100%' }} icon={<DownloadOutlined />}>备份下载</Button>
|
||||||
|
</Col>
|
||||||
|
<Col span={12}>
|
||||||
|
<Button style={{ width: '100%' }} icon={<FileTextOutlined />}>日志导出</Button>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</AntdCard>
|
||||||
|
</div>
|
||||||
</Col>
|
</Col>
|
||||||
|
|
||||||
{/* 右侧边栏 */}
|
{/* 右侧边栏 */}
|
||||||
<Col span={8}>
|
<Col span={8} style={{ display: 'flex', flexDirection: 'column' }}>
|
||||||
{/* 设备接入状态 */}
|
<div style={{ flex: 1 }}>
|
||||||
<AntdCard title="设备接入状态" style={{ marginBottom: 16 }}>
|
{/* 设备接入状态 */}
|
||||||
<Row gutter={16}>
|
<AntdCard title="设备接入状态" style={{ marginBottom: 16 }}>
|
||||||
{deviceStatusData.map((item, index) => (
|
<Row gutter={16}>
|
||||||
<Col span={12} key={index}>
|
{deviceStatusData.map((item, index) => (
|
||||||
<div style={{ border: '1px solid #e8e8e8', borderRadius: 8, padding: 12, marginBottom: 16 }}>
|
<Col span={12} key={index}>
|
||||||
<div style={{ fontSize: 13, color: '#666', marginBottom: 4 }}>{item.name}</div>
|
<div style={{ border: '1px solid #e8e8e8', borderRadius: 8, padding: 12, marginBottom: 16 }}>
|
||||||
<div style={{ fontSize: 16, fontWeight: 600, marginBottom: 4 }}>{item.count}</div>
|
<div style={{ fontSize: 13, color: '#666', marginBottom: 4 }}>{item.name}</div>
|
||||||
<div style={{ color: item.color, fontSize: 13 }}>{item.status}</div>
|
<div style={{ fontSize: 16, fontWeight: 600, marginBottom: 4 }}>{item.count}</div>
|
||||||
</div>
|
<div style={{ color: item.color, fontSize: 13 }}>{item.status}</div>
|
||||||
</Col>
|
</div>
|
||||||
))}
|
</Col>
|
||||||
</Row>
|
))}
|
||||||
</AntdCard>
|
</Row>
|
||||||
|
</AntdCard>
|
||||||
|
|
||||||
{/* 服务配置展示 */}
|
{/* 服务配置展示 */}
|
||||||
<AntdCard title="服务配置展示" style={{ marginBottom: 16 }}>
|
<AntdCard title="服务配置展示" style={{ marginBottom: 16 }}>
|
||||||
{serviceConfigData.map((item, index) => (
|
{serviceConfigData.map((item, index) => (
|
||||||
<div key={index} style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '12px 0', borderBottom: index !== serviceConfigData.length - 1 ? '1px solid #e8e8e8' : 'none' }}>
|
<div key={index} style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '12px 0', borderBottom: index !== serviceConfigData.length - 1 ? '1px solid #e8e8e8' : 'none' }}>
|
||||||
<div>
|
<div>
|
||||||
<div style={{ fontWeight: 500, marginBottom: 4 }}>{item.name}</div>
|
<div style={{ fontWeight: 500, marginBottom: 4 }}>{item.name}</div>
|
||||||
<div style={{ fontSize: 13 }}>{item.value}</div>
|
<div style={{ fontSize: 13 }}>{item.value}</div>
|
||||||
|
</div>
|
||||||
|
<Tag color={item.statusColor === '#52c41a' ? 'success' : item.statusColor === '#fa8c16' ? 'warning' : 'default'}>{item.status}</Tag>
|
||||||
</div>
|
</div>
|
||||||
<Tag color={item.statusColor === '#52c41a' ? 'success' : item.statusColor === '#fa8c16' ? 'warning' : 'default'}>{item.status}</Tag>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</AntdCard>
|
|
||||||
|
|
||||||
{/* 视频服务配置状态 */}
|
|
||||||
<AntdCard title="视频服务配置状态" style={{ marginBottom: 16 }}>
|
|
||||||
<div style={{ fontSize: 13, color: '#666', marginBottom: 16 }}>来自 /pv/video/summary 与 /pv/video/media-server/list</div>
|
|
||||||
<Row gutter={16}>
|
|
||||||
{videoServiceData.map((item, index) => (
|
|
||||||
<Col span={12} key={index}>
|
|
||||||
<div style={{ border: '1px solid #e8e8e8', borderRadius: 8, padding: 12, marginBottom: 16 }}>
|
|
||||||
<div style={{ fontSize: 13, color: '#666', marginBottom: 4 }}>{item.name}</div>
|
|
||||||
<div style={{ fontSize: 16, fontWeight: 600, color: item.statusColor || '#333' }}>{item.value}</div>
|
|
||||||
</div>
|
|
||||||
</Col>
|
|
||||||
))}
|
))}
|
||||||
</Row>
|
</AntdCard>
|
||||||
<Button type="primary" style={{ width: '100%' }} onClick={() => message.info('检测视频服务')}>检测视频服务</Button>
|
|
||||||
</AntdCard>
|
|
||||||
|
|
||||||
{/* MQTT接入状态 */}
|
{/* 视频服务配置状态 */}
|
||||||
<AntdCard title="MQTT接入状态" style={{ marginBottom: 16 }}>
|
<AntdCard title="视频服务配置状态" style={{ marginBottom: 16 }}>
|
||||||
<div style={{ fontSize: 13, color: '#666', marginBottom: 16 }}>来自 /pv/mqtt/status,后端未登录时显示预览兜底数据</div>
|
<div style={{ fontSize: 13, color: '#666', marginBottom: 16 }}>来自 /pv/video/summary 与 /pv/video/media-server/list</div>
|
||||||
<Row gutter={16}>
|
<Row gutter={16}>
|
||||||
{mqttStatusData.map((item, index) => (
|
{videoServiceData.map((item, index) => (
|
||||||
<Col span={12} key={index}>
|
<Col span={12} key={index}>
|
||||||
<div style={{ border: '1px solid #e8e8e8', borderRadius: 8, padding: 12, marginBottom: 16 }}>
|
<div style={{ border: '1px solid #e8e8e8', borderRadius: 8, padding: 12, marginBottom: 16 }}>
|
||||||
<div style={{ fontSize: 13, color: '#666', marginBottom: 4 }}>{item.name}</div>
|
<div style={{ fontSize: 13, color: '#666', marginBottom: 4 }}>{item.name}</div>
|
||||||
<div style={{ fontSize: 16, fontWeight: 600, color: item.statusColor || '#333' }}>{item.value}</div>
|
<div style={{ fontSize: 16, fontWeight: 600, color: item.statusColor || '#333' }}>{item.value}</div>
|
||||||
</div>
|
</div>
|
||||||
</Col>
|
</Col>
|
||||||
))}
|
))}
|
||||||
</Row>
|
</Row>
|
||||||
</AntdCard>
|
<Button type="primary" style={{ width: '100%' }} onClick={() => message.info('检测视频服务')}>检测视频服务</Button>
|
||||||
|
</AntdCard>
|
||||||
|
|
||||||
{/* MQTT消息日志 */}
|
|
||||||
<AntdCard title="MQTT消息日志" style={{ marginBottom: 16 }}>
|
|
||||||
<div style={{ fontSize: 13, color: '#666', marginBottom: 16 }}>阶段3A用于验证遥测原始消息落库</div>
|
|
||||||
<Table
|
|
||||||
size="small"
|
|
||||||
pagination={false}
|
|
||||||
columns={[
|
|
||||||
{ title: 'Topic', dataIndex: 'topic' },
|
|
||||||
{ title: '设备', dataIndex: 'device' },
|
|
||||||
{ title: '类型', dataIndex: 'type' },
|
|
||||||
{ title: '解析', dataIndex: 'parse' },
|
|
||||||
]}
|
|
||||||
dataSource={mqttLogData}
|
|
||||||
/>
|
|
||||||
</AntdCard>
|
|
||||||
|
|
||||||
{/* WebSocket实时推送 */}
|
|
||||||
<AntdCard title="WebSocket实时推送" style={{ marginBottom: 16 }}>
|
|
||||||
<div style={{ fontSize: 13, color: '#666', marginBottom: 16 }}>来自 /pv/ws/status,并显示前端本地连接状态</div>
|
|
||||||
<Row gutter={16}>
|
|
||||||
{wsStatusData.map((item, index) => (
|
|
||||||
<Col span={12} key={index}>
|
|
||||||
<div style={{ border: '1px solid #e8e8e8', borderRadius: 8, padding: 12, marginBottom: 16 }}>
|
|
||||||
<div style={{ fontSize: 13, color: '#666', marginBottom: 4 }}>{item.name}</div>
|
|
||||||
<div style={{ fontSize: 16, fontWeight: 600, color: item.statusColor || '#333' }}>{item.value}</div>
|
|
||||||
</div>
|
|
||||||
</Col>
|
|
||||||
))}
|
|
||||||
</Row>
|
|
||||||
</AntdCard>
|
|
||||||
|
|
||||||
{/* 系统维护 */}
|
{/* WebSocket实时推送 */}
|
||||||
<AntdCard title="系统维护">
|
<AntdCard title="WebSocket实时推送" style={{ marginBottom: 16 }}>
|
||||||
<Row gutter={16}>
|
<div style={{ fontSize: 13, color: '#666', marginBottom: 16 }}>来自 /pv/ws/status,并显示前端本地连接状态</div>
|
||||||
<Col span={12} style={{ marginBottom: 16 }}>
|
<Row gutter={16}>
|
||||||
<Button style={{ width: '100%' }} icon={<DeleteOutlined />}>清理缓存</Button>
|
{wsStatusData.map((item, index) => (
|
||||||
</Col>
|
<Col span={12} key={index}>
|
||||||
<Col span={12} style={{ marginBottom: 16 }}>
|
<div style={{ border: '1px solid #e8e8e8', borderRadius: 8, padding: 12, marginBottom: 16 }}>
|
||||||
<Button style={{ width: '100%' }} icon={<RestOutlined />}>重启服务</Button>
|
<div style={{ fontSize: 13, color: '#666', marginBottom: 4 }}>{item.name}</div>
|
||||||
</Col>
|
<div style={{ fontSize: 16, fontWeight: 600, color: item.statusColor || '#333' }}>{item.value}</div>
|
||||||
<Col span={12}>
|
</div>
|
||||||
<Button style={{ width: '100%' }} icon={<DownloadOutlined />}>备份下载</Button>
|
</Col>
|
||||||
</Col>
|
))}
|
||||||
<Col span={12}>
|
</Row>
|
||||||
<Button style={{ width: '100%' }} icon={<FileTextOutlined />}>日志导出</Button>
|
</AntdCard>
|
||||||
</Col>
|
|
||||||
</Row>
|
{/* 系统维护 */}
|
||||||
</AntdCard>
|
|
||||||
|
</div>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
PlusOutlined, EditOutlined, DeleteOutlined, ProductOutlined,
|
PlusOutlined, EditOutlined, DeleteOutlined, ProductOutlined,
|
||||||
AppstoreOutlined, SwapOutlined, VideoCameraOutlined
|
AppstoreOutlined, SwapOutlined, VideoCameraOutlined
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import { addDeviceModel, getDeviceModelList, updateDeviceModel } from '../../api/deviceAccess.ts';
|
import { addDeviceModel, getConnectTypes, getDeviceModelList, updateDeviceModel } from '../../api/deviceAccess.ts';
|
||||||
|
|
||||||
const { Option } = Select;
|
const { Option } = Select;
|
||||||
const { TabPane } = Tabs;
|
const { TabPane } = Tabs;
|
||||||
@@ -111,6 +111,7 @@ export default function DeviceAccessPage() {
|
|||||||
const [mappingList, setMappingList] = useState(mappingInitList);
|
const [mappingList, setMappingList] = useState(mappingInitList);
|
||||||
const [mappingModal, setMappingModal] = useState(false);
|
const [mappingModal, setMappingModal] = useState(false);
|
||||||
const [mappingForm] = Form.useForm();
|
const [mappingForm] = Form.useForm();
|
||||||
|
const [protocolList, setProtocolList] = useState([]);
|
||||||
|
|
||||||
// 筛选条件
|
// 筛选条件
|
||||||
const [filterForm] = Form.useForm();
|
const [filterForm] = Form.useForm();
|
||||||
@@ -122,6 +123,17 @@ export default function DeviceAccessPage() {
|
|||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
total: 0,
|
total: 0,
|
||||||
});
|
});
|
||||||
|
const getConnectList = () => {
|
||||||
|
getConnectTypes("").then(res => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
setProtocolList(res.data || []);
|
||||||
|
} else {
|
||||||
|
setProtocolList([]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// 删除物模型
|
// 删除物模型
|
||||||
const handleDeleteModel = (id) => {
|
const handleDeleteModel = (id) => {
|
||||||
@@ -256,7 +268,6 @@ export default function DeviceAccessPage() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
console.log('✅ 提交物模型', submitData);
|
|
||||||
}
|
}
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
});
|
});
|
||||||
@@ -316,7 +327,11 @@ export default function DeviceAccessPage() {
|
|||||||
if (activeTab === 'model') {
|
if (activeTab === 'model') {
|
||||||
getModel();
|
getModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
}, [pagination.current, pagination.pageSize, activeTab]);
|
}, [pagination.current, pagination.pageSize, activeTab]);
|
||||||
|
useEffect(() => {
|
||||||
|
getConnectList();
|
||||||
|
}, [])
|
||||||
|
|
||||||
// 表格列
|
// 表格列
|
||||||
const deviceColumns = [
|
const deviceColumns = [
|
||||||
@@ -584,7 +599,20 @@ export default function DeviceAccessPage() {
|
|||||||
<Button type="text" onClick={() => {
|
<Button type="text" onClick={() => {
|
||||||
setCurrentAction(r);
|
setCurrentAction(r);
|
||||||
const arr = [];
|
const arr = [];
|
||||||
for (let k in r.params) arr.push({ paramKey: k, ...r.params[k] });
|
const firstKey = Object.keys(r.params)[0];
|
||||||
|
if (firstKey) {
|
||||||
|
const param = r.params[firstKey];
|
||||||
|
arr.push({
|
||||||
|
paramKey: firstKey,
|
||||||
|
type: param.type || 'int',
|
||||||
|
desc: param.description || '', // 回显描述
|
||||||
|
defaultValue: param.default || '', // 回显默认值
|
||||||
|
enum: param.enum || [], // 回显枚举
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
arr.push({ paramKey: '', type: 'int', desc: '', defaultValue: '', enum: [] });
|
||||||
|
}
|
||||||
|
|
||||||
setParamList(arr);
|
setParamList(arr);
|
||||||
setActionModal(true);
|
setActionModal(true);
|
||||||
}}>编辑</Button>
|
}}>编辑</Button>
|
||||||
@@ -620,6 +648,7 @@ export default function DeviceAccessPage() {
|
|||||||
</Form>
|
</Form>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
|
{/* 指令弹窗 */}
|
||||||
{/* 指令弹窗 */}
|
{/* 指令弹窗 */}
|
||||||
<Modal title="配置指令" open={actionModal} zIndex={1002} onCancel={() => setActionModal(false)}
|
<Modal title="配置指令" open={actionModal} zIndex={1002} onCancel={() => setActionModal(false)}
|
||||||
onOk={() => {
|
onOk={() => {
|
||||||
@@ -641,17 +670,40 @@ export default function DeviceAccessPage() {
|
|||||||
<Input placeholder="指令名称" value={currentAction?.actionName} onChange={e => setCurrentAction({ ...currentAction, actionName: e.target.value })} style={{ flex: 1 }} />
|
<Input placeholder="指令名称" value={currentAction?.actionName} onChange={e => setCurrentAction({ ...currentAction, actionName: e.target.value })} style={{ flex: 1 }} />
|
||||||
</div>
|
</div>
|
||||||
<Divider>指令参数</Divider>
|
<Divider>指令参数</Divider>
|
||||||
{paramList[0] && (
|
|
||||||
<div className="flex gap-2 items-center">
|
{/* ✅ 修复:永远显示参数行,不会空白 */}
|
||||||
<Input placeholder="参数名" value={paramList[0].paramKey} onChange={e => setParamList([{ ...paramList[0], paramKey: e.target.value }])} />
|
<div className="flex gap-2 items-center">
|
||||||
<Select value={paramList[0].type} style={{ width: 100 }} onChange={v => setParamList([{ ...paramList[0], type: v }])}>
|
<Input
|
||||||
<Option value="int">int</Option><Option value="string">string</Option>
|
placeholder="参数名"
|
||||||
</Select>
|
value={paramList[0]?.paramKey || ''}
|
||||||
<Input placeholder="描述" value={paramList[0].desc} onChange={e => setParamList([{ ...paramList[0], desc: e.target.value }])} />
|
onChange={e => setParamList([{ ...paramList[0], paramKey: e.target.value }])}
|
||||||
<Input placeholder="默认值" value={paramList[0].defaultValue} onChange={e => setParamList([{ ...paramList[0], defaultValue: e.target.value }])} />
|
/>
|
||||||
<Input placeholder="枚举(,分隔)" value={paramList[0].enum?.join(',')} onChange={e => setParamList([{ ...paramList[0], enum: e.target.value.split(',').map(s => s.trim()) }])} />
|
<Select
|
||||||
</div>
|
value={paramList[0]?.type || 'int'}
|
||||||
)}
|
style={{ width: 100 }}
|
||||||
|
onChange={v => setParamList([{ ...paramList[0], type: v }])}
|
||||||
|
>
|
||||||
|
<Option value="int">int</Option>
|
||||||
|
<Option value="string">string</Option>
|
||||||
|
<Option value="float">float</Option>
|
||||||
|
<Option value="bool">bool</Option>
|
||||||
|
</Select>
|
||||||
|
<Input
|
||||||
|
placeholder="描述"
|
||||||
|
value={paramList[0]?.desc || ''}
|
||||||
|
onChange={e => setParamList([{ ...paramList[0], desc: e.target.value }])}
|
||||||
|
/>
|
||||||
|
<Input
|
||||||
|
placeholder="默认值"
|
||||||
|
value={paramList[0]?.defaultValue || ''}
|
||||||
|
onChange={e => setParamList([{ ...paramList[0], defaultValue: e.target.value }])}
|
||||||
|
/>
|
||||||
|
<Input
|
||||||
|
placeholder="枚举(,分隔)"
|
||||||
|
value={(paramList[0]?.enum || []).join(',')}
|
||||||
|
onChange={e => setParamList([{ ...paramList[0], enum: e.target.value.split(',').map(s => s.trim()) }])}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
{/* 字段映射 */}
|
{/* 字段映射 */}
|
||||||
|
|||||||
Reference in New Issue
Block a user