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