Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
szse
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhaochengxiang
szse
Commits
499e49d3
Commit
499e49d3
authored
Apr 11, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改模型bug
parent
e9ae7962
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
22 deletions
+65
-22
EditModel.jsx
src/view/Manage/Model/Component/EditModel.jsx
+1
-1
ImportAction.jsx
src/view/Manage/Model/Component/ImportAction.jsx
+9
-5
ImportActionHeader.jsx
src/view/Manage/Model/Component/ImportActionHeader.jsx
+48
-14
ImportActionTable.jsx
src/view/Manage/Model/Component/ImportActionTable.jsx
+7
-2
No files found.
src/view/Manage/Model/Component/EditModel.jsx
View file @
499e49d3
...
...
@@ -358,7 +358,7 @@ const EditModel = (props) => {
</
div
>
<
div
className=
'edit-container'
>
<
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
className=
'edit-footer'
>
...
...
src/view/Manage/Model/Component/ImportAction.jsx
View file @
499e49d3
...
...
@@ -11,7 +11,7 @@ import { Action } from '../../../../util/constant';
import
{
dispatch
}
from
'../../../../model'
;
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
[
constraint
,
setConstraint
]
=
useState
({});
...
...
@@ -96,7 +96,8 @@ const ImportAction = (props) => {
data
:
{
hints
:
_hints
,
modelerModelingConstraint
:
_constraint
,
easyDataModelerModelingTemplate
:
_template
easyDataModelerModelingTemplate
:
_template
,
dataCatalogId
:
catalogId
,
}
},
callback
:
data
=>
{
...
...
@@ -265,16 +266,17 @@ const ImportAction = (props) => {
let
currentTemplate
=
null
;
(
templates
||
[]).
forEach
((
_template
,
index
)
=>
{
if
(
_template
.
n
ame
===
value
)
{
if
(
_template
.
cnN
ame
===
value
)
{
currentTemplate
=
_template
;
}
});
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
);
modelerDataRef
.
current
=
newModelerData
;
...
...
@@ -282,8 +284,10 @@ const ImportAction = (props) => {
onChange
&&
onChange
(
newModelerData
);
setTemplate
(
currentTemplate
);
if
(
currentTemplate
)
{
getConsult
(
newModelerData
);
}
}
const
getSupportedDatatypes
=
()
=>
{
dispatch
({
...
...
src/view/Manage/Model/Component/ImportActionHeader.jsx
View file @
499e49d3
import
React
,
{
useState
,
useEffect
,
useMemo
}
from
'react'
;
import
{
Form
,
Input
,
Row
,
Col
,
Descriptions
,
Select
,
AutoComplete
,
Button
,
Divider
,
Tooltip
}
from
'antd'
;
import
React
,
{
useState
,
useEffect
,
useMemo
,
useRef
}
from
'react'
;
import
{
Form
,
Input
,
Row
,
Col
,
Descriptions
,
Select
,
AutoComplete
,
Button
,
Divider
,
Tooltip
,
Checkbox
,
Space
}
from
'antd'
;
import
{
DownOutlined
,
UpOutlined
}
from
'@ant-design/icons'
;
import
{
highlightSearchContentByTerms
,
generateUUID
}
from
'../../../../util'
;
...
...
@@ -81,20 +81,45 @@ const ConstraintSelect = ({ value = {}, constraints = [], onChange, ...restProps
)
}
const
TemplateSelect
=
({
value
=
{},
templates
=
[],
onChange
,
...
restProps
})
=>
{
const
TemplateSelect
=
({
value
=
''
,
modelerData
=
undefined
,
templates
=
[],
onChange
,
...
restProps
})
=>
{
const
mountRef
=
useRef
(
true
);
const
[
isCustom
,
setIsCustom
]
=
useState
(
false
);
useEffect
(()
=>
{
if
(
mountRef
.
current
)
{
if
(
value
&&
!
modelerData
?.
easyDataModelerModelingTemplate
?.
name
)
{
setIsCustom
(
true
);
}
else
{
setIsCustom
(
false
);
}
}
mountRef
.
current
=
false
;
},
[
modelerData
])
return
(
<
Select
<
span
style=
{
{
display
:
'flex'
,
alignItems
:
'center'
,
justifyContent
:
'space-between'
}
}
>
{
isCustom
?
<
Input
placeholder=
'请输入数据表类型'
allowClear
defaultValue=
{
modelerData
?.
tableType
}
onChange=
{
(
e
)
=>
{
onChange
?.(
e
.
target
.
value
);
}
}
style=
{
{
flex
:
1
}
}
/>
:
<
Select
onChange=
{
onChange
}
value=
{
value
?.
nam
e
||
undefined
}
defaultValue=
{
valu
e
||
undefined
}
placeholder=
'请选择数据表类型'
allowClear
style=
{
{
flex
:
1
}
}
{
...
restProps
}
>
{
(
templates
||
[])
&&
templates
.
map
((
template
,
index
)
=>
{
return
(
<
Option
key=
{
index
}
value=
{
template
.
n
ame
||
''
}
>
<
Option
key=
{
index
}
value=
{
template
.
cnN
ame
||
''
}
>
<
Tooltip
title=
{
template
.
remark
}
>
{
template
.
cnName
}
</
Tooltip
>
...
...
@@ -103,6 +128,12 @@ const TemplateSelect = ({ value = {}, templates = [], onChange, ...restProps })
})
}
</
Select
>
}
<
Checkbox
className=
'ml-3'
checked=
{
isCustom
}
onChange=
{
(
e
)
=>
{
setIsCustom
(
e
.
target
.
checked
);
onChange
?.(
''
);
}
}
>
自定义
</
Checkbox
>
</
span
>
)
}
...
...
@@ -125,8 +156,6 @@ const AttributesSelect = ({ value = [], modelerData, onChange, mode = 'multiple'
})
}
console
.
log
(
'currentAttributes'
,
currentAttributes
)
triggerChange
(
currentAttributes
);
}
...
...
@@ -520,7 +549,6 @@ const ImportActionHeader = (props) => {
}
const
onValuesChange
=
(
changedValues
,
allValues
)
=>
{
onChange
&&
onChange
(
changedValues
,
allValues
);
//有手动编辑过英文名称并且有内容的情况下, 不能通过编辑中文名称自动翻译
...
...
@@ -561,7 +589,7 @@ const ImportActionHeader = (props) => {
>
<
h2
className=
'mr-3'
style=
{
{
marginBottom
:
0
}
}
>
基本信息
</
h2
>
{
!
editable
&&
(
onlyShowRequireChange
?
<
Button
type=
'primary'
size=
'small'
onClick=
{
onOnlyShowRequireChange
}
>
展开
<
DownOutlined
/></
Button
>
:
<
Button
type=
'primary'
size=
'small'
onClick=
{
onOnlyShowRequireChange
}
>
收起
<
UpOutlined
/></
Button
>)
(
onlyShowRequireChange
?
<
Button
type=
'primary'
size=
'small'
onClick=
{
onOnlyShowRequireChange
}
>
展开
<
DownOutlined
/></
Button
>
:
<
Button
type=
'primary'
size=
'small'
onClick=
{
onOnlyShowRequireChange
}
>
收起
<
UpOutlined
/></
Button
>)
}
</
div
>
{
...
...
@@ -615,15 +643,20 @@ const ImportActionHeader = (props) => {
<
Col
xs=
{
24
}
sm=
{
24
}
lg=
{
12
}
xl=
{
8
}
>
<
Form
.
Item
label=
"数据表类型"
name=
"
easyDataModelerModelingTemplat
e"
rules=
{
[{
required
:
fals
e
,
message
:
'请选择数据表类型!'
}]
}
name=
"
tableTyp
e"
rules=
{
[{
required
:
tru
e
,
message
:
'请选择数据表类型!'
}]
}
>
<
TemplateSelect
modelerData=
{
modelerData
}
templates=
{
templates
}
onChange=
{
onTemplateChange
}
/>
</
Form
.
Item
>
</
Col
>
</
Row
>
{
!
onlyShowRequireChange
&&
<
React
.
Fragment
>
<
Divider
style=
{
{
margin
:
'0 0 15px'
}
}
/>
<
Row
gutter=
{
10
}
>
<
Col
xs=
{
24
}
sm=
{
24
}
lg=
{
12
}
xl=
{
8
}
>
<
Form
.
Item
...
...
@@ -728,7 +761,8 @@ const ImportActionHeader = (props) => {
</
Form
.
Item
>
</
Col
>
</
Row
>
</
Row
>
</
React
.
Fragment
>
}
</
Form
>
)
:
(
<
React
.
Fragment
>
...
...
@@ -752,7 +786,7 @@ const ImportActionHeader = (props) => {
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
{
<
div
style=
{
{
textAlign
:
'right'
,
width
:
85
}
}
>
规范
</
div
>
}
>
{
modelerData
.
easyDataModelerModelingConstraint
?(
modelerData
.
easyDataModelerModelingConstraint
.
cnName
||
''
):
''
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
{
<
div
style=
{
{
textAlign
:
'right'
,
width
:
85
}
}
>
数据内容
</
div
>
}
>
{
highlightSearchContentByTerms
(
modelerData
.
remark
||
''
,
terms
)
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
{
<
div
style=
{
{
textAlign
:
'right'
,
width
:
85
}
}
>
数据表类型
</
div
>
}
>
{
modelerData
.
easyDataModelerModelingTemplate
?(
modelerData
.
easyDataModelerModelingTemplate
.
cnName
||
''
):
''
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
{
<
div
style=
{
{
textAlign
:
'right'
,
width
:
85
}
}
>
数据表类型
</
div
>
}
>
{
modelerData
.
tableType
}
</
Descriptions
.
Item
>
</
Descriptions
>
{
!
onlyShowRequireChange
&&
<
Divider
style=
{
{
margin
:
'0 0 15px'
}
}
/>
...
...
src/view/Manage/Model/Component/ImportActionTable.jsx
View file @
499e49d3
...
...
@@ -19,6 +19,7 @@ import { AttentionSvg, UnAttentionSvg } from './ModelSvg';
import
{
EditModelContext
}
from
'./ContextManage'
;
import
'./ImportActionTable.less'
;
import
'react-contexify/dist/ReactContexify.css'
;
const
{
Option
}
=
Select
;
...
...
@@ -365,7 +366,7 @@ export const ImportActionTable = (props) => {
title: 'Not Null',
width: 80,
dataIndex: 'notNull',
editable:
(type==='model'?true:false)
,
editable:
true
,
render: (notNull, record, index) => {
if (!notNull) {
return '-';
...
...
@@ -1115,7 +1116,11 @@ export const ImportActionTable = (props) => {
col.dataIndex==='foreignKey'
) {
inputType = 'check';
} else if (col.dataIndex === 'remark') {
} else if (
col.dataIndex === 'remark' ||
col.dataIndex === 'definition' ||
col.dataIndex === 'valueRange'
) {
inputType = 'textarea';
} else if (col.dataIndex === 'datatype') {
inputType = 'datatype';
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment