import React, { useEffect, useState, useRef } from 'react'; import { Form } from '@ant-design/compatible'; import '@ant-design/compatible/assets/index.css'; import { Steps, Button, Drawer, Comment, Tooltip, Avatar, List, Card, Modal, Checkbox, Row, Col, message, Input, Table, Alert, Spin, Tabs, } from 'antd'; import list from '../List/models/list'; const { Step } = Steps; const { TextArea } = Input; const { TabPane } = Tabs; // 选择比对清单 function CompareModal(props) { const { visible, onClose, onOk, sheet } = props; const [checkValue, setCheckValue] = useState([]); const [tabList, setTabList] = useState([]); const [active, setActive] = useState(); useEffect(() => { const list = []; if (sheet && sheet.length > 0) { const sheetData = JSON.parse(JSON.stringify(sheet)); sheetData.forEach(item => { let obj = {}; obj.name = item.name; if (item.data && item.data[0]) { obj.list = item.data[0]?.filter(cur => cur); obj.list.forEach(item => { if(item.ct.t == "inlineStr") { item.v = item.ct.s.map(s => s.v).join("") } }) } obj.id = item.index; list.push(obj); }); setCheckValue([]); setTabList(list); setActive(list[0]?.id); } }, [sheet]); const onChange = check => { setCheckValue(check); console.log(check); }; const handleOk = () => { onOk(checkValue); }; return ( {tabList.map(tab => ( {tab.list.map(item => ( {item.v} ))} ))} ); } export default CompareModal;