Commit 94862471 authored by 皮倩雯's avatar 皮倩雯

fix: '消息平台新增版本配置'

parent 065f813e
import React, { useEffect, useState } from 'react';
import { Card, Form, Input, Button, Select, message, Divider, Spin, Row, Col } from 'antd';
import styles from './messageConfig.less';
import {
GetMessageConfigInfo,
SaveSystemInfo,
......@@ -8,9 +7,11 @@ import {
GetBasicInfo,
GetDataBaseConfig,
} from '@/services/hostmanager/hostmanager';
import { GetMessageVersion } from '@/services/messagemanage/messagemanage';
import { CloseCircleFilled } from '@ant-design/icons';
import message11 from '../../../../assets/images/icons/消息.svg';
import Yes from '../../../../assets/images/icons/正确.svg';
import { CloseCircleFilled } from '@ant-design/icons';
import styles from './messageConfig.less';
const layout = {
labelCol: { span: 2 },
......@@ -26,11 +27,13 @@ const MessageConfig = () => {
const [currentSiteInfo, setcurrentSiteInfo] = useState('');
const [show1, setShow1] = useState('none');
const [show2, setShow2] = useState('none');
const [messageVersion, setMessageVersion] = useState('');
const [flag, setFlag] = useState(0);
const [form] = Form.useForm();
const onFinish = values => {
//先测试连接再保存
//1.测试链接
// 先测试连接再保存
// 1.测试链接
setLoading(true);
ConnectMessPlatform({
messAddress: values.messageAddress,
......@@ -44,15 +47,15 @@ const MessageConfig = () => {
if (res.code === 0) {
setShow1('block');
setShow2('none');
//2.保存连接
// 2.保存连接
SaveSystemInfo({
configName: '消息平台连接地址',
configValue: values.messageAddress,
}).then(res => {
if (res.code === 0) {
}).then(resdata => {
if (resdata.code === 0) {
message.info('配置保存成功');
} else {
message.error(res.msg);
message.error(resdata.msg);
}
});
} else {
......@@ -95,14 +98,14 @@ const MessageConfig = () => {
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);
GetDataBaseConfig().then(resdata => {
if (resdata.code === 0) {
let CurrentDataBase = resdata.data;
setCurrentDataBase(resdata.data);
GetBasicInfo().then(reslist => {
if (reslist.code === 0) {
let currentSiteInfo = reslist.data;
setcurrentSiteInfo(reslist.data);
// getMessageConfig(CurrentAddress, CurrentDataBase, currentSiteInfo);
}
});
......@@ -112,7 +115,36 @@ const MessageConfig = () => {
message.info('获取消息平台配置失败!');
}
});
}, []);
getMessageVersion();
}, [flag]);
const getMessageVersion = () => {
GetMessageVersion().then(res => {
console.log(res.data);
setMessageVersion(res.data);
});
};
const butn = () => {
console.log(messageVersion);
let data = '';
if (messageVersion == '1.0') {
data = '2.0';
} else {
data = '1.0';
}
SaveSystemInfo({
configName: '消息解析规则版本',
configValue: data,
}).then(resdata => {
if (resdata.code === 0) {
message.info('配置保存成功');
getMessageVersion();
} else {
message.error(resdata.msg);
}
});
};
return (
<div className={styles.message_container}>
......@@ -191,6 +223,25 @@ const MessageConfig = () => {
保存连接
</Button>
</Form.Item>
<Form.Item label="消息版本" style={{ marginLeft: '67px', marginBottom: '0px' }}>
<span style={{ marginLeft: '15px', color: 'red', fontWeight: 'bold' }}>
{messageVersion}
</span>
</Form.Item>
<Form.Item>
<Button
type="primary"
style={{ marginLeft: '152px', marginTop: '13px', width: '88px' }}
onClick={butn}
>
{messageVersion == '1.0' ? '升级' : '回退'}
</Button>
<br />
<br />
<span style={{ color: 'red', fontWeight: 'bold', marginLeft: '152px' }}>
提示:web4请使用1.0版本,web5请使用2.0版本,请根据项目的实际情况决定
</span>
</Form.Item>
</Form>
</Spin>
</Card>
......
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