Commit 5b9c70fe authored by 皮倩雯's avatar 皮倩雯

fix: '物联网统一接入平台增加升级功能'

parent c57480b4
Pipeline #68167 passed with stages
......@@ -231,6 +231,8 @@ const incident = () => {
return <span>前端+手持</span>;
} else if (item === ''||item==='否') {
return <span>内置用法</span>;
}else if (item==='是') {
return <span>(无)</span>;
} else {
return <span>{item}</span>;
}
......
......@@ -37,6 +37,8 @@ import {
DepositServiceDisable, // 停止数据库服务
DepositServiceEnable, // 启动数据库服务
GetGateWay,
IsIotUpgrade, // 判断是否需要升级物联网统一接入平台
IotUpgrade, // 升级物联网统一接入平台
} from '@/services/hostmanager/hostmanager';
import {
GetDbProduct, // 获取产品方案配置
......@@ -80,28 +82,37 @@ const IotConfig = props => {
const [buStatus, setBuStatus] = useState(''); // 按钮状态
const [keep, setKeep] = useState('');
const [getWayVisible, setGetWayVisible] = useState(false);
const [upgrade, setUpgrade] = useState(false);
useEffect(() => {
HealthCheck()
.then(res => {
if (res.success) {
setFlag(1);
getCurrentConfig();
getSiteCode();
GetGateWay().then(resdata => {
if (resdata.code === 0) {
if (resdata.data === false) {
setGetWayVisible(true);
}
}
});
GetGateWay().then(resdata => {
if (resdata.code === 0) {
if (resdata.data === false) {
setGetWayVisible(true);
} else {
setFlag(0);
HealthCheck()
.then(res => {
if (res.success) {
setFlag(1);
getCurrentConfig();
getSiteCode();
} else {
setFlag(0);
}
})
.catch(err => {
console.log(err);
});
}
})
.catch(err => {
console.log(err);
});
}
});
IsIotUpgrade().then(res => {
if (res.code === 0) {
setUpgrade(res.data);
console.log(res);
}
});
GetCurentIotVerison();
GetIotConfig();
......@@ -256,6 +267,20 @@ const IotConfig = props => {
console.log('Failed:', errorInfo);
};
// 物联网升级
const PingIotUpdata = () => {
setLoading(true);
IotUpgrade().then(res => {
setLoading(false);
if (res.code === 0) {
setUpgrade(false);
message.success('升级成功!');
} else {
message.error(res.msg);
}
});
};
const PingIot = ({ ip, values }) => {
SaveIotConfig({
tcpAddress: values.TcpAddress,
......@@ -465,6 +490,15 @@ const IotConfig = props => {
<Button type="primary" onClick={() => PingIot1()} style={{ marginLeft: '25px' }}>
测试连接
</Button>
{upgrade && (
<Button
type="primary"
onClick={() => PingIotUpdata()}
style={{ marginLeft: '25px' }}
>
物联网升级
</Button>
)}
<span style={{ display: show1 }}>
<img
src={Yes}
......@@ -582,7 +616,9 @@ const IotConfig = props => {
visible={getWayVisible}
title="提示"
width="350px"
closable={false}
closable
maskClosable={false}
onCancel={() => setGetWayVisible(false)}
all
footer={
<Space>
......
......@@ -22,6 +22,10 @@ export const GetTCPConfigInfo = param =>
get(`${PUBLISH_SERVICE}/HostManager/GetTCPConfigInfo`, param);
export const PingIOTPlatform = param =>
get(`${PUBLISH_SERVICE}/HostManager/PingIOTPlatform`, param);
// 判断是否需要升级物联网统一接入平台
export const IsIotUpgrade = param => get(`${PUBLISH_SERVICE}/HostManager/IsIotUpgrade`, param);
// 升级物联网统一接入平台
export const IotUpgrade = param => get(`${PUBLISH_SERVICE}/HostManager/IotUpgrade`, param);
export const SaveTcpAddress = param => get(`${PUBLISH_SERVICE}/HostManager/SaveTcpAddress`, param);
// 健康检查接口
export const HealthCheck = param => get(`/Iot/api/HealthCheck`, param);
......@@ -33,7 +37,7 @@ export const GetServiceInfo = param => post(`/Iot/api/DB/GetServiceInfo`, param)
export const AddDB = param => post(`/Iot/api/DB/AddDBV2`, param);
// 停止数据库服务
export const DepositServiceDisable = param => post(`/Iot/api/DB/DepositServiceDisable`, param);
// 启用数据库服务
// 启用数据库服务
export const DepositServiceEnable = param => post(`/Iot/api/DB/DepositServiceEnable`, param);
// 消息平台接口
......
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