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
9fc1bcf8
Commit
9fc1bcf8
authored
Jul 30, 2021
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
模型自动建表
parent
ab53a797
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
84 additions
and
27 deletions
+84
-27
datamodel.js
src/model/datamodel.js
+12
-0
datamodeler.js
src/service/datamodeler.js
+12
-0
ExportDDLModal.jsx
src/view/Manage/Model/Component/ExportDDLModal.jsx
+0
-0
ImportActionTable.jsx
src/view/Manage/Model/Component/ImportActionTable.jsx
+2
-10
ModelTable.jsx
src/view/Manage/Model/Component/ModelTable.jsx
+18
-8
index.jsx
src/view/Manage/Model/index.jsx
+40
-9
No files found.
src/model/datamodel.js
View file @
9fc1bcf8
...
...
@@ -189,3 +189,15 @@ export function* autocomplete(payload) {
export
function
*
recommandEnglishWords
(
payload
)
{
return
yield
call
(
datamodelerService
.
recommandEnglishWords
,
payload
);
}
export
function
*
getDatasourcesByEnv
(
payload
)
{
return
yield
call
(
datamodelerService
.
getDatasourcesByEnv
,
payload
);
}
export
function
*
getSchemasByDatasourceId
(
payload
)
{
return
yield
call
(
datamodelerService
.
getSchemasByDatasourceId
,
payload
);
}
export
function
*
autoCreateTable
(
payload
)
{
return
yield
call
(
datamodelerService
.
autoCreateTable
,
payload
);
}
src/service/datamodeler.js
View file @
9fc1bcf8
...
...
@@ -144,3 +144,15 @@ export function autocomplete(payload) {
export
function
recommandEnglishWords
(
payload
)
{
return
PostJSON
(
"/datamodeler/easyDataModelerDesign/recommandEnglishWords"
,
payload
);
}
export
function
getDatasourcesByEnv
(
payload
)
{
return
GetJSON
(
"/metadatarepo/rest/metadata/findByModelAndSys"
,
payload
);
}
export
function
getSchemasByDatasourceId
(
payload
)
{
return
GetJSON
(
"/metadatarepo/rest/query/getChild"
,
payload
);
}
export
function
autoCreateTable
(
payload
)
{
return
PostJSON
(
"/metadataharvester/datasource/createTableByDDLList"
,
payload
);
}
src/view/Manage/Model/Component/ExportDDLModal.jsx
View file @
9fc1bcf8
This diff is collapsed.
Click to expand it.
src/view/Manage/Model/Component/ImportActionTable.jsx
View file @
9fc1bcf8
...
...
@@ -419,21 +419,13 @@ const ImportActionTable = (props) => {
if
(
changedValues
.
nullable
&&
allValues
.
partOfPrimaryKey
)
{
showMessage
(
'info'
,
'主键不允许为空'
);
}
}
else
if
(
changedValues
.
hasOwnProperty
(
'partOfDistributionKey'
))
{
if
(
changedValues
.
partOfDistributionKey
&&
!
allValues
.
partOfPrimaryKey
)
{
showMessage
(
'info'
,
'分布键必须是主键的子集'
);
}
}
}
if
(
allValues
.
partOfPrimaryKey
)
{
form
.
setFieldsValue
({
nullable
:
false
});
}
else
{
form
.
setFieldsValue
({
partOfDistributionKey
:
false
})
}
}
};
...
...
src/view/Manage/Model/Component/ModelTable.jsx
View file @
9fc1bcf8
...
...
@@ -34,7 +34,7 @@ const ResizeableHeaderCell = props => {
const
ModelTable
=
(
props
)
=>
{
const
{
data
,
onChange
,
onItemAction
,
onSelect
,
catalogId
,
onSearchInputChange
,
onModelStateChange
,
loadingStates
,
currentModelState
,
modelStates
,
view
,
keyword
,
onRecatalog
}
=
props
;
const
{
data
,
onChange
,
onItemAction
,
onSelect
,
catalogId
,
onSearchInputChange
,
onModelStateChange
,
loadingStates
,
currentModelState
,
modelStates
,
view
,
keyword
,
onRecatalog
,
onAutoCreateTable
}
=
props
;
const
[
selectedRowKeys
,
setSelectedRowKeys
]
=
useState
([]);
const
[
columns
,
setColumns
]
=
useState
([
...
...
@@ -71,15 +71,19 @@ const ModelTable = (props) => {
render
:
(
_
,
record
)
=>
{
return
(
<
Space
size=
'small'
>
<
Tooltip
placement=
'bottom'
title=
{
'修改'
}
>
<
Button
icon=
{
<
EditOutlined
/>
}
size=
'small'
onClick=
{
()
=>
{
editItem
(
record
);
}
}
/>
</
Tooltip
>
{
record
.
editable
&&
<
Tooltip
placement=
'bottom'
title=
{
'修改'
}
>
<
Button
icon=
{
<
EditOutlined
/>
}
size=
'small'
onClick=
{
()
=>
{
editItem
(
record
);
}
}
/>
</
Tooltip
>
}
<
Tooltip
placement=
'bottom'
title=
{
'详情'
}
>
<
Button
icon=
{
<
ReconciliationOutlined
/>
}
size=
'small'
onClick=
{
()
=>
{
detailItem
(
record
);
}
}
/>
</
Tooltip
>
<
Tooltip
placement=
'bottom'
title=
{
'删除'
}
>
<
Button
icon=
{
<
DeleteOutlined
/>
}
size=
'small'
onClick=
{
()
=>
{
deleteItem
(
record
);
}
}
/>
</
Tooltip
>
{
record
.
editable
&&
<
Tooltip
placement=
'bottom'
title=
{
'删除'
}
>
<
Button
icon=
{
<
DeleteOutlined
/>
}
size=
'small'
onClick=
{
()
=>
{
deleteItem
(
record
);
}
}
/>
</
Tooltip
>
}
{
(
record
?.
state
?.
supportedActions
||
[]).
length
>
0
&&
record
?.
state
?.
supportedActions
.
map
((
item
,
index
)
=>
{
return
(
...
...
@@ -92,6 +96,9 @@ const ModelTable = (props) => {
);
})
}
{
record
?.
deployable
&&
<
Button
size=
'small'
onClick=
{
()
=>
{
deployAction
(
record
);
}
}
>
建表
</
Button
>
}
</
Space
>
)
}
...
...
@@ -144,8 +151,11 @@ const ModelTable = (props) => {
onItemAction
&&
onItemAction
(
record
.
id
||
''
,
'detail'
);
}
const
stateAction
=
(
record
,
action
)
=>
{
const
deployAction
=
(
record
)
=>
{
onAutoCreateTable
&&
onAutoCreateTable
(
record
);
}
const
stateAction
=
(
record
,
action
)
=>
{
modal
.
confirm
({
title
:
'提示!'
,
content
:
`您确定要
${
action
.
cnName
||
''
}
该模型吗?`
,
...
...
src/view/Manage/Model/index.jsx
View file @
9fc1bcf8
...
...
@@ -14,6 +14,7 @@ import RecatalogModal from './Component/RecatalogModal';
import
{
showMessage
,
showNotifaction
}
from
'../../../util'
;
import
{
dispatch
}
from
'../../../model'
;
import
{
Action
,
CatalogId
,
ModelerId
,
Hints
}
from
'../../../util/constant'
;
import
{
AppContext
}
from
'../../../App'
;
import
'./index.less'
;
...
...
@@ -44,6 +45,8 @@ class Model extends React.Component {
modelStates
:
[],
currentModelState
:
''
,
currentView
:
''
,
exportDDLModalReference
:
'exportDDL'
,
currentModel
:
{},
}
}
...
...
@@ -247,7 +250,7 @@ class Model extends React.Component {
});
this
.
setState
({
exportDDLModalVisible
:
true
,
selectModelerNames
:
_selectModelerNames
});
this
.
setState
({
exportDDLModalVisible
:
true
,
selectModelerNames
:
_selectModelerNames
,
exportDDLModalReference
:
'exportDDL'
});
}
onExportErwinBtnClick
=
()
=>
{
...
...
@@ -306,6 +309,11 @@ class Model extends React.Component {
this
.
setState
({
recatalogModalVisible
:
true
});
}
onAutoCreateTable
=
(
item
)
=>
{
this
.
setState
({
exportDDLModalVisible
:
true
,
selectModelerNames
:
[
item
.
name
||
''
],
exportDDLModalReference
:
'createTable'
,
currentModel
:
item
});
}
onImportExcelVisibleChange
=
(
visible
=
false
,
hint
=
null
)
=>
{
this
.
setState
({
importExcelVisible
:
visible
});
}
...
...
@@ -354,10 +362,26 @@ class Model extends React.Component {
}
render
()
{
const
{
importModalVisible
,
catalogId
,
loadingTableData
,
selectModelerIds
,
keyword
,
filterTableData
,
selectModelerNames
,
importModalAddMode
,
exportErwinLoading
,
exportDDLModalVisible
,
templateCURDDrawerVisible
,
wordTemplateModalVisible
,
constraintDetailDrawerVisible
,
importWordModalVisible
,
loadingStates
,
modelStates
,
currentModelState
,
currentView
,
recatalogModalVisible
}
=
this
.
state
;
const
{
importModalVisible
,
catalogId
,
loadingTableData
,
selectModelerIds
,
keyword
,
filterTableData
,
selectModelerNames
,
importModalAddMode
,
exportErwinLoading
,
exportDDLModalVisible
,
templateCURDDrawerVisible
,
wordTemplateModalVisible
,
constraintDetailDrawerVisible
,
importWordModalVisible
,
loadingStates
,
modelStates
,
currentModelState
,
currentView
,
recatalogModalVisible
,
exportDDLModalReference
,
currentModel
}
=
this
.
state
;
const
content
=
(
<
ModelTable
loading=
{
loadingTableData
}
catalogId=
{
catalogId
}
data=
{
filterTableData
}
view=
{
currentView
}
loadingStates=
{
loadingStates
}
modelStates=
{
modelStates
}
currentModelState=
{
currentModelState
}
keyword=
{
keyword
}
onChange=
{
this
.
onTableChange
}
onSelect=
{
this
.
onTableSelect
}
onItemAction=
{
this
.
onTableItemAction
}
onModelStateChange=
{
this
.
onModelStateChange
}
onSearchInputChange=
{
this
.
onSearchInputChange
}
onRecatalog=
{
this
.
onRecatalogBtnClick
}
{
...
this
.
props
}
/>
<
ModelTable
loading=
{
loadingTableData
}
catalogId=
{
catalogId
}
data=
{
filterTableData
}
view=
{
currentView
}
loadingStates=
{
loadingStates
}
modelStates=
{
modelStates
}
currentModelState=
{
currentModelState
}
keyword=
{
keyword
}
onChange=
{
this
.
onTableChange
}
onSelect=
{
this
.
onTableSelect
}
onItemAction=
{
this
.
onTableItemAction
}
onModelStateChange=
{
this
.
onModelStateChange
}
onSearchInputChange=
{
this
.
onSearchInputChange
}
onRecatalog=
{
this
.
onRecatalogBtnClick
}
onAutoCreateTable=
{
this
.
onAutoCreateTable
}
{
...
this
.
props
}
/>
);
return
(
...
...
@@ -446,13 +470,20 @@ class Model extends React.Component {
onCancel=
{
this
.
onImportWordModalCancel
}
catalogId=
{
catalogId
}
/>
<
AppContext
.
Consumer
>
{
value
=>
<
ExportDDLModal
visible=
{
exportDDLModalVisible
}
reference=
{
exportDDLModalReference
}
ids=
{
(
exportDDLModalReference
===
'exportDDL'
)?
selectModelerIds
:[
currentModel
.
id
]
}
names=
{
selectModelerNames
}
env=
{
value
?.
env
}
onCancel=
{
this
.
onExportDDLModalCancel
}
/>
}
</
AppContext
.
Consumer
>
<
ExportDDLModal
visible=
{
exportDDLModalVisible
}
ids=
{
selectModelerIds
}
names=
{
selectModelerNames
}
onCancel=
{
this
.
onExportDDLModalCancel
}
/>
<
RecatalogModal
visible=
{
recatalogModalVisible
}
...
...
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