Commit 848f7482 by zhaochengxiang

修改模型问题

parent 4ff996a4
...@@ -19,7 +19,7 @@ import ImportModal from './view/Manage/Model/Component/ImportModal'; ...@@ -19,7 +19,7 @@ import ImportModal from './view/Manage/Model/Component/ImportModal';
export default class App extends React.Component { export default class App extends React.Component {
render() { render() {
const { params, callback } = this.props; const { params } = this.props;
let message = '', id = ''; let message = '', id = '';
if (params) { if (params) {
......
import React from 'react'; import React from 'react';
import { Row, Col, Breadcrumb, Slider, Select, Typography } from 'antd'; import { Row, Col, Breadcrumb, Select, Typography } from 'antd';
import { HomeOutlined } from '@ant-design/icons'; import { HomeOutlined } from '@ant-design/icons';
import SquareItem from './Component/SquareItem'; import SquareItem from './Component/SquareItem';
......
...@@ -87,7 +87,7 @@ const ImportAction = (props) => { ...@@ -87,7 +87,7 @@ const ImportAction = (props) => {
setModelerData(newModelerData) setModelerData(newModelerData)
onChange && onChange(newModelerData); onChange && onChange(newModelerData);
validateDataModel(newModelerData); validateDataModel({ ...newModelerData, ...(form.getFieldsValue()) });
} }
}) })
} }
......
...@@ -11,6 +11,13 @@ class ImportExcel extends React.Component { ...@@ -11,6 +11,13 @@ class ImportExcel extends React.Component {
}; };
} }
componentDidUpdate(preProps, preState) {
const { visible } = this.props;
if (!visible && visible !== preProps.visible) {
this.setState({ fileList: [] });
}
}
downloadTemplate = () => { downloadTemplate = () => {
window.open("/data-govern/docs/DataModel.xlsx"); window.open("/data-govern/docs/DataModel.xlsx");
} }
......
...@@ -10,6 +10,13 @@ class ImportExcelCopy extends React.Component { ...@@ -10,6 +10,13 @@ class ImportExcelCopy extends React.Component {
}; };
} }
componentDidUpdate(preProps, preState) {
const { visible } = this.props;
if (!visible && visible !== preProps.visible) {
this.setState({ inputValue: '' });
}
}
onInputChange = (e) => { onInputChange = (e) => {
const { onChange } = this.props; const { onChange } = this.props;
this.setState({ inputValue: e.target.value }, () => { this.setState({ inputValue: e.target.value }, () => {
...@@ -22,7 +29,7 @@ class ImportExcelCopy extends React.Component { ...@@ -22,7 +29,7 @@ class ImportExcelCopy extends React.Component {
const { inputValue } = this.state; const { inputValue } = this.state;
const _placeholder = '支持两种方式创建\n方式一: excel内容复制粘贴(中文字段名)\n方式二: 手动输入中文字段,多个字段按行分割(每行一个)'; const _placeholder = '支持两种方式创建\n方式一: Excel内容复制粘贴(中文字段名)\n方式二: 手动输入中文字段,多个字段按行分割(每行一个)';
return ( return (
<Input.TextArea <Input.TextArea
......
...@@ -46,7 +46,6 @@ const ImportModal = (props) => { ...@@ -46,7 +46,6 @@ const ImportModal = (props) => {
type: 'datamodel.extractExcelContent', type: 'datamodel.extractExcelContent',
payload: { fileList: excelFiles }, payload: { fileList: excelFiles },
callback: data => { callback: data => {
setExcelFiles([]);
setConfirmLoading(false); setConfirmLoading(false);
setHints(data||[]); setHints(data||[]);
setStep(step+1); setStep(step+1);
...@@ -143,13 +142,13 @@ const ImportModal = (props) => { ...@@ -143,13 +142,13 @@ const ImportModal = (props) => {
let title = ''; let title = '';
if (action === 'add') { if (action === 'add') {
if (step===0 && addMode==='excel') { if (step===0 && addMode==='excel') {
title = 'excel导入'; title = 'Excel导入';
} else if (step===0 && addMode==='excel-copy') { } else if (step===0 && addMode==='excel-copy') {
title = 'excel复制粘贴导入'; title = 'Excel复制粘贴导入';
} else if (step===1 && addMode==='excel') { } else if (step===1 && addMode==='excel') {
title = '模型创建-excel导入'; title = '模型创建-Excel导入';
} else if (step===1 && addMode=== 'excel-copy') { } else if (step===1 && addMode=== 'excel-copy') {
title = '模型创建-excel复制粘贴导入'; title = '模型创建-Excel复制粘贴导入';
} }
} else if (action === 'edit') { } else if (action === 'edit') {
title = '模型编辑'; title = '模型编辑';
...@@ -234,10 +233,18 @@ const ImportModal = (props) => { ...@@ -234,10 +233,18 @@ const ImportModal = (props) => {
> >
<> <>
{ {
step===0 && addMode==='excel' && <ImportExcel onChange={onImportExcelChange} /> addMode==='excel' && (
<div style={{ display: step===0?'':'none' }}>
<ImportExcel onChange={onImportExcelChange} {...props} />
</div>
)
} }
{ {
step===0 && addMode==='excel-copy' && <ImportExcelCopy onChange={onImportExcelCopyChange} /> addMode==='excel-copy' && (
<div style={{ display: step===0?'':'none' }}>
<ImportExcelCopy onChange={onImportExcelCopyChange} {...props} />
</div>
)
} }
{ {
step===0 && addMode==='erwin' && <></> step===0 && addMode==='erwin' && <></>
......
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