Commit 9e996e6a authored by 皮倩雯's avatar 皮倩雯

新增宿主管理消息平台连接提示

parent cce514ac
Pipeline #37841 passed with stages
......@@ -613,6 +613,7 @@ const WebDic = () => {
if (info.file.status === 'done') {
console.log(1);
message.success(`${info.file.name} 导入成功`);
setFlag(flag + 1)
} else if (info.file.status === 'error') {
message.error(`${info.file.name} 导入失败.`);
}
......
......@@ -402,7 +402,7 @@ const InitDataBase = props => {
notification.error({
message: '提示',
duration: 15,
description: res.message,
description: res.msg,
});
}
})
......@@ -568,7 +568,7 @@ const InitDataBase = props => {
notification.success({
message: '提示',
duration: 3,
description: '操作成功',
description: '数据库初始化成功',
});
} else {
notification.error({
......@@ -586,7 +586,7 @@ const InitDataBase = props => {
notification.success({
message: '提示',
duration: 3,
description: '操作成功',
description: '数据库初始化成功',
});
} else {
notification.error({
......
......@@ -183,6 +183,7 @@ const AddModal = props => {
for (let i = 0; i < len; i++) {
arr.push(evt.from.children[i].getAttribute('drag-id'))
}
console.log(arr)
setSelectData(arr)
}
});
......
......@@ -170,8 +170,8 @@ const IotConfig = () => {
<Button type="primary" onClick={() => PingIot1()}>连接</Button>
</Col>
<Col span={3}>
<span style={{ display: show1 }}><img src={Yes} style={{ height: '32px', marginRight: '20px' }} alt="" />已连接</span>
<span style={{ display: show2 }}><CloseCircleFilled style={{ fontSize: '32px', marginRight: '20px' }} />未连接</span>
<span style={{ display: show1 }}><img src={Yes} style={{ height: '32px', marginRight: '20px', marginTop:'5px' }} alt="" /><span style={{verticalAlign: 'text-bottom'}}>已连接</span></span>
<span style={{ display: show2 }}><CloseCircleFilled style={{ fontSize: '32px', marginRight: '20px', marginTop:'5px' }} /><span style={{verticalAlign: 'text-bottom'}}>未连接</span></span>
</Col>
<div style={{ marginTop: '40px', display: 'flex', alignItems: 'center', marginLeft: '15px' }}>
......
import React, { useEffect, useState } from 'react'
import { Card, Form, Input, Button, Select, message, Divider, Spin } from 'antd'
import { Card, Form, Input, Button, Select, message, Divider, Spin, Row, Col } from 'antd'
import styles from './messageConfig.less';
import { GetMessageConfigInfo, SaveSystemInfo, ConnectMessPlatform, GetBasicInfo, GetDataBaseConfig } from '@/services/platform/hostmanager'
import message11 from '../../../../assets/images/icons/消息.svg'
import Yes from '../../../../assets/images/icons/正确.svg';
import { CloseCircleFilled } from '@ant-design/icons';
const layout = {
labelCol: { span: 3 },
......@@ -19,6 +21,8 @@ const MessageConfig = () => {
const [currentAddress, setCurrentAddress] = useState("")
const [currentDataBase, setCurrentDataBase] = useState({});
const [currentSiteInfo, setcurrentSiteInfo] = useState("");
const [show1, setShow1] = useState('none')
const [show2, setShow2] = useState('none')
const [form] = Form.useForm();
const onFinish = (values) => {
......@@ -35,6 +39,8 @@ const MessageConfig = () => {
}).then(res => {
setLoading(false)
if (res.code === 0) {
setShow1('block')
setShow2('none')
//2.保存连接
SaveSystemInfo({
configName: "消息平台连接地址",
......@@ -49,12 +55,36 @@ const MessageConfig = () => {
}
)
} else {
setShow1('none')
setShow2('block')
message.error(res.msg)
}
})
};
const getMessageConfig = (CurrentAddress, CurrentDataBase, currentSiteInfo) => {
setLoading(true)
ConnectMessPlatform({
messAddress: CurrentAddress,
sqlServerIP: CurrentDataBase.ip,
loginName: CurrentDataBase.userName,
password: CurrentDataBase.password,
sqlName: CurrentDataBase.dbName,
siteCode: currentSiteInfo
}).then(res => {
setLoading(false)
if (res.code === 0) {
setShow1('block')
setShow2('none')
} else {
setShow1('none')
setShow2('block')
message.error(res.msg)
}
})
}
const onFinishFailed = (errorInfo) => {
console.log('Failed:', errorInfo);
};
......@@ -65,16 +95,20 @@ const MessageConfig = () => {
GetMessageConfigInfo().then(
res => {
if (res.code == 0) {
let CurrentAddress = res.data
setCurrentAddress(res.data)
form.setFieldsValue({ messageAddress: res.data });
GetDataBaseConfig().then(
res => {
if (res.code === 0) {
let CurrentDataBase = res.data
setCurrentDataBase(res.data)
GetBasicInfo().then(
res => {
if (res.code === 0) {
let currentSiteInfo = res.data
setcurrentSiteInfo(res.data)
getMessageConfig(CurrentAddress, CurrentDataBase, currentSiteInfo)
}
}
)
......@@ -105,17 +139,25 @@ const MessageConfig = () => {
onFinish={onFinish}
onFinishFailed={onFinishFailed}
>
<div style={{marginTop:'10px', display: 'flex', alignItems: 'center', marginLeft:'15px' }}>
<div style={{ marginTop: '10px', display: 'flex', alignItems: 'center', marginLeft: '15px' }}>
<img src={message11} style={{ height: '16px' }} alt="" /><span style={{ marginLeft: '10px', fontWeight: 'bold' }}>消息平台</span>
</div>
<Divider />
<Row>
<Col span={21}>
<Form.Item
label="服务地址(平台)"
name="messageAddress"
rules={[{ required: true, pattern: new RegExp(/^(([1-9]?\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}([1-9]?\d|1\d{2}|2[0-4]\d|25[0-5])(:\d*)$/, "g"), message: '请输入正确的IP例如:192.168.12.231:8231' }]}
>
<Input style={{width:'94%'}}/>
<Input style={{ width: '94%' }} />
</Form.Item>
</Col>
<Col span={3}>
<span style={{ display: show1 }}><img src={Yes} style={{ height: '32px', marginRight: '20px' }} alt="" /><span>已连接</span></span>
<span style={{ display: show2 }}><CloseCircleFilled style={{ fontSize: '32px', marginRight: '20px', marginTop: '5px' }} /><span style={{ verticalAlign: 'text-bottom' }}>未连接</span></span>
</Col>
</Row>
<Form.Item {...tailLayout}>
<Button type="primary" htmlType="submit" disabled={currentSiteInfo.length > 0 ? false : true}>
保存连接
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment