Commit f80d32d1 by zhaochengxiang

修改模型问题

parent 1d74834f
...@@ -22,35 +22,42 @@ const ImportAction = (props) => { ...@@ -22,35 +22,42 @@ const ImportAction = (props) => {
useEffect(() =>{ useEffect(() =>{
if (mountRef.current) { if (action==='add' && (hints||[]).length === 0) return;
mountRef.current = false;
//初始化form状态
if (action === 'detail') { if (action==='add'||action==='edit') {
getCurrentDataModel(); form.setFieldsValue({
} else { cnName: '',
dispatchLatest({ name: '',
type: 'datamodel.getAllConstraints', remark: '',
callback: data => { });
setConstraints(data||[]); }
if (action === 'add') {
setConstraint((data||[]).length>0?data[0]:{}); if (action === 'detail') {
getDraft((data||[]).length>0?data[0]:{}, hints); getCurrentDataModel();
} else if(action === 'edit') { } else {
getCurrentDataModel(); dispatchLatest({
} type: 'datamodel.getAllConstraints',
callback: data => {
setConstraints(data||[]);
if (action === 'add') {
setConstraint((data||[]).length>0?data[0]:{});
getDraft((data||[]).length>0?data[0]:{}, hints);
} else if(action === 'edit') {
getCurrentDataModel();
} }
}) }
} })
} }
//eslint-disable-next-line react-hooks/exhaustive-deps //eslint-disable-next-line react-hooks/exhaustive-deps
}, []); }, [action, hints, modelerId ]);
const getDraft = (_constraint, _hints) => { const getDraft = (_constraint, _hints) => {
dispatchLatest({ dispatchLatest({
type: 'datamodel.getDraft', type: 'datamodel.getDraft',
payload: { payload: {
data: { data: {
hints, hints: _hints,
modelerModelingConstraint: _constraint modelerModelingConstraint: _constraint
} }
}, },
......
...@@ -150,9 +150,6 @@ const ImportModal = (props) => { ...@@ -150,9 +150,6 @@ const ImportModal = (props) => {
setHints([]); setHints([]);
setModelerData({}); setModelerData({});
setConfirmLoading(false); setConfirmLoading(false);
if (form && form.resetFields) {
form.resetFields();
}
} }
const onActionChange = (data) => { const onActionChange = (data) => {
...@@ -256,7 +253,7 @@ const ImportModal = (props) => { ...@@ -256,7 +253,7 @@ const ImportModal = (props) => {
<> <>
{ {
step===0 && <> step===0 && <>
<Radio.Group onChange={onRadioChange}> <Radio.Group value={radioValue} onChange={onRadioChange}>
{ {
modes && modes.map((mode, index) => { modes && modes.map((mode, index) => {
return ( return (
......
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