|
@@ -20,6 +20,7 @@ import {
|
|
Alert,
|
|
Alert,
|
|
Spin,
|
|
Spin,
|
|
Tabs,
|
|
Tabs,
|
|
|
|
+ Divider,
|
|
} from 'antd';
|
|
} from 'antd';
|
|
import list from '../List/models/list';
|
|
import list from '../List/models/list';
|
|
|
|
|
|
@@ -33,7 +34,9 @@ function CompareModal(props) {
|
|
|
|
|
|
const [checkValue, setCheckValue] = useState([]);
|
|
const [checkValue, setCheckValue] = useState([]);
|
|
const [tabList, setTabList] = useState([]);
|
|
const [tabList, setTabList] = useState([]);
|
|
- const [active, setActive] = useState();
|
|
|
|
|
|
+ const [active, setActive] = useState(1);
|
|
|
|
+ const [indeterminate, setIndeterminate] = useState(false);
|
|
|
|
+ const [checkAll, setCheckAll] = useState(false);
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
const list = [];
|
|
const list = [];
|
|
@@ -45,40 +48,53 @@ function CompareModal(props) {
|
|
if (item.data && item.data[0]) {
|
|
if (item.data && item.data[0]) {
|
|
obj.list = item.data[0]?.filter(cur => cur);
|
|
obj.list = item.data[0]?.filter(cur => cur);
|
|
obj.list.forEach(item => {
|
|
obj.list.forEach(item => {
|
|
- if(item.ct.t == "inlineStr") {
|
|
|
|
- item.v = item.ct.s.map(s => s.v).join("")
|
|
|
|
|
|
+ if (item.ct.t == 'inlineStr') {
|
|
|
|
+ item.v = item.ct.s.map(s => s.v).join('');
|
|
}
|
|
}
|
|
- })
|
|
|
|
|
|
+ });
|
|
}
|
|
}
|
|
obj.id = item.index;
|
|
obj.id = item.index;
|
|
list.push(obj);
|
|
list.push(obj);
|
|
});
|
|
});
|
|
- setCheckValue([]);
|
|
|
|
|
|
+ setCheckValue(list[0]?.list?.map(item => item.cid));
|
|
setTabList(list);
|
|
setTabList(list);
|
|
setActive(list[0]?.id);
|
|
setActive(list[0]?.id);
|
|
|
|
+ setCheckAll(true);
|
|
}
|
|
}
|
|
}, [sheet]);
|
|
}, [sheet]);
|
|
|
|
|
|
const onChange = check => {
|
|
const onChange = check => {
|
|
setCheckValue(check);
|
|
setCheckValue(check);
|
|
- console.log(check);
|
|
|
|
};
|
|
};
|
|
|
|
|
|
const handleOk = () => {
|
|
const handleOk = () => {
|
|
onOk(checkValue);
|
|
onOk(checkValue);
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ const onCheckAllChange = e => {
|
|
|
|
+ setCheckAll(!checkAll);
|
|
|
|
+ setCheckValue(checkAll ? [] : tabList[active - 1]?.list?.map(item => item.cid));
|
|
|
|
+ };
|
|
|
|
+
|
|
return (
|
|
return (
|
|
<Modal
|
|
<Modal
|
|
title="选择导出列"
|
|
title="选择导出列"
|
|
visible={visible}
|
|
visible={visible}
|
|
onCancel={onClose}
|
|
onCancel={onClose}
|
|
onOk={handleOk}
|
|
onOk={handleOk}
|
|
|
|
+ width={1000}
|
|
bodyStyle={{ paddingTop: 0 }}
|
|
bodyStyle={{ paddingTop: 0 }}
|
|
>
|
|
>
|
|
<Checkbox.Group value={checkValue} style={{ width: '100%' }} onChange={onChange}>
|
|
<Checkbox.Group value={checkValue} style={{ width: '100%' }} onChange={onChange}>
|
|
- <Tabs activeKey={active} onChange={setActive}>
|
|
|
|
- {tabList.map(tab => (
|
|
|
|
|
|
+ <Tabs
|
|
|
|
+ activeKey={active}
|
|
|
|
+ onChange={value => {
|
|
|
|
+ setCheckAll(false);
|
|
|
|
+ setCheckValue([]);
|
|
|
|
+ setActive(value);
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
|
|
+ {tabList?.map(tab => (
|
|
<TabPane tab={tab.name} key={tab.id}>
|
|
<TabPane tab={tab.name} key={tab.id}>
|
|
<Row>
|
|
<Row>
|
|
{tab.list.map(item => (
|
|
{tab.list.map(item => (
|
|
@@ -91,6 +107,10 @@ function CompareModal(props) {
|
|
))}
|
|
))}
|
|
</Tabs>
|
|
</Tabs>
|
|
</Checkbox.Group>
|
|
</Checkbox.Group>
|
|
|
|
+ <Divider />
|
|
|
|
+ <Checkbox indeterminate={indeterminate} onChange={onCheckAllChange} checked={checkAll}>
|
|
|
|
+ 全选
|
|
|
|
+ </Checkbox>
|
|
</Modal>
|
|
</Modal>
|
|
);
|
|
);
|
|
}
|
|
}
|