Commit c832451d by zhaochengxiang

ddl导出样式调整

parent ecbdb6d4
import { filePost, Get, GetJSON, PostJSON, Post } from "../util/axios"
import { filePost, GetJSON, PostJSON, Post } from "../util/axios"
export function loadDataModelCatalog() {
return GetJSON("/datamodeler/easyDataModelerCURD/loadDataModelCatalog");
......
import React from 'react';
import { Modal, Radio, Button, Select } from 'antd';
import { Modal, Radio, Button, Select, Input } from 'antd';
import { showMessage } from '../../../../util';
import { dispatch } from '../../../../model';
......@@ -31,6 +31,8 @@ class ExportModal extends React.Component {
ddlGenerators: [],
selectDDLGeneratorName: null,
confirmLoading: false,
ddlExportSuccess: false,
ddlExportString: '',
}
}
......@@ -104,8 +106,9 @@ class ExportModal extends React.Component {
},
callback: data => {
this.setState({ confirmLoading: false }, () => {
this.reset();
onCancel && onCancel(data||[]);
// this.reset();
// onCancel && onCancel(data||[]);
this.setState({ ddlExportSuccess: true, ddlExportString: data.join('\n') });
});
},
error: () => {
......@@ -118,7 +121,7 @@ class ExportModal extends React.Component {
}
reset = () => {
this.setState({ selectedKey: '', selectDDLGeneratorName: '' });
this.setState({ selectedKey: '', selectDDLGeneratorName: '', ddlExportSuccess: false, ddlExportString: '' });
}
onDDLGeneratorChange = (value) => {
......@@ -127,57 +130,87 @@ class ExportModal extends React.Component {
render() {
const { visible, onCancel } = this.props;
const { selectedKey, ddlGenerators, loadingDDLGenerators, confirmLoading, selectDDLGeneratorName } = this.state;
const { selectedKey, ddlGenerators, loadingDDLGenerators, confirmLoading, selectDDLGeneratorName, ddlExportSuccess, ddlExportString } = this.state;
const title = ddlExportSuccess ? 'ddl导出详情' : '导出方式';
const footer = ddlExportSuccess ? ([
<Button
key="0"
type="primary"
onClick={() => {
this.reset();
onCancel && onCancel();
}}
>
取消
</Button>
]) : ([
<Button
key="0"
type="primary"
onClick={() => {
this.reset();
onCancel && onCancel();
}}
>
取消
</Button>,
<Button
key="0"
type="primary"
onClick={this.handleOk}
>
导出
</Button>
])
return (
<Modal
visible={visible}
title={"导出方式"}
title={title}
loading={confirmLoading}
onOk={this.handleOk}
onCancel={() => {
this.reset();
onCancel && onCancel();
}}
footer={[
<Button
key="0"
type="primary"
onClick={this.handleOk}
>
导出
</Button>
]}
footer={footer}
>
<>
<Radio.Group value={selectedKey} onChange={this.onModeClick}>
{
modes && modes.map((mode, index) => {
return (
<Radio key={mode.key||''} value={mode.key||''}>
{ mode.title||'' }
</Radio>
);
})
}
</Radio.Group>
{
selectedKey==='ddl' && <div className='d-flex mt-5' style={{ alignItems: 'center' }}>
<span className='mr-2' >数据库类型: </span>
<Select
value={selectDDLGeneratorName}
loading={loadingDDLGenerators}
style={{ width: 180 }}
placeholder='请选择数据库类型'
onChange={this.onDDLGeneratorChange}
>
{
ddlGenerators && ddlGenerators.map((ddlGenerator, index) => {
return <Option key={index} value={ddlGenerator.name||''}>{ddlGenerator.cnName||''}</Option>
})
}
</Select>
</div>
}
{
ddlExportSuccess ? <Input.TextArea value={ddlExportString||''} autoSize={{minRows:1,maxRows:20}} ></Input.TextArea> : <>
<Radio.Group value={selectedKey} onChange={this.onModeClick}>
{
modes && modes.map((mode, index) => {
return (
<Radio key={mode.key||''} value={mode.key||''}>
{ mode.title||'' }
</Radio>
);
})
}
</Radio.Group>
{
selectedKey==='ddl' && <div className='d-flex mt-5' style={{ alignItems: 'center' }}>
<span className='mr-2' >数据库类型: </span>
<Select
value={selectDDLGeneratorName}
loading={loadingDDLGenerators}
style={{ width: 180 }}
placeholder='请选择数据库类型'
onChange={this.onDDLGeneratorChange}
>
{
ddlGenerators && ddlGenerators.map((ddlGenerator, index) => {
return <Option key={index} value={ddlGenerator.name||''}>{ddlGenerator.cnName||''}</Option>
})
}
</Select>
</div>
}
</>
}
</>
</Modal>
)
......
......@@ -41,7 +41,7 @@ const DatatypeInput = ({ value = {}, datatypes, onChange }) => {
const newParameterValues = [...(value.parameterValues||[])];
//默认为0
newParameterValues[index] = parameterValue||0;
newParameterValues[index] = parameterValue;
triggerChange({ parameterValues: newParameterValues });
}
}
......@@ -88,7 +88,7 @@ const DatatypeInput = ({ value = {}, datatypes, onChange }) => {
onChange={(e) => {
onParameterValuesChange(e, index);
}}
value={value.parameterValues[index] || 0 }
value={value.parameterValues[index] || ''}
style={{ width: '100%' }}
placeholder='请输入一个整数'
/>
......
import React from 'react';
import { Row, Col, Button, Typography } from 'antd';
import { Row, Col, Button } from 'antd';
import ModelTree from './Component/ModelTree';
import ModelTable from './Component/ModelTable';
import ImportModal from './Component/ImportModal';
import ExportModal from './Component/ExportModal';
import { showMessage, showNotifaction } from '../../../util';
import { showMessage } from '../../../util';
import { dispatch } from '../../../model';
class Model extends React.Component {
......@@ -85,32 +85,32 @@ class Model extends React.Component {
refresh && this.onTableChange();
}
onExportModalCancel = (ddlStrings = []) => {
onExportModalCancel = () => {
this.setState({ exportModalVisible: false });
if (ddlStrings.length>0) {
// if (ddlStrings.length>0) {
const tip = (
<>
{
ddlStrings && ddlStrings.map((ddlString, index) => {
return (
<Typography.Paragraph
key={index}
copyable={{
tooltips: ['复制', '复制成功'],
}}
>
{ ddlString||'' }
</Typography.Paragraph>
)
})
}
</>
);
showNotifaction('ddl', tip);
}
// const tip = (
// <>
// {
// ddlStrings && ddlStrings.map((ddlString, index) => {
// return (
// <Typography.Paragraph
// key={index}
// copyable={{
// tooltips: ['复制', '复制成功'],
// }}
// >
// { ddlString||'' }
// </Typography.Paragraph>
// )
// })
// }
// </>
// );
// showNotifaction('ddl', tip);
// }
}
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