Commit 65b27c9f by zhaochengxiang

导出Erwin

parent c832451d
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
"craco-less": "^1.17.1", "craco-less": "^1.17.1",
"crypto-js": "^4.0.0", "crypto-js": "^4.0.0",
"immutability-helper": "^3.1.1", "immutability-helper": "^3.1.1",
"copy-to-clipboard": "^3.3.1",
"less": "^4.1.1", "less": "^4.1.1",
"less-loader": "^8.0.0", "less-loader": "^8.0.0",
"react": "^17.0.1", "react": "^17.0.1",
......
...@@ -109,3 +109,7 @@ export function* ddlGenerators() { ...@@ -109,3 +109,7 @@ export function* ddlGenerators() {
export function* exportDDLString(payload) { export function* exportDDLString(payload) {
return yield call(datamodelerService.exportDDLString, payload); return yield call(datamodelerService.exportDDLString, payload);
} }
export function* exportERWinString(payload) {
return yield call(datamodelerService.exportERWinString, payload);
}
...@@ -70,3 +70,7 @@ export function ddlGenerators() { ...@@ -70,3 +70,7 @@ export function ddlGenerators() {
export function exportDDLString(payload) { export function exportDDLString(payload) {
return GetJSON("/datamodeler/easyDataModelerExport/ddlString", payload); return GetJSON("/datamodeler/easyDataModelerExport/ddlString", payload);
} }
export function exportERWinString(payload) {
return GetJSON("/datamodeler/easyDataModelerExport/erWinPluginString", payload);
}
import React from 'react'; import React from 'react';
import { Modal, Radio, Button, Select, Input } from 'antd'; import { Modal, Radio, Button, Select, Input } from 'antd';
import copy from "copy-to-clipboard";
import { showMessage } from '../../../../util'; import { showMessage } from '../../../../util';
import { dispatch } from '../../../../model'; import { dispatch } from '../../../../model';
...@@ -8,6 +9,14 @@ const { Option } = Select; ...@@ -8,6 +9,14 @@ const { Option } = Select;
const modes = [ const modes = [
{ {
title: '导出DDL',
key: 'ddl',
},
{
title: '导出Erwin',
key: 'erwin',
},
{
title: '导出Excel', title: '导出Excel',
key: 'excel', key: 'excel',
}, },
...@@ -15,10 +24,6 @@ const modes = [ ...@@ -15,10 +24,6 @@ const modes = [
title: '导出Word', title: '导出Word',
key: 'word', key: 'word',
}, },
{
title: '导出ddl',
key: 'ddl',
}
] ]
class ExportModal extends React.Component { class ExportModal extends React.Component {
...@@ -106,8 +111,6 @@ class ExportModal extends React.Component { ...@@ -106,8 +111,6 @@ class ExportModal extends React.Component {
}, },
callback: data => { callback: data => {
this.setState({ confirmLoading: false }, () => { this.setState({ confirmLoading: false }, () => {
// this.reset();
// onCancel && onCancel(data||[]);
this.setState({ ddlExportSuccess: true, ddlExportString: data.join('\n') }); this.setState({ ddlExportSuccess: true, ddlExportString: data.join('\n') });
}); });
}, },
...@@ -117,6 +120,27 @@ class ExportModal extends React.Component { ...@@ -117,6 +120,27 @@ class ExportModal extends React.Component {
}); });
}) })
} else if (selectedKey === 'erwin') {
this.setState({ confirmLoading: true }, () => {
dispatch({
type: 'datamodel.exportERWinString',
payload: {
ids: ids.join(','),
},
callback: data => {
this.setState({ confirmLoading: false }, () => {
copy(JSON.stringify(data));
this.reset();
onCancel && onCancel(selectedKey);
});
},
error: () => {
this.setState({ confirmLoading: false });
}
});
})
} }
} }
...@@ -132,7 +156,7 @@ class ExportModal extends React.Component { ...@@ -132,7 +156,7 @@ class ExportModal extends React.Component {
const { visible, onCancel } = this.props; const { visible, onCancel } = this.props;
const { selectedKey, ddlGenerators, loadingDDLGenerators, confirmLoading, selectDDLGeneratorName, ddlExportSuccess, ddlExportString } = this.state; const { selectedKey, ddlGenerators, loadingDDLGenerators, confirmLoading, selectDDLGeneratorName, ddlExportSuccess, ddlExportString } = this.state;
const title = ddlExportSuccess ? 'ddl导出详情' : '导出方式'; const title = ddlExportSuccess ? 'DDL导出详情' : '导出方式';
const footer = ddlExportSuccess ? ([ const footer = ddlExportSuccess ? ([
<Button <Button
......
...@@ -5,7 +5,7 @@ import ModelTree from './Component/ModelTree'; ...@@ -5,7 +5,7 @@ import ModelTree from './Component/ModelTree';
import ModelTable from './Component/ModelTable'; import ModelTable from './Component/ModelTable';
import ImportModal from './Component/ImportModal'; import ImportModal from './Component/ImportModal';
import ExportModal from './Component/ExportModal'; import ExportModal from './Component/ExportModal';
import { showMessage } from '../../../util'; import { showMessage, showNotifaction } from '../../../util';
import { dispatch } from '../../../model'; import { dispatch } from '../../../model';
class Model extends React.Component { class Model extends React.Component {
...@@ -85,32 +85,12 @@ class Model extends React.Component { ...@@ -85,32 +85,12 @@ class Model extends React.Component {
refresh && this.onTableChange(); refresh && this.onTableChange();
} }
onExportModalCancel = () => { onExportModalCancel = (selectedKey = '') => {
this.setState({ exportModalVisible: false }); this.setState({ exportModalVisible: false });
// if (ddlStrings.length>0) { if (selectedKey === 'erwin') {
showNotifaction('提示', 'Erwin信息已成功复制到剪贴板', 4);
// const tip = ( }
// <>
// {
// ddlStrings && ddlStrings.map((ddlString, index) => {
// return (
// <Typography.Paragraph
// key={index}
// copyable={{
// tooltips: ['复制', '复制成功'],
// }}
// >
// { ddlString||'' }
// </Typography.Paragraph>
// )
// })
// }
// </>
// );
// showNotifaction('ddl', tip);
// }
} }
render() { render() {
......
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