Commit a07a7037 by zhaochengxiang

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

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