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
3a57d23f
Commit
3a57d23f
authored
Jul 29, 2021
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
模型可在不同目录移动
parent
c16cfe06
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
164 additions
and
26 deletions
+164
-26
datamodel.js
src/model/datamodel.js
+4
-0
datamodeler.js
src/service/datamodeler.js
+4
-0
ModelTable.jsx
src/view/Manage/Model/Component/ModelTable.jsx
+6
-1
ModelTree.jsx
src/view/Manage/Model/Component/ModelTree.jsx
+24
-13
ModelTree.less
src/view/Manage/Model/Component/ModelTree.less
+8
-0
RecatalogModal.jsx
src/view/Manage/Model/Component/RecatalogModal.jsx
+75
-0
index.jsx
src/view/Manage/Model/index.jsx
+43
-12
No files found.
src/model/datamodel.js
View file @
3a57d23f
...
@@ -78,6 +78,10 @@ export function* nextState(payload) {
...
@@ -78,6 +78,10 @@ export function* nextState(payload) {
return
yield
call
(
datamodelerService
.
nextState
,
payload
);
return
yield
call
(
datamodelerService
.
nextState
,
payload
);
}
}
export
function
*
recatalogDataModel
(
payload
)
{
return
yield
call
(
datamodelerService
.
recatalogDataModel
,
payload
);
}
export
function
*
extractExcelContent
(
payload
)
{
export
function
*
extractExcelContent
(
payload
)
{
return
yield
call
(
datamodelerService
.
extractExcelContent
,
payload
);
return
yield
call
(
datamodelerService
.
extractExcelContent
,
payload
);
}
}
...
...
src/service/datamodeler.js
View file @
3a57d23f
...
@@ -35,6 +35,10 @@ export function nextState(payload) {
...
@@ -35,6 +35,10 @@ export function nextState(payload) {
return
GetJSON
(
"/datamodeler/easyDataModelerCURD/nextState"
,
payload
);
return
GetJSON
(
"/datamodeler/easyDataModelerCURD/nextState"
,
payload
);
}
}
export
function
recatalogDataModel
(
payload
)
{
return
PostJSON
(
"/datamodeler/easyDataModelerCURD/recatalogDataModel"
,
payload
);
}
export
function
extractExcelContent
(
payload
)
{
export
function
extractExcelContent
(
payload
)
{
return
PostFile
(
"/datamodeler/easyDataModelerDesign/kickStart"
,
payload
);
return
PostFile
(
"/datamodeler/easyDataModelerDesign/kickStart"
,
payload
);
}
}
...
...
src/view/Manage/Model/Component/ModelTable.jsx
View file @
3a57d23f
...
@@ -14,7 +14,7 @@ const { Option } = Select;
...
@@ -14,7 +14,7 @@ const { Option } = Select;
const
ModelTable
=
(
props
)
=>
{
const
ModelTable
=
(
props
)
=>
{
const
{
data
,
onChange
,
onItemAction
,
onSelect
,
catalogId
,
onSearchInputChange
,
onModelStateChange
,
loadingStates
,
currentModelState
,
modelStates
,
view
,
keyword
}
=
props
;
const
{
data
,
onChange
,
onItemAction
,
onSelect
,
catalogId
,
onSearchInputChange
,
onModelStateChange
,
loadingStates
,
currentModelState
,
modelStates
,
view
,
keyword
,
onRecatalog
}
=
props
;
const
[
selectedRowKeys
,
setSelectedRowKeys
]
=
useState
([]);
const
[
selectedRowKeys
,
setSelectedRowKeys
]
=
useState
([]);
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
...
@@ -267,6 +267,11 @@ const ModelTable = (props) => {
...
@@ -267,6 +267,11 @@ const ModelTable = (props) => {
toolbar=
{
{
toolbar=
{
{
title
:
TitleComponent
,
title
:
TitleComponent
,
}
}
}
}
toolBarRender=
{
()
=>
[
<
Button
type=
'primary'
onClick=
{
()
=>
{
onRecatalog
&&
onRecatalog
();
}
}
>
模型变更目录
</
Button
>,
]
}
sticky
sticky
/>
/>
{
contextHolder
}
{
contextHolder
}
...
...
src/view/Manage/Model/Component/ModelTree.jsx
View file @
3a57d23f
import
React
,
{
useState
,
useEffect
,
useRef
}
from
"react"
;
import
React
,
{
useState
,
useEffect
,
useRef
}
from
"react"
;
import
{
Tooltip
,
Tree
,
Modal
,
Spin
,
Dropdown
,
Menu
}
from
"antd"
;
import
{
Tooltip
,
Tree
,
Modal
,
Spin
,
Dropdown
,
Menu
}
from
"antd"
;
import
{
PlusOutlined
,
EditOutlined
,
SyncOutlined
,
DeleteOutlined
,
UnorderedListOutlined
}
from
'@ant-design/icons'
;
import
{
PlusOutlined
,
EditOutlined
,
SyncOutlined
,
DeleteOutlined
,
UnorderedListOutlined
}
from
'@ant-design/icons'
;
import
classnames
from
'classnames'
;
import
UpdateTreeItemModal
from
'./UpdateTreeItemModal'
;
import
UpdateTreeItemModal
from
'./UpdateTreeItemModal'
;
import
{
dispatch
}
from
'../../../../model'
;
import
{
dispatch
}
from
'../../../../model'
;
...
@@ -22,7 +23,7 @@ const viewModes = [
...
@@ -22,7 +23,7 @@ const viewModes = [
const
ModelTree
=
(
props
)
=>
{
const
ModelTree
=
(
props
)
=>
{
const
{
onSelect
,
onViewChange
}
=
props
;
const
{
onSelect
,
onViewChange
,
refrence
=
''
}
=
props
;
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
treeData
,
setTreeData
]
=
useState
(
null
);
const
[
treeData
,
setTreeData
]
=
useState
(
null
);
const
[
item
,
setItem
]
=
useState
(
null
);
const
[
item
,
setItem
]
=
useState
(
null
);
...
@@ -35,21 +36,25 @@ const ModelTree = (props) => {
...
@@ -35,21 +36,25 @@ const ModelTree = (props) => {
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
const
timestamp
=
getQueryParam
(
AnchorTimestamp
,
props
.
location
.
search
);
const
timestamp
=
getQueryParam
(
AnchorTimestamp
,
props
.
location
?.
search
||
''
);
const
id
=
getQueryParam
(
AnchorId
,
props
.
location
.
search
);
const
id
=
getQueryParam
(
AnchorId
,
props
.
location
?.
search
||
''
);
const
itemRef
=
useRef
();
const
itemRef
=
useRef
();
itemRef
.
current
=
null
;
itemRef
.
current
=
null
;
useEffect
(()
=>
{
useEffect
(()
=>
{
setViewSelectedKey
(
viewModes
[
0
].
key
);
if
(
refrence
===
'recatalog'
)
{
onViewChange
&&
onViewChange
(
viewModes
[
0
].
key
);
if
((
id
||
''
)
!==
''
)
{
getDataModelLocationThenGetDirTreeData
();
}
else
{
getDirTreeData
();
getDirTreeData
();
}
}
else
{
setViewSelectedKey
(
viewModes
[
0
].
key
);
onViewChange
&&
onViewChange
(
viewModes
[
0
].
key
);
if
((
id
||
''
)
!==
''
)
{
getDataModelLocationThenGetDirTreeData
();
}
else
{
getDirTreeData
();
}
}
//eslint-disable-next-line react-hooks/exhaustive-deps
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
timestamp
])
},
[
timestamp
])
...
@@ -124,7 +129,7 @@ const ModelTree = (props) => {
...
@@ -124,7 +129,7 @@ const ModelTree = (props) => {
setItem
(
defaultItem
);
setItem
(
defaultItem
);
onSelect
&&
onSelect
(
defaultItem
.
key
||
''
);
onSelect
&&
onSelect
(
defaultItem
.
key
||
''
);
}
else
{
}
else
if
(
refrence
===
''
)
{
let
currentItem
=
itemRef
.
current
;
let
currentItem
=
itemRef
.
current
;
...
@@ -303,9 +308,14 @@ const ModelTree = (props) => {
...
@@ -303,9 +308,14 @@ const ModelTree = (props) => {
</
Menu
>
</
Menu
>
);
);
const
classes
=
classnames
(
'model-tree'
,
{
'model-tree-recatalog'
:
(
refrence
===
'recatalog'
)
});
return
(
return
(
<
div
className=
'model-tree'
>
<
div
className=
{
classes
}
>
<
div
{
(
refrence
===
''
)
&&
<
div
className=
'p-3'
className=
'p-3'
style=
{
{
style=
{
{
display
:
'flex'
,
display
:
'flex'
,
...
@@ -344,6 +354,7 @@ const ModelTree = (props) => {
...
@@ -344,6 +354,7 @@ const ModelTree = (props) => {
)
)
}
}
</
div
>
</
div
>
}
<
div
className=
'p-3'
>
<
div
className=
'p-3'
>
<
Spin
spinning=
{
loading
}
>
<
Spin
spinning=
{
loading
}
>
<
Tree
<
Tree
...
...
src/view/Manage/Model/Component/ModelTree.less
View file @
3a57d23f
...
@@ -4,4 +4,11 @@
...
@@ -4,4 +4,11 @@
height: calc(100vh - @header-height - @pm-4 - 54px - @pm-3) !important;
height: calc(100vh - @header-height - @pm-4 - 54px - @pm-3) !important;
overflow: auto !important;
overflow: auto !important;
}
}
}
.model-tree-recatalog {
.yy-tree-list {
height: 500px !important;
overflow: auto !important;
}
}
}
\ No newline at end of file
src/view/Manage/Model/Component/RecatalogModal.jsx
0 → 100644
View file @
3a57d23f
import
React
,
{
useState
}
from
"react"
;
import
{
Modal
}
from
"antd"
;
import
{
dispatch
}
from
'../../../../model'
;
import
ModelTree
from
'./ModelTree'
;
import
{
showMessage
}
from
'../../../../util'
;
const
RecatalogModal
=
(
props
)
=>
{
const
{
onCancel
,
visible
,
ids
}
=
props
;
const
[
catalogId
,
setCatalogId
]
=
useState
(
''
);
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
(
false
);
const
onSelect
=
(
value
)
=>
{
setCatalogId
(
value
);
}
const
onOk
=
()
=>
{
if
((
catalogId
||
''
)
===
''
)
{
showMessage
(
'warn'
,
'请先选择模型目录'
);
return
;
}
setConfirmLoading
(
true
);
dispatch
({
type
:
'datamodel.recatalogDataModel'
,
payload
:
{
params
:
{
easyDataModelCatalogId
:
catalogId
,
easyDataModelerDataModelIds
:
ids
.
join
(
','
)
},
},
callback
:
data
=>
{
setConfirmLoading
(
false
);
reset
();
onCancel
&&
onCancel
(
true
);
},
error
:
()
=>
{
setConfirmLoading
(
false
);
}
})
}
const
reset
=
()
=>
{
setConfirmLoading
(
false
);
setCatalogId
(
''
);
}
return
(
<
div
>
{
visible
&&
<
Modal
title=
'变更目录详情'
visible=
{
visible
}
width=
{
400
}
confirmLoading=
{
confirmLoading
}
onCancel=
{
()
=>
{
reset
();
onCancel
&&
onCancel
()
}
}
onOk=
{
onOk
}
>
<
ModelTree
refrence=
'recatalog'
onSelect=
{
onSelect
}
/>
</
Modal
>
}
</
div
>
)
}
export
default
RecatalogModal
;
\ No newline at end of file
src/view/Manage/Model/index.jsx
View file @
3a57d23f
...
@@ -10,6 +10,7 @@ import ConstraintDetailDrawer from './Component/ConstraintDetailDrawer';
...
@@ -10,6 +10,7 @@ import ConstraintDetailDrawer from './Component/ConstraintDetailDrawer';
import
ImportModal
from
'./Component/ImportModal'
;
import
ImportModal
from
'./Component/ImportModal'
;
import
ImportWordModal
from
'./Component/ImportWordModal'
;
import
ImportWordModal
from
'./Component/ImportWordModal'
;
import
ExportDDLModal
from
'./Component/ExportDDLModal'
;
import
ExportDDLModal
from
'./Component/ExportDDLModal'
;
import
RecatalogModal
from
'./Component/RecatalogModal'
;
import
{
showMessage
,
showNotifaction
}
from
'../../../util'
;
import
{
showMessage
,
showNotifaction
}
from
'../../../util'
;
import
{
dispatch
}
from
'../../../model'
;
import
{
dispatch
}
from
'../../../model'
;
import
{
Action
,
CatalogId
,
ModelerId
,
Hints
}
from
'../../../util/constant'
;
import
{
Action
,
CatalogId
,
ModelerId
,
Hints
}
from
'../../../util/constant'
;
...
@@ -27,6 +28,7 @@ class Model extends React.Component {
...
@@ -27,6 +28,7 @@ class Model extends React.Component {
importModalVisible
:
false
,
importModalVisible
:
false
,
importWordModalVisible
:
false
,
importWordModalVisible
:
false
,
exportDDLModalVisible
:
false
,
exportDDLModalVisible
:
false
,
recatalogModalVisible
:
false
,
catalogId
:
''
,
catalogId
:
''
,
importModalAction
:
''
,
importModalAction
:
''
,
importModalAddMode
:
''
,
importModalAddMode
:
''
,
...
@@ -294,6 +296,16 @@ class Model extends React.Component {
...
@@ -294,6 +296,16 @@ class Model extends React.Component {
window
.
open
(
`/api/datamodeler/easyDataModelerExport/word/template?ids=
${
selectModelerIds
.
join
(
','
)}
`
);
window
.
open
(
`/api/datamodeler/easyDataModelerExport/word/template?ids=
${
selectModelerIds
.
join
(
','
)}
`
);
}
}
onRecatalogBtnClick
=
()
=>
{
const
{
selectModelerIds
}
=
this
.
state
;
if
((
selectModelerIds
||
[]).
length
===
0
)
{
showMessage
(
'info'
,
'请先选择模型'
);
return
;
}
this
.
setState
({
recatalogModalVisible
:
true
});
}
onImportExcelVisibleChange
=
(
visible
=
false
,
hint
=
null
)
=>
{
onImportExcelVisibleChange
=
(
visible
=
false
,
hint
=
null
)
=>
{
this
.
setState
({
importExcelVisible
:
visible
});
this
.
setState
({
importExcelVisible
:
visible
});
}
}
...
@@ -332,11 +344,20 @@ class Model extends React.Component {
...
@@ -332,11 +344,20 @@ class Model extends React.Component {
this
.
setState
({
exportDDLModalVisible
:
false
});
this
.
setState
({
exportDDLModalVisible
:
false
});
}
}
onRecatalogModalCancel
=
(
refresh
=
false
)
=>
{
this
.
setState
({
recatalogModalVisible
:
false
});
if
(
refresh
)
{
this
.
setState
({
selectModelerIds
:
[]
},
()
=>
{
this
.
onTableChange
();
});
}
}
render
()
{
render
()
{
const
{
importModalVisible
,
catalogId
,
loadingTableData
,
selectModelerIds
,
keyword
,
filterTableData
,
selectModelerNames
,
importModalAddMode
,
exportErwinLoading
,
exportDDLModalVisible
,
templateCURDDrawerVisible
,
wordTemplateModalVisible
,
constraintDetailDrawerVisible
,
importWordModalVisible
,
loadingStates
,
modelStates
,
currentModelState
,
currentView
}
=
this
.
state
;
const
{
importModalVisible
,
catalogId
,
loadingTableData
,
selectModelerIds
,
keyword
,
filterTableData
,
selectModelerNames
,
importModalAddMode
,
exportErwinLoading
,
exportDDLModalVisible
,
templateCURDDrawerVisible
,
wordTemplateModalVisible
,
constraintDetailDrawerVisible
,
importWordModalVisible
,
loadingStates
,
modelStates
,
currentModelState
,
currentView
,
recatalogModalVisible
}
=
this
.
state
;
const
content
=
(
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
}
{
...
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
}
{
...
this
.
props
}
/>
);
);
return
(
return
(
...
@@ -368,18 +389,20 @@ class Model extends React.Component {
...
@@ -368,18 +389,20 @@ class Model extends React.Component {
className=
'd-flex p-3'
className=
'd-flex p-3'
style=
{
{
style=
{
{
borderBottom
:
'1px solid #EFEFEF'
,
borderBottom
:
'1px solid #EFEFEF'
,
justifyContent
:
'space-between
'
,
justifyContent
:
(
currentView
===
'dir'
)?
'space-between'
:
'flex-end
'
,
}
}
}
}
>
>
<
Space
>
{
<
span
>
模型创建:
</
span
>
currentView
===
'dir'
&&
<
Space
>
<
Button
type=
"primary"
onClick=
{
this
.
onImportExcelBtnClick
}
>
Excel导入
</
Button
>
<
span
>
模型创建:
</
span
>
<
Button
type=
"primary"
onClick=
{
this
.
onImportExcelCopyBtnClick
}
>
Excel复制粘贴
</
Button
>
<
Button
type=
"primary"
onClick=
{
this
.
onImportExcelBtnClick
}
>
Excel导入
</
Button
>
<
Button
type=
"primary"
onClick=
{
this
.
onImportWordBtnClick
}
>
Word导入
</
Button
>
<
Button
type=
"primary"
onClick=
{
this
.
onImportExcelCopyBtnClick
}
>
Excel复制粘贴
</
Button
>
<
Button
type=
"primary"
onClick=
{
this
.
onImportModelBtnClick
}
>
现有模型
</
Button
>
<
Button
type=
"primary"
onClick=
{
this
.
onImportWordBtnClick
}
>
Word导入
</
Button
>
<
Button
type=
"primary"
onClick=
{
this
.
onImportModelBtnClick
}
>
现有模型
</
Button
>
{
/* <Button type="primary" onClick={this.onImportDDLBtnClick}>DDL导入</Button> */
}
</
Space
>
{
/* <Button type="primary" onClick={this.onImportDDLBtnClick}>DDL导入</Button> */
}
</
Space
>
}
<
Space
>
<
Space
>
<
span
>
模型导出:
</
span
>
<
span
>
模型导出:
</
span
>
<
Button
type=
"primary"
onClick=
{
this
.
onExportDDLBtnClick
}
>
导出DDL
</
Button
>
<
Button
type=
"primary"
onClick=
{
this
.
onExportDDLBtnClick
}
>
导出DDL
</
Button
>
...
@@ -430,6 +453,14 @@ class Model extends React.Component {
...
@@ -430,6 +453,14 @@ class Model extends React.Component {
names=
{
selectModelerNames
}
names=
{
selectModelerNames
}
onCancel=
{
this
.
onExportDDLModalCancel
}
onCancel=
{
this
.
onExportDDLModalCancel
}
/>
/>
<
RecatalogModal
visible=
{
recatalogModalVisible
}
ids=
{
selectModelerIds
}
onCancel=
{
this
.
onRecatalogModalCancel
}
>
</
RecatalogModal
>
</
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