Commit 8806ab8a by zhaochengxiang

模型保存问题

parent 0c4632df
...@@ -20,6 +20,7 @@ const EditModel = (props) => { ...@@ -20,6 +20,7 @@ const EditModel = (props) => {
const [ confirmLoading, setConfirmLoading ] = useState(false); const [ confirmLoading, setConfirmLoading ] = useState(false);
const [ catalogModalVisible, setCatalogModalVisible ] = useState(false); const [ catalogModalVisible, setCatalogModalVisible ] = useState(false);
const [ historyAndVersionDrawerVisible, setHistoryAndVersionDrawerVisible ] = useState(false); const [ historyAndVersionDrawerVisible, setHistoryAndVersionDrawerVisible ] = useState(false);
const [ autoTabKey, setAutoTabKey ] = useState(null);
const { action, catalogId, modelerId, hints, roughModelerData, permitCheckOut, editable, stateId, versionId } = actionData; const { action, catalogId, modelerId, hints, roughModelerData, permitCheckOut, editable, stateId, versionId } = actionData;
...@@ -66,6 +67,9 @@ const EditModel = (props) => { ...@@ -66,6 +67,9 @@ const EditModel = (props) => {
} }
const save = async (e, cid = '') => { const save = async (e, cid = '') => {
setAutoTabKey(null);
try { try {
const row = await form.validateFields(); const row = await form.validateFields();
...@@ -124,6 +128,7 @@ const EditModel = (props) => { ...@@ -124,6 +128,7 @@ const EditModel = (props) => {
} catch (errInfo) { } catch (errInfo) {
console.log('Validate Failed:', errInfo); console.log('Validate Failed:', errInfo);
setAutoTabKey('1');
} }
} }
...@@ -229,7 +234,7 @@ const EditModel = (props) => { ...@@ -229,7 +234,7 @@ const EditModel = (props) => {
</div> </div>
<div className='edit-container'> <div className='edit-container'>
<div className='edit-container-card'> <div className='edit-container-card'>
<ImportAction hints={hints} onChange={onActionChange} action={action} modelerId={modelerId} form={form} terms={terms} roughModelerData={roughModelerData} permitCheckOut={permitCheckOut} stateId={stateId} versionId={versionId} /> <ImportAction hints={hints} onChange={onActionChange} action={action} modelerId={modelerId} form={form} terms={terms} roughModelerData={roughModelerData} permitCheckOut={permitCheckOut} stateId={stateId} versionId={versionId} autoTabKey={autoTabKey} />
</div> </div>
</div> </div>
<div className='edit-footer'> <div className='edit-footer'>
......
...@@ -13,7 +13,7 @@ import { dispatch } from '../../../../model'; ...@@ -13,7 +13,7 @@ import { dispatch } from '../../../../model';
const { TabPane } = Tabs; const { TabPane } = Tabs;
const ImportAction = (props) => { const ImportAction = (props) => {
const { action, hints, onChange, form, modelerId, terms, ddl, roughModelerData, stateId, versionId, permitCheckOut } = props; const { action, hints, onChange, form, modelerId, terms, ddl, roughModelerData, stateId, versionId, permitCheckOut, autoTabKey } = props;
const [ constraints, setConstraints ] = useState([]); const [ constraints, setConstraints ] = useState([]);
const [ constraint, setConstraint ] = useState({}); const [ constraint, setConstraint ] = useState({});
...@@ -68,6 +68,12 @@ const ImportAction = (props) => { ...@@ -68,6 +68,12 @@ const ImportAction = (props) => {
//eslint-disable-next-line react-hooks/exhaustive-deps //eslint-disable-next-line react-hooks/exhaustive-deps
}, [action, hints, modelerId, ddl ]); }, [action, hints, modelerId, ddl ]);
useEffect(() => {
if (autoTabKey) {
setTabKey(autoTabKey);
}
}, [autoTabKey])
const getDraft = (_constraint, _template, _hints) => { const getDraft = (_constraint, _template, _hints) => {
dispatch({ dispatch({
type: 'datamodel.getDraft', type: 'datamodel.getDraft',
......
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