|
@@ -1,4 +1,4 @@
|
|
|
-import React, { useEffect, useState, useRef } from 'react';
|
|
|
+import React, { useEffect, useState, useRef, useMemo } from 'react';
|
|
|
import { Form } from '@ant-design/compatible';
|
|
|
import '@ant-design/compatible/assets/index.css';
|
|
|
import { Modal, Radio, Row, Col, message, Tabs } from 'antd';
|
|
@@ -8,7 +8,7 @@ const { TabPane } = Tabs;
|
|
|
|
|
|
// 选择比对版本
|
|
|
function MergeModal(props) {
|
|
|
- const { visible, versionList, onClose, onOk, dispatch, version } = props;
|
|
|
+ const { visible, versionList, onClose, onOk, dispatch, version, flowDetail } = props;
|
|
|
|
|
|
const [checkValue, setCheckValue] = useState([]);
|
|
|
|
|
@@ -26,11 +26,33 @@ function MergeModal(props) {
|
|
|
setCheckValue();
|
|
|
}
|
|
|
};
|
|
|
+ const tabList = useMemo(() => {
|
|
|
+ let list = {};
|
|
|
+ versionList.forEach(version => {
|
|
|
+ let nodeId = version.template_node_id;
|
|
|
+ if (!nodeId || nodeId === '0') return;
|
|
|
+ if (!list[nodeId]) {
|
|
|
+ list[nodeId] = [];
|
|
|
+ }
|
|
|
+ list[nodeId].push(version);
|
|
|
+ });
|
|
|
+ return Object.keys(list).map(nodeId => ({
|
|
|
+ name: flowDetail.nodes.find(node => node.Id == nodeId)?.label,
|
|
|
+ id: nodeId,
|
|
|
+ list: list[nodeId],
|
|
|
+ }));
|
|
|
+ }, [versionList, flowDetail]);
|
|
|
|
|
|
return (
|
|
|
- <Modal title="选择比对文件" visible={visible} onCancel={onClose} onOk={handleOk}>
|
|
|
+ <Modal
|
|
|
+ title="选择同步文件"
|
|
|
+ visible={visible}
|
|
|
+ onCancel={onClose}
|
|
|
+ onOk={handleOk}
|
|
|
+ bodyStyle={{ paddingTop: 0 }}
|
|
|
+ >
|
|
|
<Radio.Group value={checkValue} style={{ width: '100%' }} onChange={onChange}>
|
|
|
- <Row gutter={16}>
|
|
|
+ {/* <Row gutter={16}>
|
|
|
{versionList.map(v => {
|
|
|
if (v.id == version.id) return null;
|
|
|
return (
|
|
@@ -39,12 +61,27 @@ function MergeModal(props) {
|
|
|
</Col>
|
|
|
);
|
|
|
})}
|
|
|
- </Row>
|
|
|
+ </Row> */}
|
|
|
+ <Tabs>
|
|
|
+ {tabList.map(tab => (
|
|
|
+ <TabPane tab={tab.name} key={tab.id}>
|
|
|
+ <Row>
|
|
|
+ {tab.list.map(version => (
|
|
|
+ <Col span={8} key={version.id}>
|
|
|
+ {/* <Checkbox value={version.id}>{version.version_name}</Checkbox> */}
|
|
|
+ <Radio value={version.id}>{version.version_name}</Radio>
|
|
|
+ </Col>
|
|
|
+ ))}
|
|
|
+ </Row>
|
|
|
+ </TabPane>
|
|
|
+ ))}
|
|
|
+ </Tabs>
|
|
|
</Radio.Group>
|
|
|
</Modal>
|
|
|
);
|
|
|
}
|
|
|
|
|
|
-export default connect(({ detail }) => ({
|
|
|
+export default connect(({ detail, xflow }) => ({
|
|
|
versionList: detail.versionList,
|
|
|
+ flowDetail: xflow.flowDetail,
|
|
|
}))(MergeModal);
|