Commit 6332dc2a authored by 皮倩雯's avatar 皮倩雯

fix: '宿主管理默认值清除'

parent 38268dd3
Pipeline #75860 passed with stages
......@@ -7,7 +7,7 @@ import styles from './index.less';
import CardCheck from './CardCheck';
const SelectUser = props => {
const { callBackSubmit, onCancel, visible, itemObj } = props;
const { callBackSubmit, onCancel, visible, itemObj, aftercare } = props;
const [allList, setAllist] = useState([]); // 用于展示得数据
const [checkList, setCheckList] = useState([]); // 选中得数据集合
const [loading, setLoading] = useState(false);
......@@ -54,27 +54,37 @@ const SelectUser = props => {
if (res[0].code === 0) {
setTotal(res[0].data.count);
let checkedListAll = [];
if (itemObj) {
res[0].data.data.map(item => {
item.users.map(val => {
itemObj.length > 0 &&
itemObj.forEach(i => {
if (val.userId === i) {
checkedListAll.push({
label: val.userName,
value: val.userId,
groupName: item.level.split('/')[1],
level: item.level,
});
}
});
console.log(itemObj);
if (aftercare !== '请勾选不显示售后服务的用户') {
itemObj.length > 0 &&
itemObj.forEach((i, j) => {
checkedListAll.push({
label: aftercare.split(',')[j],
value: i,
});
});
});
setCheckList(checkedListAll);
console.log(checkedListAll);
debugger;
}
setCheckList(checkedListAll);
// if (itemObj) {
// res[0].data.data.map(item => {
// item.users.map(val => {
// itemObj.length > 0 &&
// itemObj.forEach(i => {
// if (Number(val.userId) == Number(i)) {
// checkedListAll.push({
// label: val.userName,
// value: val.userId,
// groupName: item.level.split('/')[1],
// level: item.level,
// });
// }
// });
// });
// });
// setCheckList(checkedListAll);
// }
// 数据处理成checkbox组件需要得形式
let list = res[0].data.data.map(item => {
let indeterminate = false;
......@@ -214,8 +224,8 @@ const SelectUser = props => {
},
render: (text, record) => (
<span>
<Tooltip placement="topLeft" title={`${record.label}(${record.level})`}>
{record.label}({record.level})
<Tooltip placement="topLeft" title={`${record.label}`}>
{record.label}
</Tooltip>
</span>
),
......
......@@ -26,6 +26,9 @@ const ETCConfig = props => {
message.error(res.msg);
}
});
return () => {
form.resetFields();
};
}, []);
const onFinish = () => {
......@@ -78,7 +81,7 @@ const ETCConfig = props => {
>
<Input
style={{ width: '300px' }}
placeholder="请填写服务地址"
// placeholder="请填写服务地址"
rules={[
{
validator: (rule, value) => {
......
......@@ -100,6 +100,7 @@ const IotConfig = props => {
clearTimeout(time);
time = null;
}
form.resetFields();
};
}, []);
......@@ -211,7 +212,7 @@ const IotConfig = props => {
obj[k] = res.data[k];
});
GetIotVersion({
ip: obj.IotAddress ? obj.IotAddress : '127.0.0.1',
ip: obj.IotAddress,
}).then(resdata => {
if (resdata.code === 0) {
if (resdata.data === 'BS') {
......@@ -248,12 +249,12 @@ const IotConfig = props => {
}
});
form.setFieldsValue(obj);
if (!obj.IotAddress || obj.IotAddress == null) {
form.setFieldsValue({ IotAddress: '127.0.0.1' });
}
if (!obj.TcpAddress || obj.TcpAddress == null) {
form.setFieldsValue({ TcpAddress: '127.0.0.1:8083' });
}
// if (!obj.IotAddress || obj.IotAddress == null) {
// form.setFieldsValue({ IotAddress: '127.0.0.1' });
// }
// if (!obj.TcpAddress || obj.TcpAddress == null) {
// form.setFieldsValue({ TcpAddress: '127.0.0.1:8083' });
// }
if (!obj.SSLSafe || obj.SSLSafe == null) {
form.setFieldsValue({ SSLSafe: '否' });
}
......@@ -492,7 +493,7 @@ const IotConfig = props => {
>
<Input
style={{ width: '300px', marginLeft: '15px' }}
placeholder="请输入服务地址"
// placeholder="请输入服务地址"
/>
</Form.Item>
<Button onClick={() => PingIot1()} style={{ marginLeft: '-88px' }}>
......
import React, { useEffect, useState } from 'react';
import { Card, Form, Input, Button, Select, message, Divider, Spin, Row, Col } from 'antd';
import {
GetMessageConfigInfo,
SaveSystemInfo,
ConnectMessPlatform,
GetBasicInfo,
GetDataBaseConfig,
SysConfiguration,
SaveSysConfigurate,
} from '@/services/hostmanager/hostmanager';
import { GetMessageVersion } from '@/services/messagemanage/messagemanage';
import { SysConfiguration, SaveSysConfigurate } from '@/services/hostmanager/hostmanager';
import { CloseCircleFilled } from '@ant-design/icons';
import CryptoJS from 'crypto-js';
import message11 from '../../../../assets/images/icons/消息.svg';
......@@ -25,9 +16,6 @@ const tailLayout = {
};
const MessageConfig = () => {
const [loading, setLoading] = useState(false); // 加载
const [currentAddress, setCurrentAddress] = useState('');
const [currentDataBase, setCurrentDataBase] = useState({});
const [currentSiteInfo, setcurrentSiteInfo] = useState('');
const [show1, setShow1] = useState('none');
const [show2, setShow2] = useState('none');
......@@ -72,7 +60,7 @@ const MessageConfig = () => {
};
useEffect(() => {
form.setFieldsValue({ messageAddress: '127.0.0.1:8231' });
// form.setFieldsValue({ messageAddress: '127.0.0.1:8231' });
SysConfiguration({ moduleName: 'GCK平台地址' }).then(res => {
if (res.code === 0) {
form.setFieldsValue({ messageAddress: res.data });
......@@ -80,6 +68,9 @@ const MessageConfig = () => {
message.info(res.msg);
}
});
return () => {
form.resetFields();
};
}, []);
return (
......@@ -116,7 +107,7 @@ const MessageConfig = () => {
>
<Input
style={{ width: '300px', marginLeft: '15px' }}
placeholder="请输入服务地址"
// placeholder="请输入服务地址"
/>
</Form.Item>
<span style={{ display: show1 }}>
......
......@@ -22,25 +22,25 @@ const HostManager = () => {
<PageContainer>
<Tabs onChange={handleChange} type="card" destroyInactiveTabPane activeKey={activeKey}>
<TabPane tab="基础配置" key="1">
<BaseConfig />
{activeKey === '1' ? <BaseConfig /> : null}
</TabPane>
<TabPane tab="GCK平台配置" key="2">
<GCKConfig />
{activeKey === '2' ? <GCKConfig /> : null}
</TabPane>
<TabPane tab="物联配置" key="3">
<IotConfig setActiveKey={setActiveKey} />
{activeKey === '3' ? <IotConfig setActiveKey={setActiveKey} /> : null}
</TabPane>
<TabPane tab="消息配置" key="4">
<MessageConfig />
{activeKey === '4' ? <MessageConfig /> : null}
</TabPane>
{/* <TabPane tab="代理配置" key="4">
<ProxyConfig />
</TabPane> */}
<TabPane tab="中台配置" key="5">
<ETLConfig setActiveKey={setActiveKey} />
{activeKey === '5' ? <ETLConfig setActiveKey={setActiveKey} /> : null}
</TabPane>
<TabPane tab="网关配置" key="6">
<GateConfig />
{activeKey === '6' ? <GateConfig /> : null}
</TabPane>
</Tabs>
</PageContainer>
......
......@@ -121,15 +121,16 @@ const MessageConfig = () => {
};
useEffect(() => {
form.setFieldsValue({ messageAddress: '127.0.0.1:8231' });
// form.setFieldsValue({ messageAddress: '127.0.0.1:8231' });
GetMessageConfigInfo().then(res => {
if (res.code == 0) {
setCurrentAddress(res.data);
if (!res.data || res.data == null) {
form.setFieldsValue({ messageAddress: '127.0.0.1:8231' });
} else {
form.setFieldsValue({ messageAddress: res.data });
}
// if (!res.data || res.data == null) {
// form.setFieldsValue({ messageAddress: '127.0.0.1:8231' });
// } else {
// form.setFieldsValue({ messageAddress: res.data });
// }
form.setFieldsValue({ messageAddress: res.data });
GetDataBaseConfig().then(resdata => {
if (resdata.code === 0) {
......@@ -147,6 +148,9 @@ const MessageConfig = () => {
}
});
getMessageVersion();
return () => {
form.resetFields();
};
}, [flag]);
const getMessageVersion = () => {
......@@ -231,7 +235,7 @@ const MessageConfig = () => {
>
<Input
style={{ width: '300px', marginLeft: '15px' }}
placeholder="请输入服务地址"
// placeholder="请输入服务地址"
/>
</Form.Item>
<span style={{ display: show1 }}>
......
......@@ -797,6 +797,7 @@ export default props => {
}}
callBackSubmit={roleList => rolCallBack(roleList)}
itemObj={checkValue && checkValue.toString().split(',')} // 单选框中的值
aftercare={aftercare}
/>
</Drawer>
);
......
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