Commit 499e49d3 by zhaochengxiang

修改模型bug

parent e9ae7962
...@@ -358,7 +358,7 @@ const EditModel = (props) => { ...@@ -358,7 +358,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} ddl={ddl} form={form} terms={terms} roughModelerData={roughModelerData} permitCheckOut={permitCheckOut} stateId={stateId} versionId={versionId} autoTabKey={autoTabKey} {...props} /> <ImportAction hints={hints} onChange={onActionChange} action={action} modelerId={modelerId} catalogId={catalogId} ddl={ddl} form={form} terms={terms} roughModelerData={roughModelerData} permitCheckOut={permitCheckOut} stateId={stateId} versionId={versionId} autoTabKey={autoTabKey} {...props} />
</div> </div>
</div> </div>
<div className='edit-footer'> <div className='edit-footer'>
......
...@@ -11,7 +11,7 @@ import { Action } from '../../../../util/constant'; ...@@ -11,7 +11,7 @@ import { Action } from '../../../../util/constant';
import { dispatch } from '../../../../model'; import { dispatch } from '../../../../model';
const ImportAction = (props) => { const ImportAction = (props) => {
const { action, hints, onChange, form, modelerId, terms, ddl, roughModelerData, versionId, permitCheckOut } = props; const { action, hints, onChange, form, modelerId, terms, ddl, roughModelerData, versionId, permitCheckOut, catalogId } = props;
const [ constraints, setConstraints ] = useState([]); const [ constraints, setConstraints ] = useState([]);
const [ constraint, setConstraint ] = useState({}); const [ constraint, setConstraint ] = useState({});
...@@ -96,7 +96,8 @@ const ImportAction = (props) => { ...@@ -96,7 +96,8 @@ const ImportAction = (props) => {
data: { data: {
hints: _hints, hints: _hints,
modelerModelingConstraint: _constraint, modelerModelingConstraint: _constraint,
easyDataModelerModelingTemplate: _template easyDataModelerModelingTemplate: _template,
dataCatalogId: catalogId,
} }
}, },
callback: data => { callback: data => {
...@@ -265,16 +266,17 @@ const ImportAction = (props) => { ...@@ -265,16 +266,17 @@ const ImportAction = (props) => {
let currentTemplate = null; let currentTemplate = null;
(templates||[]).forEach((_template, index) => { (templates||[]).forEach((_template, index) => {
if (_template.name === value) { if (_template.cnName === value) {
currentTemplate = _template; currentTemplate = _template;
} }
}); });
form.setFieldsValue({ form.setFieldsValue({
easyDataModelerModelingTemplate: currentTemplate||{} easyDataModelerModelingTemplate: currentTemplate||{},
tableType: value
}); });
const newModelerData = {...modelerData, easyDataModelerModelingTemplate: currentTemplate }; const newModelerData = {...modelerData, easyDataModelerModelingTemplate: currentTemplate, tableType: currentTemplate ? currentTemplate.cnName : value };
setModelerData(newModelerData); setModelerData(newModelerData);
modelerDataRef.current = newModelerData; modelerDataRef.current = newModelerData;
...@@ -282,7 +284,9 @@ const ImportAction = (props) => { ...@@ -282,7 +284,9 @@ const ImportAction = (props) => {
onChange && onChange(newModelerData); onChange && onChange(newModelerData);
setTemplate(currentTemplate); setTemplate(currentTemplate);
getConsult(newModelerData); if (currentTemplate) {
getConsult(newModelerData);
}
} }
const getSupportedDatatypes = () => { const getSupportedDatatypes = () => {
......
...@@ -19,6 +19,7 @@ import { AttentionSvg, UnAttentionSvg } from './ModelSvg'; ...@@ -19,6 +19,7 @@ import { AttentionSvg, UnAttentionSvg } from './ModelSvg';
import { EditModelContext } from './ContextManage'; import { EditModelContext } from './ContextManage';
import './ImportActionTable.less'; import './ImportActionTable.less';
import 'react-contexify/dist/ReactContexify.css';
const { Option } = Select; const { Option } = Select;
...@@ -365,7 +366,7 @@ export const ImportActionTable = (props) => { ...@@ -365,7 +366,7 @@ export const ImportActionTable = (props) => {
title: 'Not Null', title: 'Not Null',
width: 80, width: 80,
dataIndex: 'notNull', dataIndex: 'notNull',
editable: (type==='model'?true:false), editable: true,
render: (notNull, record, index) => { render: (notNull, record, index) => {
if (!notNull) { if (!notNull) {
return '-'; return '-';
...@@ -1115,7 +1116,11 @@ export const ImportActionTable = (props) => { ...@@ -1115,7 +1116,11 @@ export const ImportActionTable = (props) => {
col.dataIndex==='foreignKey' col.dataIndex==='foreignKey'
) { ) {
inputType = 'check'; inputType = 'check';
} else if (col.dataIndex === 'remark') { } else if (
col.dataIndex === 'remark' ||
col.dataIndex === 'definition' ||
col.dataIndex === 'valueRange'
) {
inputType = 'textarea'; inputType = 'textarea';
} else if (col.dataIndex === 'datatype') { } else if (col.dataIndex === 'datatype') {
inputType = 'datatype'; inputType = 'datatype';
......
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