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
28411606
Commit
28411606
authored
Apr 13, 2021
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改规则 模版问题
parent
91e55e5c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
29 deletions
+33
-29
ImportAction.jsx
src/view/Manage/Model/Component/ImportAction.jsx
+21
-28
ImportActionTable.jsx
src/view/Manage/Model/Component/ImportActionTable.jsx
+12
-1
No files found.
src/view/Manage/Model/Component/ImportAction.jsx
View file @
28411606
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Alert
,
Select
}
from
'antd'
;
import
{
Alert
,
Select
}
from
'antd'
;
import
ImportActionHeader
from
'./ImportActionHeader'
;
import
ImportActionHeader
from
'./ImportActionHeader'
;
...
@@ -20,9 +20,6 @@ const ImportAction = (props) => {
...
@@ -20,9 +20,6 @@ const ImportAction = (props) => {
const
[
supportedDatatypes
,
setSupportedDatatypes
]
=
useState
([]);
const
[
supportedDatatypes
,
setSupportedDatatypes
]
=
useState
([]);
const
[
validateReports
,
setValidateReports
]
=
useState
([]);
const
[
validateReports
,
setValidateReports
]
=
useState
([]);
const
mountRef
=
useRef
();
mountRef
.
current
=
true
;
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
action
===
'add'
&&
(
hints
||
[]).
length
===
0
)
return
;
if
(
action
===
'add'
&&
(
hints
||
[]).
length
===
0
)
return
;
...
@@ -36,24 +33,20 @@ const ImportAction = (props) => {
...
@@ -36,24 +33,20 @@ const ImportAction = (props) => {
});
});
}
}
if
(
action
===
'detail'
)
{
dispatch
({
getCurrentDataModel
();
type
:
'datamodel.getAllConstraintsAndTemplates'
,
}
else
{
callback
:
data
=>
{
dispatch
({
setConstraints
(
data
.
constraints
||
[]);
type
:
'datamodel.getAllConstraintsAndTemplates'
,
setTemplates
(
data
.
templates
||
[]);
callback
:
data
=>
{
if
(
action
===
'add'
)
{
setConstraints
(
data
.
constraints
||
[]);
setConstraint
((
data
.
constraints
||
[]).
length
>
0
?
data
.
constraints
[
0
]:{});
setTemplates
(
data
.
templates
||
[]);
setTemplate
((
data
.
templates
||
[]).
length
>
0
?
data
.
templates
[
0
]:{});
if
(
action
===
'add'
)
{
getDraft
((
data
.
constraints
||
[]).
length
>
0
?
data
.
constraints
[
0
]:{},
(
data
.
templates
||
[]).
length
>
0
?
data
.
templates
[
0
]:{}
,
hints
);
setConstraint
((
data
.
constraints
||
[]).
length
>
0
?
data
.
constraints
[
0
]:{});
}
else
if
(
action
===
'edit'
||
action
===
'detail'
)
{
setTemplate
((
data
.
templates
||
[]).
length
>
0
?
data
.
templates
[
0
]:{});
getCurrentDataModel
();
getDraft
((
data
.
constraints
||
[]).
length
>
0
?
data
.
constraints
[
0
]:{},
(
data
.
templates
||
[]).
length
>
0
?
data
.
templates
[
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
]);
},
[
action
,
hints
,
modelerId
]);
...
@@ -109,7 +102,7 @@ const ImportAction = (props) => {
...
@@ -109,7 +102,7 @@ const ImportAction = (props) => {
let
currentConstraint
=
null
,
_hints
=
[];
let
currentConstraint
=
null
,
_hints
=
[];
(
constraints
||
[]).
forEach
((
_constraint
,
index
)
=>
{
(
constraints
||
[]).
forEach
((
_constraint
,
index
)
=>
{
if
(
_constraint
.
id
===
value
)
{
if
(
_constraint
.
name
===
value
)
{
currentConstraint
=
_constraint
;
currentConstraint
=
_constraint
;
}
}
});
});
...
@@ -132,7 +125,7 @@ const ImportAction = (props) => {
...
@@ -132,7 +125,7 @@ const ImportAction = (props) => {
let
currentTemplate
=
null
,
_hints
=
[];
let
currentTemplate
=
null
,
_hints
=
[];
(
templates
||
[]).
forEach
((
_template
,
index
)
=>
{
(
templates
||
[]).
forEach
((
_template
,
index
)
=>
{
if
(
_template
.
id
===
value
)
{
if
(
_template
.
name
===
value
)
{
currentTemplate
=
_template
;
currentTemplate
=
_template
;
}
}
});
});
...
@@ -188,8 +181,8 @@ const ImportAction = (props) => {
...
@@ -188,8 +181,8 @@ const ImportAction = (props) => {
return
(
return
(
<>
<>
{
{
action
!==
'detail'
&&
<
div
className=
'd-flex mb-3'
>
<
div
className=
'd-flex mb-3'
>
<
Select
value=
{
constraint
.
name
?
constraint
.
name
:
null
}
placeholder=
'请选择规则'
style=
{
{
marginLeft
:
'auto'
,
minWidth
:
100
}
}
onChange=
{
onConstraintChange
}
>
<
Select
value=
{
constraint
.
name
?
constraint
.
name
:
null
}
placeholder=
'请选择规则'
style=
{
{
marginLeft
:
'auto'
,
minWidth
:
100
}
}
onChange=
{
onConstraintChange
}
disabled=
{
action
===
'detail'
}
>
{
{
(
constraints
||
[]).
map
((
constraint
,
index
)
=>
{
(
constraints
||
[]).
map
((
constraint
,
index
)
=>
{
return
(
return
(
...
@@ -198,7 +191,7 @@ const ImportAction = (props) => {
...
@@ -198,7 +191,7 @@ const ImportAction = (props) => {
})
})
}
}
</
Select
>
</
Select
>
<
Select
className=
'ml-3'
value=
{
template
.
name
?
template
.
name
:
null
}
placeholder=
'请选择模版'
style=
{
{
minWidth
:
100
}
}
onChange=
{
onTemplateChange
}
>
<
Select
className=
'ml-3'
value=
{
template
.
name
?
template
.
name
:
null
}
placeholder=
'请选择模版'
style=
{
{
minWidth
:
100
}
}
onChange=
{
onTemplateChange
}
disabled=
{
action
===
'detail'
}
>
{
{
(
templates
||
[]).
map
((
template
,
index
)
=>
{
(
templates
||
[]).
map
((
template
,
index
)
=>
{
return
(
return
(
...
@@ -214,14 +207,14 @@ const ImportAction = (props) => {
...
@@ -214,14 +207,14 @@ const ImportAction = (props) => {
editable=
{
action
!==
'detail'
}
editable=
{
action
!==
'detail'
}
modelerData=
{
modelerData
||
{}
}
modelerData=
{
modelerData
||
{}
}
/>
/>
{
{
/* {
action!=='detail' && <Alert
action!=='detail' && <Alert
message="表格可以通过拖拽来排序"
message="表格可以通过拖拽来排序"
type="info"
type="info"
closable
closable
className='mb-3'
className='mb-3'
/>
/>
}
}
*/
}
<
ImportActionTable
<
ImportActionTable
modelerData=
{
modelerData
||
{}
}
modelerData=
{
modelerData
||
{}
}
constraint=
{
constraint
}
constraint=
{
constraint
}
...
...
src/view/Manage/Model/Component/ImportActionTable.jsx
View file @
28411606
import
React
,
{
useState
,
useCallback
,
useRef
,
useEffect
}
from
'react'
;
import
React
,
{
useState
,
useCallback
,
useRef
,
useEffect
}
from
'react'
;
import
{
Table
,
Input
,
Form
,
Typography
,
Radio
,
Divider
,
Button
,
Popconfirm
,
Select
,
Row
,
Col
,
Popover
}
from
'antd'
;
import
{
Table
,
Input
,
Form
,
Typography
,
Radio
,
Divider
,
Button
,
Popconfirm
,
Select
,
Row
,
Col
,
Popover
}
from
'antd'
;
import
{
QuestionCircleOutlined
}
from
'@ant-design/icons'
;
import
{
DndProvider
,
useDrag
,
useDrop
}
from
'react-dnd'
;
import
{
DndProvider
,
useDrag
,
useDrop
}
from
'react-dnd'
;
import
{
HTML5Backend
}
from
'react-dnd-html5-backend'
;
import
{
HTML5Backend
}
from
'react-dnd-html5-backend'
;
import
update
from
'immutability-helper'
;
import
update
from
'immutability-helper'
;
...
@@ -520,7 +521,17 @@ const ImportActionTable = (props) => {
...
@@ -520,7 +521,17 @@ const ImportActionTable = (props) => {
return
(
return
(
<
div
className=
'model-import-action-table'
>
<
div
className=
'model-import-action-table'
>
<
Divider
>
数据表结构
</
Divider
>
<
Divider
>
<>
<
span
>
数据表结构
</
span
>
{
editable
&&
(
<
Popover
content=
'表格可以通过拖拽来排序'
>
<
QuestionCircleOutlined
className=
'ml-1 pointer'
/>
</
Popover
>
)
}
</>
</
Divider
>
{
{
editable
&&
<
div
className=
'd-flex mb-3'
>
editable
&&
<
div
className=
'd-flex mb-3'
>
<
Button
type=
"primary"
onClick=
{
onAddClick
}
style=
{
{
marginLeft
:
'auto'
}
}
disabled=
{
editingKey
!==
''
}
>
新增行
</
Button
>
<
Button
type=
"primary"
onClick=
{
onAddClick
}
style=
{
{
marginLeft
:
'auto'
}
}
disabled=
{
editingKey
!==
''
}
>
新增行
</
Button
>
...
...
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