Commit c8970a94 by zhaochengxiang

模型导出ddl增加模型名称选择

parent 30d5d2f3
......@@ -35,8 +35,10 @@ class ExportModal extends React.Component {
loadingDDLGenerators: false,
ddlGenerators: [],
selectDDLGeneratorName: null,
selectModalerNameKey: 0,
confirmLoading: false,
ddlExportSuccess: false,
ddlExportStrings: [],
ddlExportString: '',
}
}
......@@ -111,7 +113,7 @@ class ExportModal extends React.Component {
},
callback: data => {
this.setState({ confirmLoading: false }, () => {
this.setState({ ddlExportSuccess: true, ddlExportString: data.join('\n') });
this.setState({ ddlExportSuccess: true, ddlExportStrings: data||[], selectModalerNameKey: 0, ddlExportString: data[0]||'' });
});
},
error: () => {
......@@ -145,7 +147,12 @@ class ExportModal extends React.Component {
}
reset = () => {
this.setState({ selectedKey: '', selectDDLGeneratorName: '', ddlExportSuccess: false, ddlExportString: '' });
this.setState({ selectedKey: '', selectDDLGeneratorName: '', ddlExportSuccess: false, ddlExportStrings: [] });
}
onModalerNameChange = (value) => {
const { ddlExportStrings } = this.state;
this.setState({ selectModalerNameKey: value, ddlExportString: ddlExportStrings[value]||'' });
}
onDDLGeneratorChange = (value) => {
......@@ -153,8 +160,8 @@ class ExportModal extends React.Component {
}
render() {
const { visible, onCancel } = this.props;
const { selectedKey, ddlGenerators, loadingDDLGenerators, confirmLoading, selectDDLGeneratorName, ddlExportSuccess, ddlExportString } = this.state;
const { visible, onCancel, names } = this.props;
const { selectedKey, ddlGenerators, loadingDDLGenerators, confirmLoading, selectDDLGeneratorName, ddlExportSuccess, ddlExportString, selectModalerNameKey } = this.state;
const title = ddlExportSuccess ? 'DDL导出详情' : '导出方式';
......@@ -203,7 +210,24 @@ class ExportModal extends React.Component {
>
<>
{
ddlExportSuccess ? <Input.TextArea value={ddlExportString||''} autoSize={{minRows:1,maxRows:20}} ></Input.TextArea> : <>
ddlExportSuccess ? <>
<div className='d-flex mb-5' style={{ alignItems: 'center' }}>
<span className='mr-2'>模型名称:</span>
<Select
value={selectModalerNameKey}
style={{ width: 180 }}
placeholder='请选择模型名称'
onChange={this.onModalerNameChange}
>
{
names && names.map((name, index) => {
return <Option key={index} value={index}>{name||''}</Option>
})
}
</Select>
</div>
<Input.TextArea value={ddlExportString||''} autoSize={{minRows:4,maxRows:20}} ></Input.TextArea>
</> : <>
<Radio.Group value={selectedKey} onChange={this.onModeClick}>
{
modes && modes.map((mode, index) => {
......
......@@ -21,6 +21,7 @@ class Model extends React.Component {
filterTableData: [],
loadingTableData: false,
selectModelerIds: [],
selectModelerNames: [],
keyword: '',
}
}
......@@ -90,13 +91,21 @@ class Model extends React.Component {
}
onExportBtnClick = () => {
const { selectModelerIds } = this.state;
const { selectModelerIds, tableData } = this.state;
if ((selectModelerIds||[]).length === 0) {
showMessage('info', '请先选择模型');
return;
}
this.setState({ exportModalVisible: true });
//模型名称在导出ddl的时候有使用
const _selectModelerNames = [];
(tableData||[]).forEach(item => {
if ((selectModelerIds||[]).indexOf(item.id) !== -1) {
_selectModelerNames.push(item.name||'');
}
});
this.setState({ exportModalVisible: true, selectModelerNames: _selectModelerNames });
}
onImportModalCancel = (refresh = false) => {
......@@ -113,7 +122,7 @@ class Model extends React.Component {
}
render() {
const { importModalVisible, exportModalVisible, catalogId, importModalAction, loadingTableData, modelerId, selectModelerIds, keyword, filterTableData } = this.state;
const { importModalVisible, exportModalVisible, catalogId, importModalAction, loadingTableData, modelerId, selectModelerIds, keyword, filterTableData, selectModelerNames } = this.state;
return (
<div style={{ backgroundColor: '#ECEEF3' }}>
......@@ -165,6 +174,7 @@ class Model extends React.Component {
<ExportModal
visible={exportModalVisible}
ids={selectModelerIds}
names={selectModelerNames}
onCancel={this.onExportModalCancel}
/>
</div>
......
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