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

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

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