Commit 64e1bcfb authored by DarkForst's avatar DarkForst

debug

parent 2f016c16
Pipeline #16368 failed with stages
in 41 seconds
import React, {useState, useEffect} from 'react'; import React, {useState, useEffect} from 'react';
import {Button, Checkbox, WhiteSpace, WingBlank} from "antd-mobile"; import {Button, WhiteSpace, WingBlank} from "antd-mobile";
const AgreeItem = Checkbox.AgreeItem;
const TreeData = (props) => { const TreeData = (props) => {
const {data, onClick, closeModal} = props; const {data, onClick, closeModal, onSubmit, peopleData, peopleSubmit} = props;
const [treeData, setTreeData] = useState([]); const [treeData, setTreeData] = useState([]);
useEffect(() => { useEffect(() => {
const newData = JSON.parse(JSON.stringify(data)); const newData = JSON.parse(JSON.stringify(data));
newData.map((item, index) => {item.subList = newData.filter(child => item.XH === child.LSID); item.keyIndex = index}); newData.map((item, index) => {item.subList = newData.filter(child => item.XH === child.LSID); item.keyIndex = index; return null});
setTreeData(newData); setTreeData(newData);
}, [data]); }, [data]);
const [sGood, setSGood] = useState([]) const [sGood, setSGood] = useState([]);
const checkGood = (keyIndex, checked) => { const checkGood = (keyIndex, checked) => {
const newData = [...sGood]; const newData = [...sGood];
const Index = sGood.findIndex(item => item === keyIndex); const Index = sGood.findIndex(item => item === keyIndex);
...@@ -21,36 +19,31 @@ const TreeData = (props) => { ...@@ -21,36 +19,31 @@ const TreeData = (props) => {
setSGood(newData) setSGood(newData)
}; };
const submit = () => { const submit = () => {
getAll() const subData = data.filter((item, index) => sGood.indexOf(index) > -1);
onSubmit(sGood);
findParent(subData);
}; };
const getAll = val => { const findParent = (treeChild) => {
const result = data.filter((item, index) => sGood.indexOf(index) > -1); const par = data.filter(item => treeChild.findIndex(child => child.LSID === item.XH) > -1);
result.map(item => { const treeChild2 = treeChild.concat(par);
const a = treeFindPath(treeData[0] && treeData[0].subList, item.keyIndex === item); const par2 = data.filter(item => treeChild2.findIndex(child => child.LSID === item.XH) > -1);
console.log(a) if (par.length !== par2.length) {
}) findParent(treeChild.concat(par2))
}; }else {
function treeFindPath (tree, func, path = []) { peopleSubmit(Array.from(new Set(treeChild2)))
if (!tree) return []
for (const data of tree) {
// 这里按照你的需求来存放最后返回的内容吧
path.push(data.keyIndex);
if (data.subList) {
const findChildren = treeFindPath(data.subList, func, path)
if (findChildren.length) return findChildren
}
path.pop()
} }
return [] };
} useEffect(() => {
setSGood(peopleData)
}, [peopleData]);
console.log(sGood);
const getProps = (data) => ( const getProps = (data) => (
<div className="address-box"> <div className="address-box">
{data && data.length > 0 && data.map((item, index) => ( {data && data.length > 0 && data.map((item, index) => (
<div key={index}> <div key={item.keyIndex}>
<div onClick={() => onClick(item.keyIndex)} className="address-item"> <div onClick={() => onClick(item.keyIndex)} className="address-item">
<div className="address-title">{item.MC || ''}</div> <div className="address-title">{item.MC || ''}</div>
<img src="/img/rarrow.png" alt="" className={`icon18 ${item.checked ? 'icon-checked' : 'icon-unchecked'}`}/> <img src="/img/rarrow.png" alt="" className={`icon18 ${item.checked ? 'icon-checked' : 'icon-unchecked'}`}/>
...@@ -58,7 +51,7 @@ const TreeData = (props) => { ...@@ -58,7 +51,7 @@ const TreeData = (props) => {
{ item.checked && item.subList && (item.subList.length > 0 ? ( { item.checked && item.subList && (item.subList.length > 0 ? (
<div className="address-item-box"> <div className="address-item-box">
{item.subList.map((child, index2) => child.subList.length === 0 ? ( {item.subList.map((child, index2) => child.subList.length === 0 ? (
<div className="address-item" key={index2}> <div className="address-item" key={child.keyIndex}>
<div className="xm-box pos-aline"> <div className="xm-box pos-aline">
<input checked={sGood.indexOf(child.keyIndex) > -1} className="auto-checkbox" type="checkbox" onChange={val => checkGood(child.keyIndex, val.target.checked)}/> <input checked={sGood.indexOf(child.keyIndex) > -1} className="auto-checkbox" type="checkbox" onChange={val => checkGood(child.keyIndex, val.target.checked)}/>
{child.XM || ''} {child.XM || ''}
...@@ -68,7 +61,7 @@ const TreeData = (props) => { ...@@ -68,7 +61,7 @@ const TreeData = (props) => {
<a className="address-phone">{child.YDDH || '无'}</a> <a className="address-phone">{child.YDDH || '无'}</a>
</div> </div>
</div> </div>
) : getProps(child.subList))} ) : <div key={child.keyIndex}>{getProps(child.subList)}</div>)}
</div> </div>
): ( ): (
<div className="address-item" key={item.keyIndex}> <div className="address-item" key={item.keyIndex}>
...@@ -96,7 +89,7 @@ const TreeData = (props) => { ...@@ -96,7 +89,7 @@ const TreeData = (props) => {
<WhiteSpace/> <WhiteSpace/>
<div className="modal-form-footer"> <div className="modal-form-footer">
<Button className="date-button mr-12 bg-gray" inline onClick={closeModal}>取消</Button> <Button className="date-button mr-12 bg-gray" inline onClick={closeModal}>取消</Button>
<Button className="date-button" inline type="primary" onClick={submit}>确认选择</Button> <Button disabled={sGood.length === 0} className="date-button" inline type="primary" onClick={submit}>确认选择</Button>
</div> </div>
</WingBlank> </WingBlank>
</div> </div>
......
import React, {useState, useEffect} from 'react'; import React, {useState, useEffect} from 'react';
import { createForm } from 'rc-form'; import { createForm } from 'rc-form';
import axiosRequest from "../../../utils/request"; import axiosRequest from "../../../utils/request";
import {DatePicker, List, WhiteSpace, WingBlank, Picker, InputItem, Toast, Button} from "antd-mobile"; import {DatePicker, List, WhiteSpace, WingBlank, Picker, InputItem, Toast} from "antd-mobile";
import MailA from '../../../components/Adjunct/MailA' import MailA from '../../../components/Adjunct/MailA'
import Upload from 'rc-upload'; import Upload from 'rc-upload';
import './index.less' import './index.less'
...@@ -15,7 +15,6 @@ const Send = (props) => { ...@@ -15,7 +15,6 @@ const Send = (props) => {
const {getFieldProps} = props.form; const {getFieldProps} = props.form;
const [UUID, setUUID] = useState(); const [UUID, setUUID] = useState();
const [meetPerson, setMeetPerson] = useState([])
const onSubmit = () => { const onSubmit = () => {
props.form.validateFields({ force: true }, (error) => { props.form.validateFields({ force: true }, (error) => {
...@@ -42,7 +41,7 @@ const Send = (props) => { ...@@ -42,7 +41,7 @@ const Send = (props) => {
}).then(res => { }).then(res => {
res.uuid && setUUID(res.uuid); res.uuid && setUUID(res.uuid);
}); });
UUID && new Promise((resolve => { UUID && upload.length > 0 && upload2.length > 0 && new Promise((resolve => {
uploadFile(upload, 'zw', UUID); uploadFile(upload, 'zw', UUID);
uploadFile(upload2, 'fj', UUID); uploadFile(upload2, 'fj', UUID);
resolve() resolve()
...@@ -144,13 +143,14 @@ const Send = (props) => { ...@@ -144,13 +143,14 @@ const Send = (props) => {
setPlaceVisible(true) setPlaceVisible(true)
}; };
const getPerson = () => { const getPerson = () => {
onSubmit();
setPersonVisible(true) setPersonVisible(true)
}; };
const [HYSDD, setHYSDD] = useState(); const [HYSDD, setHYSDD] = useState();
const selectRoom = HYSDD => { const selectRoom = HYSDD => {
setHYSDD(HYSDD); setHYSDD(HYSDD);
}; };
const [sP, setSP] = useState([]) const [sP, setSP] = useState([]);
return ( return (
<div> <div>
...@@ -160,8 +160,11 @@ const Send = (props) => { ...@@ -160,8 +160,11 @@ const Send = (props) => {
selectR={selectRoom} selectR={selectRoom}
/> />
<PeopleInfo <PeopleInfo
UUID={UUID}
visible={personVisible} visible={personVisible}
onClose={setPersonVisible} onClose={setPersonVisible}
peopleData={sP}
onSelect={setSP}
/> />
<form> <form>
<List className="send-content"> <List className="send-content">
...@@ -182,7 +185,7 @@ const Send = (props) => { ...@@ -182,7 +185,7 @@ const Send = (props) => {
) )
}else if (item.label === '会议地点') { }else if (item.label === '会议地点') {
return ( return (
<List.Item className="auto-flex" extra={ <List.Item className="auto-flex" key={index} extra={
<div className="pos-aline"> <div className="pos-aline">
<div className="meet-select-btn" onClick={getPlace}>选择会议地点</div> <div className="meet-select-btn" onClick={getPlace}>选择会议地点</div>
<div className="ml-40 room-num">{HYSDD}</div> <div className="ml-40 room-num">{HYSDD}</div>
...@@ -191,10 +194,10 @@ const Send = (props) => { ...@@ -191,10 +194,10 @@ const Send = (props) => {
) )
} else if (item.label === '参会人员') { } else if (item.label === '参会人员') {
return ( return (
<List.Item className="auto-flex" extra={ <List.Item className="auto-flex" key={index} extra={
<div className="pos-aline"> <div className="pos-aline">
<div className="meet-select-btn" onClick={getPerson}>选择参会人员</div> <div className="meet-select-btn" onClick={getPerson}>选择参会人员</div>
<div className="ml-40 room-num">{sP.length}</div> <div className="ml-40 room-num">{sP.length}</div>
</div> </div>
}>参会人员</List.Item> }>参会人员</List.Item>
) )
...@@ -232,7 +235,7 @@ const Send = (props) => { ...@@ -232,7 +235,7 @@ const Send = (props) => {
{formData.length > 0 && ( {formData.length > 0 && (
<div className="event-footer"> <div className="event-footer">
{/*<Button type="primary">保存</Button>*/} {/*<Button type="primary">保存</Button>*/}
<div className={`footer-button ${meetPerson.length > 0 ? '' : 'btn-disabled'}`} onClick={meetPerson.length === 0 ? onSubmit : null}>保存</div> <div className={`footer-button ${sP.length > 0 ? '' : 'btn-disabled'}`} onClick={sP.length === 0 ? onSubmit : null}>保存</div>
</div> </div>
)} )}
......
import React, {useEffect, useState} from 'react'; import React, {useEffect, useState} from 'react';
import {Button, Modal, WhiteSpace, WingBlank} from "antd-mobile"; import { Modal } from "antd-mobile";
import './index.less' import './index.less'
import axiosRequest from "../../../utils/request"; import axiosRequest from "../../../utils/request";
import TreeData from '../../../components/AddressList/TreeData' import TreeData from '../../../components/AddressList/TreeData'
const Send = (props) => { const Send = (props) => {
const {visible, onClose} = props; const {visible, onClose, onSelect, peopleData, UUID} = props;
const closeModal = () => { const closeModal = () => {
onClose(false) onClose(false)
...@@ -22,7 +22,7 @@ const Send = (props) => { ...@@ -22,7 +22,7 @@ const Send = (props) => {
args: JSON.stringify(['47c2c4f9235aa97f01235aa97f7c0000']), args: JSON.stringify(['47c2c4f9235aa97f01235aa97f7c0000']),
}, },
}).then((res) => { }).then((res) => {
res.map(item => {item.ATTACH_ID = ''; item.checked = false} ); res.map(item => {item.ATTACH_ID = UUID; item.checked = false; return null});
setData(res) setData(res)
}) })
}, []); }, []);
...@@ -33,9 +33,22 @@ const Send = (props) => { ...@@ -33,9 +33,22 @@ const Send = (props) => {
newData[keyIndex].checked = !newData[keyIndex].checked; newData[keyIndex].checked = !newData[keyIndex].checked;
setData(newData) setData(newData)
}; };
const submitData = val => {
const submit = val => { onSelect(val);
console.log(val) onClose(false)
};
const peopleSubmit = (data) => {
console.log(data)
// axiosRequest({
// method: 'post',
// url: '/idtAppServiceV6/exclude/control/getList',
// body: {
// script: 'hysqTreeAll',
// args: JSON.stringify(['47c2c4f9235aa97f01235aa97f7c0000']),
// },
// }).then((res) => {
//
// })
} }
return ( return (
...@@ -48,9 +61,12 @@ const Send = (props) => { ...@@ -48,9 +61,12 @@ const Send = (props) => {
onClose={() => onClose(false)} onClose={() => onClose(false)}
> >
<TreeData <TreeData
peopleSubmit={peopleSubmit}
peopleData={peopleData}
data={data} data={data}
onClick={onClick} onClick={onClick}
closeModal={closeModal} closeModal={closeModal}
onSubmit={submitData}
/> />
</Modal> </Modal>
</div> </div>
......
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