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 {Button, Checkbox, WhiteSpace, WingBlank} from "antd-mobile";
const AgreeItem = Checkbox.AgreeItem;
import {Button, WhiteSpace, WingBlank} from "antd-mobile";
const TreeData = (props) => {
const {data, onClick, closeModal} = props;
const {data, onClick, closeModal, onSubmit, peopleData, peopleSubmit} = props;
const [treeData, setTreeData] = useState([]);
useEffect(() => {
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);
}, [data]);
const [sGood, setSGood] = useState([])
const [sGood, setSGood] = useState([]);
const checkGood = (keyIndex, checked) => {
const newData = [...sGood];
const Index = sGood.findIndex(item => item === keyIndex);
......@@ -21,36 +19,31 @@ const TreeData = (props) => {
setSGood(newData)
};
const submit = () => {
getAll()
const subData = data.filter((item, index) => sGood.indexOf(index) > -1);
onSubmit(sGood);
findParent(subData);
};
const getAll = val => {
const result = data.filter((item, index) => sGood.indexOf(index) > -1);
result.map(item => {
const a = treeFindPath(treeData[0] && treeData[0].subList, item.keyIndex === item);
console.log(a)
})
};
function treeFindPath (tree, func, path = []) {
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 []
const findParent = (treeChild) => {
const par = data.filter(item => treeChild.findIndex(child => child.LSID === item.XH) > -1);
const treeChild2 = treeChild.concat(par);
const par2 = data.filter(item => treeChild2.findIndex(child => child.LSID === item.XH) > -1);
if (par.length !== par2.length) {
findParent(treeChild.concat(par2))
}else {
peopleSubmit(Array.from(new Set(treeChild2)))
}
};
useEffect(() => {
setSGood(peopleData)
}, [peopleData]);
console.log(sGood);
const getProps = (data) => (
<div className="address-box">
{data && data.length > 0 && data.map((item, index) => (
<div key={index}>
<div key={item.keyIndex}>
<div onClick={() => onClick(item.keyIndex)} className="address-item">
<div className="address-title">{item.MC || ''}</div>
<img src="/img/rarrow.png" alt="" className={`icon18 ${item.checked ? 'icon-checked' : 'icon-unchecked'}`}/>
......@@ -58,7 +51,7 @@ const TreeData = (props) => {
{ item.checked && item.subList && (item.subList.length > 0 ? (
<div className="address-item-box">
{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">
<input checked={sGood.indexOf(child.keyIndex) > -1} className="auto-checkbox" type="checkbox" onChange={val => checkGood(child.keyIndex, val.target.checked)}/>
{child.XM || ''}
......@@ -68,7 +61,7 @@ const TreeData = (props) => {
<a className="address-phone">{child.YDDH || '无'}</a>
</div>
</div>
) : getProps(child.subList))}
) : <div key={child.keyIndex}>{getProps(child.subList)}</div>)}
</div>
): (
<div className="address-item" key={item.keyIndex}>
......@@ -96,7 +89,7 @@ const TreeData = (props) => {
<WhiteSpace/>
<div className="modal-form-footer">
<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>
</WingBlank>
</div>
......
import React, {useState, useEffect} from 'react';
import { createForm } from 'rc-form';
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 Upload from 'rc-upload';
import './index.less'
......@@ -15,7 +15,6 @@ const Send = (props) => {
const {getFieldProps} = props.form;
const [UUID, setUUID] = useState();
const [meetPerson, setMeetPerson] = useState([])
const onSubmit = () => {
props.form.validateFields({ force: true }, (error) => {
......@@ -42,7 +41,7 @@ const Send = (props) => {
}).then(res => {
res.uuid && setUUID(res.uuid);
});
UUID && new Promise((resolve => {
UUID && upload.length > 0 && upload2.length > 0 && new Promise((resolve => {
uploadFile(upload, 'zw', UUID);
uploadFile(upload2, 'fj', UUID);
resolve()
......@@ -144,13 +143,14 @@ const Send = (props) => {
setPlaceVisible(true)
};
const getPerson = () => {
onSubmit();
setPersonVisible(true)
};
const [HYSDD, setHYSDD] = useState();
const selectRoom = HYSDD => {
setHYSDD(HYSDD);
};
const [sP, setSP] = useState([])
const [sP, setSP] = useState([]);
return (
<div>
......@@ -160,8 +160,11 @@ const Send = (props) => {
selectR={selectRoom}
/>
<PeopleInfo
UUID={UUID}
visible={personVisible}
onClose={setPersonVisible}
peopleData={sP}
onSelect={setSP}
/>
<form>
<List className="send-content">
......@@ -182,7 +185,7 @@ const Send = (props) => {
)
}else if (item.label === '会议地点') {
return (
<List.Item className="auto-flex" extra={
<List.Item className="auto-flex" key={index} extra={
<div className="pos-aline">
<div className="meet-select-btn" onClick={getPlace}>选择会议地点</div>
<div className="ml-40 room-num">{HYSDD}</div>
......@@ -191,10 +194,10 @@ const Send = (props) => {
)
} else if (item.label === '参会人员') {
return (
<List.Item className="auto-flex" extra={
<List.Item className="auto-flex" key={index} extra={
<div className="pos-aline">
<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>
}>参会人员</List.Item>
)
......@@ -232,7 +235,7 @@ const Send = (props) => {
{formData.length > 0 && (
<div className="event-footer">
{/*<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>
)}
......
import React, {useEffect, useState} from 'react';
import {Button, Modal, WhiteSpace, WingBlank} from "antd-mobile";
import { Modal } from "antd-mobile";
import './index.less'
import axiosRequest from "../../../utils/request";
import TreeData from '../../../components/AddressList/TreeData'
const Send = (props) => {
const {visible, onClose} = props;
const {visible, onClose, onSelect, peopleData, UUID} = props;
const closeModal = () => {
onClose(false)
......@@ -22,7 +22,7 @@ const Send = (props) => {
args: JSON.stringify(['47c2c4f9235aa97f01235aa97f7c0000']),
},
}).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)
})
}, []);
......@@ -33,9 +33,22 @@ const Send = (props) => {
newData[keyIndex].checked = !newData[keyIndex].checked;
setData(newData)
};
const submit = val => {
console.log(val)
const submitData = val => {
onSelect(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 (
......@@ -48,9 +61,12 @@ const Send = (props) => {
onClose={() => onClose(false)}
>
<TreeData
peopleSubmit={peopleSubmit}
peopleData={peopleData}
data={data}
onClick={onClick}
closeModal={closeModal}
onSubmit={submitData}
/>
</Modal>
</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