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

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

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