Commit 71889bab authored by 皮倩雯's avatar 皮倩雯

解决站点管理编辑功能,数据不显示问题

parent 8418baa3
Pipeline #36772 skipped with stages
...@@ -8,7 +8,7 @@ const EditModal = props => { ...@@ -8,7 +8,7 @@ const EditModal = props => {
const [formLayout, setFormLayout] = useState('horizontal'); const [formLayout, setFormLayout] = useState('horizontal');
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const flag = useRef(); const flag = useRef();
const { confirmModal, stationObj } = props; const { confirmModal, stationObj, des } = props;
const onSubmit = () => { const onSubmit = () => {
form form
.validateFields() .validateFields()
...@@ -54,7 +54,7 @@ const EditModal = props => { ...@@ -54,7 +54,7 @@ const EditModal = props => {
useEffect(() => { useEffect(() => {
form.setFieldsValue({ form.setFieldsValue({
stationName: stationObj.text, stationName: stationObj.text,
description: stationObj.description, description: stationObj.describe,
}); });
}, [stationObj]); }, [stationObj]);
return ( return (
......
...@@ -31,7 +31,8 @@ import { ...@@ -31,7 +31,8 @@ import {
DoubleLeftOutlined, DoubleLeftOutlined,
DoubleRightOutlined, DoubleRightOutlined,
DownOutlined, DownOutlined,
PlusOutlined PlusOutlined,
ApartmentOutlined
} from '@ant-design/icons'; } from '@ant-design/icons';
import PageContainer from '@/components/BasePageContainer'; import PageContainer from '@/components/BasePageContainer';
...@@ -89,6 +90,11 @@ const SiteManageV2 = () => { ...@@ -89,6 +90,11 @@ const SiteManageV2 = () => {
const [updatePageUser, setUpdatePageUser] = useState(1);// const [updatePageUser, setUpdatePageUser] = useState(1);//
const [updateCheck, setUpdateCheck] = useState(1); const [updateCheck, setUpdateCheck] = useState(1);
const [name, setName] = useState(''); const [name, setName] = useState('');
const [des, setDes] = useState('')
const [data, setData] = useState('')
const [ch, setCh] = useState('')
let a = []
// 渲染机构树 // 渲染机构树
const mapTree = org => { const mapTree = org => {
...@@ -169,6 +175,10 @@ const SiteManageV2 = () => { ...@@ -169,6 +175,10 @@ const SiteManageV2 = () => {
updateTrees(); updateTrees();
}, [flag]); }, [flag]);
useEffect(()=>{
getValue()
},[])
//切换站点,点击分页按钮,提交 //切换站点,点击分页按钮,提交
useEffect(() => { useEffect(() => {
if (!currentStation) return; if (!currentStation) return;
...@@ -282,8 +292,8 @@ const SiteManageV2 = () => { ...@@ -282,8 +292,8 @@ const SiteManageV2 = () => {
} }
//选中某个站点 //选中某个站点
const onSelect = (props, e) => { const onSelect = (props, e) => {
console.log(e)
console.log('props[0]', props[0]); console.log('props[0]', props[0]);
setCh(props[0])
if (!props[0]) { if (!props[0]) {
setCurrentStation(currentStation) setCurrentStation(currentStation)
...@@ -291,8 +301,37 @@ const SiteManageV2 = () => { ...@@ -291,8 +301,37 @@ const SiteManageV2 = () => {
setCurrentStation(props[0]); setCurrentStation(props[0]);
} }
setPage({ pageNum: 1, pageSize: 10 }); setPage({ pageNum: 1, pageSize: 10 });
console.log(data)
data.map((item, index) => {
if(item.id == props[0]){
console.log(item.id)
console.log(item.describe)
setDes(item.describe)
}
})
}
const getValue = () => {
getSiteTree({ selectNode: -1 }).then(
res => {
console.log(res.data)
getData1(res.data)
}
)
}
const getData1 = e => {
console.log(e)
e.map((i, j)=>{
a.push(i)
if(i.children.length>0){
getData1(i.children)
}
})
console.log(a)
setData(a)
} }
// 弹出模态框 // 弹出模态框
const handleShowModal = (key, value) => { const handleShowModal = (key, value) => {
setvisibleParams({ ...visibleParams, [key]: value }); setvisibleParams({ ...visibleParams, [key]: value });
...@@ -435,7 +474,7 @@ const SiteManageV2 = () => { ...@@ -435,7 +474,7 @@ const SiteManageV2 = () => {
.then(res => { .then(res => {
handleShowModal('btnLoading', false); handleShowModal('btnLoading', false);
if (res.code===0) { if (res.code === 0) {
setSelectList([]); setSelectList([]);
setUpdateCheck(updateCheck + 1); setUpdateCheck(updateCheck + 1);
notification.success({ notification.success({
...@@ -538,6 +577,7 @@ const SiteManageV2 = () => { ...@@ -538,6 +577,7 @@ const SiteManageV2 = () => {
<EditModal <EditModal
visible={visibleParams.editVisible} visible={visibleParams.editVisible}
stationObj={currentStationMsg} stationObj={currentStationMsg}
des={des}
onCancel={() => handleShowModal('editVisible', false)} onCancel={() => handleShowModal('editVisible', false)}
confirmModal={editModal} confirmModal={editModal}
/> />
...@@ -565,7 +605,7 @@ const SiteManageV2 = () => { ...@@ -565,7 +605,7 @@ const SiteManageV2 = () => {
/> />
</Col> </Col>
<Col span={3} /> <Col span={3} />
</Row> </Row>
</Card> </Card>
<div style={{ background: '#fff' }}> <div style={{ background: '#fff' }}>
...@@ -654,7 +694,7 @@ const Panels = React.memo(props => { ...@@ -654,7 +694,7 @@ const Panels = React.memo(props => {
<DownOutlined className={styles.siteIcon} /> <DownOutlined className={styles.siteIcon} />
)} */} )} */}
{/* <UpOutlined className={styles.siteIcon} /> */} {/* <UpOutlined className={styles.siteIcon} /> */}
<UserOutlined className={styles.siteIcon} /> <ApartmentOutlined className={styles.siteIcon} />
<p style={{ color }}>{GroupName}</p> <p style={{ color }}>{GroupName}</p>
<Checkbox <Checkbox
key="0" key="0"
......
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