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
7ba19260
Commit
7ba19260
authored
Apr 06, 2021
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加模型导出
parent
4ed8fb32
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
26 deletions
+54
-26
ExportModal.jsx
src/view/Manage/Model/Component/ExportModal.jsx
+26
-19
ModelTable.jsx
src/view/Manage/Model/Component/ModelTable.jsx
+11
-2
UpdateTreeItemModal.jsx
src/view/Manage/Model/Component/UpdateTreeItemModal.jsx
+1
-1
index.jsx
src/view/Manage/Model/index.jsx
+16
-4
No files found.
src/view/Manage/Model/Component/ExportModal.jsx
View file @
7ba19260
...
@@ -3,16 +3,12 @@ import { Modal, Radio, Button } from 'antd';
...
@@ -3,16 +3,12 @@ import { Modal, Radio, Button } from 'antd';
const
modes
=
[
const
modes
=
[
{
{
title
:
'导出DDL'
,
},
{
title
:
'导出Erwin'
,
},
{
title
:
'导出Excel'
,
title
:
'导出Excel'
,
key
:
'excel'
,
},
},
{
{
title
:
'导出模型文档'
title
:
'导出Word'
,
key
:
'word'
,
},
},
]
]
...
@@ -21,36 +17,47 @@ class ExportModal extends React.Component {
...
@@ -21,36 +17,47 @@ class ExportModal extends React.Component {
constructor
()
{
constructor
()
{
super
();
super
();
this
.
state
=
{
this
.
state
=
{
confirmLoading
:
false
selectedKey
:
''
,
}
}
}
}
onModeClick
=
(
index
)
=>
{
onModeClick
=
(
e
)
=>
{
this
.
setState
({
selectedKey
:
e
.
target
.
value
});
}
}
handleOk
=
()
=>
{
handleOk
=
()
=>
{
const
{
onCancel
}
=
this
.
props
;
const
{
onCancel
,
ids
}
=
this
.
props
;
const
{
selectedKey
}
=
this
.
state
;
if
(
onCancel
)
{
if
(
selectedKey
===
'excel'
)
{
onCancel
();
window
.
open
(
`/api/datamodeler/easyDataModelerExport/excel?ids=
${
ids
.
join
(
','
)}
`
);
}
else
if
(
selectedKey
===
'word'
)
{
window
.
open
(
`/api/datamodeler/easyDataModelerExport/word?ids=
${
ids
.
join
(
','
)}
`
);
}
}
this
.
reset
();
onCancel
&&
onCancel
();
}
reset
=
()
=>
{
this
.
setState
({
selectedKey
:
''
});
}
}
render
()
{
render
()
{
const
{
visible
,
onCancel
}
=
this
.
props
;
const
{
visible
,
onCancel
}
=
this
.
props
;
const
{
confirmLoading
}
=
this
.
state
;
const
{
selectedKey
}
=
this
.
state
;
return
(
return
(
<
Modal
<
Modal
visible=
{
visible
}
visible=
{
visible
}
title=
{
"导出方式"
}
title=
{
"导出方式"
}
destroyOnClose
onOk=
{
this
.
handleOk
}
onOk=
{
this
.
handleOk
}
onCancel=
{
onCancel
}
onCancel=
{
()
=>
{
this
.
reset
();
onCancel
&&
onCancel
();
}
}
footer=
{
[
footer=
{
[
<
Button
<
Button
key=
"0"
key=
"0"
loading=
{
confirmLoading
}
type=
"primary"
type=
"primary"
onClick=
{
this
.
handleOk
}
onClick=
{
this
.
handleOk
}
>
>
...
@@ -58,11 +65,11 @@ class ExportModal extends React.Component {
...
@@ -58,11 +65,11 @@ class ExportModal extends React.Component {
</
Button
>
</
Button
>
]
}
]
}
>
>
<
Radio
.
Group
>
<
Radio
.
Group
value=
{
selectedKey
}
onChange=
{
this
.
onModeClick
}
>
{
{
modes
&&
modes
.
map
((
mode
,
index
)
=>
{
modes
&&
modes
.
map
((
mode
,
index
)
=>
{
return
(
return
(
<
Radio
key=
{
index
}
value=
{
index
}
>
<
Radio
key=
{
mode
.
key
||
''
}
value=
{
mode
.
key
||
''
}
>
{
mode
.
title
||
''
}
{
mode
.
title
||
''
}
</
Radio
>
</
Radio
>
);
);
...
...
src/view/Manage/Model/Component/ModelTable.jsx
View file @
7ba19260
import
React
,
{
useState
}
from
"react"
;
import
React
,
{
useState
,
useEffect
}
from
"react"
;
import
{
Table
,
Space
,
Button
,
Tooltip
,
Modal
}
from
'antd'
;
import
{
Table
,
Space
,
Button
,
Tooltip
,
Modal
}
from
'antd'
;
import
{
EditOutlined
,
CheckOutlined
,
ReconciliationOutlined
,
DeleteOutlined
}
from
'@ant-design/icons'
;
import
{
EditOutlined
,
CheckOutlined
,
ReconciliationOutlined
,
DeleteOutlined
}
from
'@ant-design/icons'
;
...
@@ -8,11 +8,19 @@ import './ModelTable.less';
...
@@ -8,11 +8,19 @@ import './ModelTable.less';
const
ModelTable
=
(
props
)
=>
{
const
ModelTable
=
(
props
)
=>
{
const
{
data
,
onChange
,
loading
,
onItemAction
}
=
props
;
const
{
data
,
onChange
,
loading
,
onItemAction
,
onSelect
,
catalogId
}
=
props
;
const
[
selectedRowKeys
,
setSelectedRowKeys
]
=
useState
([]);
const
[
selectedRowKeys
,
setSelectedRowKeys
]
=
useState
([]);
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
useEffect
(()
=>
{
setSelectedRowKeys
([]);
onSelect
&&
onSelect
([]);
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
catalogId
]);
const
columns
=
[
const
columns
=
[
{
{
title
:
'模型名称'
,
title
:
'模型名称'
,
...
@@ -82,6 +90,7 @@ const ModelTable = (props) => {
...
@@ -82,6 +90,7 @@ const ModelTable = (props) => {
const
onSelectChange
=
keys
=>
{
const
onSelectChange
=
keys
=>
{
setSelectedRowKeys
(
keys
);
setSelectedRowKeys
(
keys
);
onSelect
&&
onSelect
(
keys
);
};
};
const
rowSelection
=
{
const
rowSelection
=
{
...
...
src/view/Manage/Model/Component/UpdateTreeItemModal.jsx
View file @
7ba19260
...
@@ -89,7 +89,7 @@ const UpdateTreeItemModal = (props) => {
...
@@ -89,7 +89,7 @@ const UpdateTreeItemModal = (props) => {
_action
=
item
?
'sub'
:
'root'
;
_action
=
item
?
'sub'
:
'root'
;
}
}
form
.
setFields
([{
name
:
'name'
,
errors
:
[]
},
{
name
:
'remark'
,
error
:
[]
}])
form
.
setFields
([{
name
:
'name'
,
errors
:
[]
},
{
name
:
'remark'
,
error
s
:
[]
}]);
if
(
type
===
'add'
)
{
if
(
type
===
'add'
)
{
form
.
setFieldsValue
({
action
:
_action
,
name
:
''
,
remark
:
''
});
form
.
setFieldsValue
({
action
:
_action
,
name
:
''
,
remark
:
''
});
...
...
src/view/Manage/Model/index.jsx
View file @
7ba19260
...
@@ -19,11 +19,12 @@ class Model extends React.Component {
...
@@ -19,11 +19,12 @@ class Model extends React.Component {
importModalAction
:
''
,
importModalAction
:
''
,
tableData
:
[],
tableData
:
[],
loadingTableData
:
false
,
loadingTableData
:
false
,
selectModelerIds
:
[],
}
}
}
}
onTreeSelect
=
(
key
)
=>
{
onTreeSelect
=
(
key
)
=>
{
this
.
setState
({
catalogId
:
key
},
()
=>
{
this
.
setState
({
catalogId
:
key
,
selectModelerIds
:
[]
},
()
=>
{
if
(
!
key
||
key
===
''
)
{
if
(
!
key
||
key
===
''
)
{
this
.
setState
({
tableData
:
[]
});
this
.
setState
({
tableData
:
[]
});
}
else
{
}
else
{
...
@@ -51,6 +52,10 @@ class Model extends React.Component {
...
@@ -51,6 +52,10 @@ class Model extends React.Component {
})
})
}
}
onTableSelect
=
(
ids
)
=>
{
this
.
setState
({
selectModelerIds
:
ids
});
}
onTableItemAction
=
(
id
,
action
)
=>
{
onTableItemAction
=
(
id
,
action
)
=>
{
this
.
setState
({
importModalVisible
:
true
,
importModalAction
:
action
,
modelerId
:
id
});
this
.
setState
({
importModalVisible
:
true
,
importModalAction
:
action
,
modelerId
:
id
});
}
}
...
@@ -66,6 +71,12 @@ class Model extends React.Component {
...
@@ -66,6 +71,12 @@ class Model extends React.Component {
}
}
onExportBtnClick
=
()
=>
{
onExportBtnClick
=
()
=>
{
const
{
selectModelerIds
}
=
this
.
state
;
if
((
selectModelerIds
||
[]).
length
===
0
)
{
showMessage
(
'info'
,
'请先选择模型'
);
return
;
}
this
.
setState
({
exportModalVisible
:
true
});
this
.
setState
({
exportModalVisible
:
true
});
}
}
...
@@ -79,7 +90,7 @@ class Model extends React.Component {
...
@@ -79,7 +90,7 @@ class Model extends React.Component {
}
}
render
()
{
render
()
{
const
{
importModalVisible
,
exportModalVisible
,
catalogId
,
importModalAction
,
tableData
,
loadingTableData
,
modelerId
}
=
this
.
state
;
const
{
importModalVisible
,
exportModalVisible
,
catalogId
,
importModalAction
,
tableData
,
loadingTableData
,
modelerId
,
selectModelerIds
}
=
this
.
state
;
return
(
return
(
<
div
style=
{
{
backgroundColor
:
'#ECEEF3'
,
height
:
'100%'
}
}
>
<
div
style=
{
{
backgroundColor
:
'#ECEEF3'
,
height
:
'100%'
}
}
>
...
@@ -103,7 +114,7 @@ class Model extends React.Component {
...
@@ -103,7 +114,7 @@ class Model extends React.Component {
<
Button
type=
"primary"
className=
'ml-3'
onClick=
{
this
.
onExportBtnClick
}
>
模型导出
</
Button
>
<
Button
type=
"primary"
className=
'ml-3'
onClick=
{
this
.
onExportBtnClick
}
>
模型导出
</
Button
>
</
div
>
</
div
>
<
div
className=
'p-3'
>
<
div
className=
'p-3'
>
<
ModelTable
loading=
{
loadingTableData
}
data=
{
tableData
}
onChange=
{
this
.
onTableChange
}
onItemAction=
{
this
.
onTableItemAction
}
/>
<
ModelTable
loading=
{
loadingTableData
}
catalogId=
{
catalogId
}
data=
{
tableData
}
onChange=
{
this
.
onTableChange
}
onSelect=
{
this
.
onTableSelect
}
onItemAction=
{
this
.
onTableItemAction
}
/>
</
div
>
</
div
>
</
div
>
</
div
>
</
Col
>
</
Col
>
...
@@ -118,7 +129,8 @@ class Model extends React.Component {
...
@@ -118,7 +129,8 @@ class Model extends React.Component {
/>
/>
<
ExportModal
<
ExportModal
visible=
{
exportModalVisible
}
visible=
{
exportModalVisible
}
ids=
{
selectModelerIds
}
onCancel=
{
this
.
onExportModalCancel
}
onCancel=
{
this
.
onExportModalCancel
}
/>
/>
</
div
>
</
div
>
...
...
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