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
21c03651
Commit
21c03651
authored
Apr 06, 2021
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
模型增加模版
parent
7ba19260
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
60 additions
and
29 deletions
+60
-29
datamodel.js
src/model/datamodel.js
+5
-2
datamodeler.js
src/service/datamodeler.js
+5
-0
ImportAction.jsx
src/view/Manage/Model/Component/ImportAction.jsx
+40
-7
ImportActionTable.jsx
src/view/Manage/Model/Component/ImportActionTable.jsx
+2
-20
ModelTable.jsx
src/view/Manage/Model/Component/ModelTable.jsx
+8
-0
No files found.
src/model/datamodel.js
View file @
21c03651
...
@@ -70,8 +70,11 @@ export function* extractExcelContent(payload) {
...
@@ -70,8 +70,11 @@ export function* extractExcelContent(payload) {
return
yield
call
(
datamodelerService
.
extractExcelContent
,
payload
);
return
yield
call
(
datamodelerService
.
extractExcelContent
,
payload
);
}
}
export
function
*
getAllConstraints
()
{
export
function
*
getAllConstraintsAndTemplates
()
{
return
yield
call
(
datamodelerService
.
constraints
);
const
constraints
=
yield
call
(
datamodelerService
.
constraints
);
const
templates
=
yield
call
(
datamodelerService
.
templates
);
return
{
constraints
,
templates
};
}
}
//获取初稿
//获取初稿
...
...
src/service/datamodeler.js
View file @
21c03651
...
@@ -31,6 +31,11 @@ export function constraints() {
...
@@ -31,6 +31,11 @@ export function constraints() {
return
GetJSON
(
"/datamodeler/easyDataModelerConstraint/constraints"
);
return
GetJSON
(
"/datamodeler/easyDataModelerConstraint/constraints"
);
}
}
//模版
export
function
templates
()
{
return
GetJSON
(
"/datamodeler/easyDataModelerConstraint/templates"
);
}
//创建初稿
//创建初稿
export
function
draft
(
payload
)
{
export
function
draft
(
payload
)
{
return
PostJSON
(
"/datamodeler/easyDataModelerDesign/draft"
,
payload
);
return
PostJSON
(
"/datamodeler/easyDataModelerDesign/draft"
,
payload
);
...
...
src/view/Manage/Model/Component/ImportAction.jsx
View file @
21c03651
...
@@ -14,6 +14,8 @@ const ImportAction = (props) => {
...
@@ -14,6 +14,8 @@ const ImportAction = (props) => {
const
[
constraints
,
setConstraints
]
=
useState
([]);
const
[
constraints
,
setConstraints
]
=
useState
([]);
const
[
constraint
,
setConstraint
]
=
useState
({});
const
[
constraint
,
setConstraint
]
=
useState
({});
const
[
templates
,
setTemplates
]
=
useState
([]);
const
[
template
,
setTemplate
]
=
useState
({});
const
[
modelerData
,
setModelerData
]
=
useState
(
null
);
const
[
modelerData
,
setModelerData
]
=
useState
(
null
);
const
[
supportedDatatypes
,
setSupportedDatatypes
]
=
useState
([]);
const
[
supportedDatatypes
,
setSupportedDatatypes
]
=
useState
([]);
...
@@ -37,12 +39,14 @@ const ImportAction = (props) => {
...
@@ -37,12 +39,14 @@ const ImportAction = (props) => {
getCurrentDataModel
();
getCurrentDataModel
();
}
else
{
}
else
{
dispatchLatest
({
dispatchLatest
({
type
:
'datamodel.getAllConstraints'
,
type
:
'datamodel.getAllConstraints
AndTemplates
'
,
callback
:
data
=>
{
callback
:
data
=>
{
setConstraints
(
data
||
[]);
setConstraints
(
data
.
constraints
||
[]);
setTemplates
(
data
.
templates
||
[]);
if
(
action
===
'add'
)
{
if
(
action
===
'add'
)
{
setConstraint
((
data
||
[]).
length
>
0
?
data
[
0
]:{});
setConstraint
((
data
.
constraints
||
[]).
length
>
0
?
data
.
constraints
[
0
]:{});
getDraft
((
data
||
[]).
length
>
0
?
data
[
0
]:{},
hints
);
setTemplate
((
data
.
templates
||
[]).
length
>
0
?
data
.
templates
[
0
]:{});
getDraft
((
data
.
constraints
||
[]).
length
>
0
?
data
.
constraints
[
0
]:{},
(
data
.
templates
||
[]).
length
>
0
?
data
.
templates
[
0
]:{}
,
hints
);
}
else
if
(
action
===
'edit'
)
{
}
else
if
(
action
===
'edit'
)
{
getCurrentDataModel
();
getCurrentDataModel
();
}
}
...
@@ -52,13 +56,14 @@ const ImportAction = (props) => {
...
@@ -52,13 +56,14 @@ const ImportAction = (props) => {
//eslint-disable-next-line react-hooks/exhaustive-deps
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
action
,
hints
,
modelerId
]);
},
[
action
,
hints
,
modelerId
]);
const
getDraft
=
(
_constraint
,
_hints
)
=>
{
const
getDraft
=
(
_constraint
,
_
template
,
_
hints
)
=>
{
dispatchLatest
({
dispatchLatest
({
type
:
'datamodel.getDraft'
,
type
:
'datamodel.getDraft'
,
payload
:
{
payload
:
{
data
:
{
data
:
{
hints
:
_hints
,
hints
:
_hints
,
modelerModelingConstraint
:
_constraint
modelerModelingConstraint
:
_constraint
,
easyDataModelerModelingTemplate
:
_template
}
}
},
},
callback
:
data
=>
{
callback
:
data
=>
{
...
@@ -112,7 +117,26 @@ const ImportAction = (props) => {
...
@@ -112,7 +117,26 @@ const ImportAction = (props) => {
});
});
setConstraint
(
currentConstraint
);
setConstraint
(
currentConstraint
);
getDraft
(
currentConstraint
,
_hints
);
getDraft
(
currentConstraint
,
template
,
_hints
);
}
const
onTemplateChange
=
(
value
)
=>
{
let
currentTemplate
=
null
,
_hints
=
[];
(
templates
||
[]).
forEach
((
_template
,
index
)
=>
{
if
(
_template
.
id
===
value
)
{
currentTemplate
=
_template
;
}
});
(
modelerData
.
easyDataModelerDataModelAttributes
||
[]).
forEach
((
_attribute
,
index
)
=>
{
if
(
_attribute
.
name
&&
_attribute
.
name
!==
''
)
{
_hints
.
push
(
_attribute
.
cnName
);
}
});
setTemplate
(
currentTemplate
);
getDraft
(
constraint
,
currentTemplate
,
_hints
);
}
}
const
getSupportedDatatypes
=
()
=>
{
const
getSupportedDatatypes
=
()
=>
{
...
@@ -145,6 +169,15 @@ const ImportAction = (props) => {
...
@@ -145,6 +169,15 @@ const ImportAction = (props) => {
})
})
}
}
</
Select
>
</
Select
>
<
Select
className=
'ml-3'
value=
{
template
.
id
?
template
.
id
:
null
}
placeholder=
'请选择模版'
style=
{
{
minWidth
:
100
}
}
onChange=
{
onTemplateChange
}
>
{
(
templates
||
[]).
map
((
template
,
index
)
=>
{
return
(
<
Option
key=
{
index
}
value=
{
template
.
id
}
>
{
template
.
cnName
||
''
}
</
Option
>
)
})
}
</
Select
>
</
div
>
</
div
>
}
}
<
ImportActionHeader
<
ImportActionHeader
...
...
src/view/Manage/Model/Component/ImportActionTable.jsx
View file @
21c03651
import
React
,
{
useState
,
useCallback
,
useRef
,
useEffect
}
from
'react'
;
import
React
,
{
useState
,
useCallback
,
useRef
,
useEffect
}
from
'react'
;
import
{
Table
,
Input
,
InputNumber
,
Form
,
Typography
,
Radio
,
Divider
,
Button
,
Popconfirm
,
Select
,
Row
,
Col
}
from
'antd'
;
import
{
Table
,
Input
,
InputNumber
,
Form
,
Typography
,
Radio
,
Divider
,
Button
,
Popconfirm
,
Select
,
Row
,
Col
,
Descriptions
}
from
'antd'
;
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'
;
...
@@ -424,24 +424,6 @@ const ImportActionTable = (props) => {
...
@@ -424,24 +424,6 @@ const ImportActionTable = (props) => {
return
columns
;
return
columns
;
}
}
// const mergedColumns = columns.map((col) => {
// if (!col.editable) {
// return col;
// }
// return {
// ...col,
// onCell: (record) => ({
// record,
// inputType: 'text',
// dataIndex: col.dataIndex,
// title: col.title,
// editing: isEditing(record),
// datatypes: supportedDatatypes,
// }),
// };
// });
const
moveRow
=
useCallback
(
const
moveRow
=
useCallback
(
(
dragIndex
,
hoverIndex
)
=>
{
(
dragIndex
,
hoverIndex
)
=>
{
...
@@ -505,7 +487,7 @@ const ImportActionTable = (props) => {
...
@@ -505,7 +487,7 @@ const ImportActionTable = (props) => {
suggests
&&
suggests
.
map
((
suggest
,
index
)
=>
{
suggests
&&
suggests
.
map
((
suggest
,
index
)
=>
{
return
(
return
(
<
Radio
key=
{
index
}
value=
{
index
}
className=
'mt-3'
style=
{
{
display
:
'block'
}
}
>
<
Radio
key=
{
index
}
value=
{
index
}
className=
'mt-3'
style=
{
{
display
:
'block'
}
}
>
{
`
${suggest.name
||''}`
}
{
`
中文名称: ${suggest.cnName||''} 英文名称: ${suggest.name||''} 描述: ${suggest.remark
||''}`
}
</
Radio
>
</
Radio
>
)
)
})
})
...
...
src/view/Manage/Model/Component/ModelTable.jsx
View file @
21c03651
...
@@ -82,6 +82,14 @@ const ModelTable = (props) => {
...
@@ -82,6 +82,14 @@ const ModelTable = (props) => {
callback
:
()
=>
{
callback
:
()
=>
{
showMessage
(
'success'
,
'模型删除成功'
);
showMessage
(
'success'
,
'模型删除成功'
);
onChange
&&
onChange
();
onChange
&&
onChange
();
const
index
=
selectedRowKeys
.
findIndex
((
rowKey
)
=>
rowKey
===
record
.
id
);
if
(
index
!==
-
1
)
{
const
newSelectedRowKeys
=
[...
selectedRowKeys
];
newSelectedRowKeys
.
splice
(
index
,
1
);
setSelectedRowKeys
(
newSelectedRowKeys
);
onSelect
&&
onSelect
(
newSelectedRowKeys
);
}
}
}
})
})
}
}
...
...
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