Commit a07a7037 by zhaochengxiang

新增编辑模型打开一个新页面

parent 24837872
...@@ -8,14 +8,14 @@ import { Action, CatalogId, ModelerId, Hints } from '../../../../util/constant'; ...@@ -8,14 +8,14 @@ import { Action, CatalogId, ModelerId, Hints } from '../../../../util/constant';
const EditModel = (props) => { const EditModel = (props) => {
const [ action, setAction ] = useState(''); const [ actionData, setActionData ] = useState({ action: '', catalogId: '', modelerId: '', hints: [] });
const [ catalogId, setCatalogId ] = useState('');
const [ modelerId, setModelerId ] = useState('');
const [ hints, setHints ] = useState([]);
const [ modelerData, setModelerData ] = useState({}); const [ modelerData, setModelerData ] = useState({});
const [ terms, setTerms ] = useState([]); const [ terms, setTerms ] = useState([]);
const [ confirmLoading, setConfirmLoading ] = useState(false); const [ confirmLoading, setConfirmLoading ] = useState(false);
const { action, catalogId, modelerId, hints } = actionData;
const [form] = Form.useForm(); const [form] = Form.useForm();
useEffect(() => { useEffect(() => {
...@@ -29,10 +29,7 @@ const EditModel = (props) => { ...@@ -29,10 +29,7 @@ const EditModel = (props) => {
_hints = _hintsStr.split(','); _hints = _hintsStr.split(',');
} }
setAction(_action); setActionData({ action: _action, catalogId: _catalogId, modelerId: _modelerId, hints: _hints });
setCatalogId(_catalogId);
setModelerId(_modelerId);
setHints(_hints);
//eslint-disable-next-line react-hooks/exhaustive-deps //eslint-disable-next-line react-hooks/exhaustive-deps
}, []) }, [])
...@@ -58,12 +55,12 @@ const EditModel = (props) => { ...@@ -58,12 +55,12 @@ const EditModel = (props) => {
easyDataModelerDataModelIds: data.id||'' easyDataModelerDataModelIds: data.id||''
} }
}, },
callback: (data) => { callback: () => {
setConfirmLoading(false); setConfirmLoading(false);
showMessage("success", (action==='add')?'新增模型成功':'保存模型成功') showMessage("success", (action==='add')?'新增模型成功':'保存模型成功')
setModelerId(data.id||''); setActionData({ ...actionData, ...{ action: 'detail', modelerId: data.id||'' } });
setAction('detail');
}, },
error: () => { error: () => {
setConfirmLoading(false); setConfirmLoading(false);
...@@ -83,7 +80,7 @@ const EditModel = (props) => { ...@@ -83,7 +80,7 @@ const EditModel = (props) => {
} }
const edit = () => { const edit = () => {
setAction('edit'); setActionData({ ...actionData, action: 'edit' });
} }
const onActionChange = (data) => { const onActionChange = (data) => {
......
...@@ -21,7 +21,7 @@ const ImportAction = (props) => { ...@@ -21,7 +21,7 @@ const ImportAction = (props) => {
useEffect(() =>{ useEffect(() =>{
if (!action || (action==='add'&&(hints||[]).length===0&&(ddl||'').length===0)) return; if ((action||'')==='' || (action==='add'&&(hints||[]).length===0&&(ddl||'').length===0)) return;
//初始化form状态 //初始化form状态
if (action==='add'||action==='edit') { if (action==='add'||action==='edit') {
......
...@@ -478,25 +478,18 @@ const ImportActionTable = (props) => { ...@@ -478,25 +478,18 @@ const ImportActionTable = (props) => {
dataIndex: 'datatype', dataIndex: 'datatype',
editable: true, editable: true,
ellipsis: true, ellipsis: true,
render: (datatype, record, index) => { render: (datatype, _, __) => {
if (datatype) { if (datatype) {
return ( let _text = `名称: ${datatype.name||''}`;
<>
<span>{`名称: ${datatype.name||''}`}</span> (datatype.parameterCnNames||[]).forEach((cnName, index) => {
{
(datatype.parameterCnNames||[]).map((cnName, index) => { _text += ` ${cnName}: ` + `${(datatype.parameterValues[index]?datatype.parameterValues[index]:0)}`;
return (
<div key={index}>
<span>{`${cnName}: `}</span>
<span style={{ fontWeight: 'bold' }} >{`${(datatype.parameterValues[index]?datatype.parameterValues[index]:0)}`}</span>
</div>
)
}) })
}
</> return _text;
)
} }
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