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
72fa56b2
Commit
72fa56b2
authored
Apr 08, 2022
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
模型目录调整
parent
102b70bb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
75 deletions
+54
-75
AssetTagModal.jsx
src/view/Manage/AssetManage/Component/AssetTagModal.jsx
+3
-1
ModelTree.jsx
src/view/Manage/Model/Component/ModelTree.jsx
+51
-74
No files found.
src/view/Manage/AssetManage/Component/AssetTagModal.jsx
View file @
72fa56b2
...
@@ -240,7 +240,8 @@ const AssetTagModal = (props) => {
...
@@ -240,7 +240,8 @@ const AssetTagModal = (props) => {
</
Space
>
</
Space
>
}
}
>
>
<
Form
{
...
formItemLayout
}
form=
{
form
}
>
{
visible
&&
<
Form
{
...
formItemLayout
}
form=
{
form
}
>
<
AppContext
.
Consumer
>
<
AppContext
.
Consumer
>
{
{
value
=>
{
value
=>
{
...
@@ -281,6 +282,7 @@ const AssetTagModal = (props) => {
...
@@ -281,6 +282,7 @@ const AssetTagModal = (props) => {
}
}
}
}
</
AppContext
.
Consumer
>
</
AppContext
.
Consumer
>
</
Form
>
</
Form
>
}
</
Modal
>
</
Modal
>
);
);
}
}
...
...
src/view/Manage/Model/Component/ModelTree.jsx
View file @
72fa56b2
...
@@ -2,6 +2,7 @@ import React, { useState, useEffect, useRef } from "react";
...
@@ -2,6 +2,7 @@ import React, { useState, useEffect, useRef } from "react";
import
{
Tooltip
,
Tree
,
Modal
,
Spin
,
Dropdown
,
Menu
,
Button
}
from
"antd"
;
import
{
Tooltip
,
Tree
,
Modal
,
Spin
,
Dropdown
,
Menu
,
Button
}
from
"antd"
;
import
{
PlusOutlined
,
EditOutlined
,
SyncOutlined
,
DeleteOutlined
,
ImportOutlined
,
UnorderedListOutlined
,
ReloadOutlined
,
ArrowUpOutlined
,
ArrowDownOutlined
}
from
'@ant-design/icons'
;
import
{
PlusOutlined
,
EditOutlined
,
SyncOutlined
,
DeleteOutlined
,
ImportOutlined
,
UnorderedListOutlined
,
ReloadOutlined
,
ArrowUpOutlined
,
ArrowDownOutlined
}
from
'@ant-design/icons'
;
import
classnames
from
'classnames'
;
import
classnames
from
'classnames'
;
import
{
useContextMenu
,
Menu
as
RcMenu
,
Item
as
RcItem
}
from
"react-contexify"
;
import
UpdateTreeItemModal
from
'./UpdateTreeItemModal'
;
import
UpdateTreeItemModal
from
'./UpdateTreeItemModal'
;
import
{
dispatch
}
from
'../../../../model'
;
import
{
dispatch
}
from
'../../../../model'
;
...
@@ -9,6 +10,7 @@ import { showMessage, getQueryParam } from '../../../../util';
...
@@ -9,6 +10,7 @@ import { showMessage, getQueryParam } from '../../../../util';
import
{
AnchorId
,
AnchorTimestamp
}
from
'../../../../util/constant'
;
import
{
AnchorId
,
AnchorTimestamp
}
from
'../../../../util/constant'
;
import
'./ModelTree.less'
;
import
'./ModelTree.less'
;
import
'react-contexify/dist/ReactContexify.css'
;
const
viewModes
=
[
const
viewModes
=
[
{
{
...
@@ -23,6 +25,12 @@ const viewModes = [
...
@@ -23,6 +25,12 @@ const viewModes = [
const
ModelTree
=
(
props
)
=>
{
const
ModelTree
=
(
props
)
=>
{
const
MENU_ID
=
'model-tree'
;
const
{
show
}
=
useContextMenu
({
id
:
MENU_ID
,
});
const
{
onSelect
,
onViewChange
,
refrence
=
''
,
importStockModel
,
keyword
}
=
props
;
const
{
onSelect
,
onViewChange
,
refrence
=
''
,
importStockModel
,
keyword
}
=
props
;
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
treeData
,
setTreeData
]
=
useState
(
null
);
const
[
treeData
,
setTreeData
]
=
useState
(
null
);
...
@@ -37,15 +45,13 @@ const ModelTree = (props) => {
...
@@ -37,15 +45,13 @@ const ModelTree = (props) => {
const
[
isSetRootId
,
setIsSetRootId
]
=
useState
(
true
);
const
[
isSetRootId
,
setIsSetRootId
]
=
useState
(
true
);
const
[
domains
,
setDomains
]
=
useState
([]);
const
[
domains
,
setDomains
]
=
useState
([]);
const
[
domainSelectedKey
,
setDomainSelectedKey
]
=
useState
(
''
);
const
[
domainSelectedKey
,
setDomainSelectedKey
]
=
useState
(
''
);
const
[
currentRightClickDir
,
setCurrentRightClickDir
]
=
useState
({});
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
();
itemRef
.
current
=
null
;
useEffect
(()
=>
{
useEffect
(()
=>
{
getShowSyncAndDomains
();
getShowSyncAndDomains
();
//eslint-disable-next-line react-hooks/exhaustive-deps
//eslint-disable-next-line react-hooks/exhaustive-deps
...
@@ -179,16 +185,9 @@ const ModelTree = (props) => {
...
@@ -179,16 +185,9 @@ const ModelTree = (props) => {
}
else
if
(
refrence
===
''
)
{
}
else
if
(
refrence
===
''
)
{
let
currentItem
=
itemRef
.
current
;
const
currentItem
=
(
data
.
subCatalogs
||
[]).
length
>
0
?
data
.
subCatalogs
[
0
]:
null
;
if
(
currentItem
===
null
)
{
currentItem
=
(
data
.
subCatalogs
||
[]).
length
>
0
?
data
.
subCatalogs
[
0
]:
null
;
setItem
(
currentItem
);
setItem
(
currentItem
);
}
itemRef
.
current
=
currentItem
;
onSelect
&&
onSelect
(
currentItem
?(
currentItem
.
key
||
''
):
''
);
onSelect
&&
onSelect
(
currentItem
?(
currentItem
.
key
||
''
):
''
);
}
}
...
@@ -256,7 +255,6 @@ const ModelTree = (props) => {
...
@@ -256,7 +255,6 @@ const ModelTree = (props) => {
if
(
viewSelectedKey
&&
viewSelectedKey
===
key
)
return
;
if
(
viewSelectedKey
&&
viewSelectedKey
===
key
)
return
;
itemRef
.
current
=
null
;
setViewSelectedKey
(
key
);
setViewSelectedKey
(
key
);
onViewChange
&&
onViewChange
(
key
);
onViewChange
&&
onViewChange
(
key
);
...
@@ -303,12 +301,6 @@ const ModelTree = (props) => {
...
@@ -303,12 +301,6 @@ const ModelTree = (props) => {
}
}
const
update
=
()
=>
{
const
update
=
()
=>
{
if
(
!
item
)
{
showMessage
(
'info'
,
'请先选择目录'
);
return
;
}
setVisible
(
true
);
setVisible
(
true
);
setType
(
'update'
);
setType
(
'update'
);
}
}
...
@@ -326,22 +318,16 @@ const ModelTree = (props) => {
...
@@ -326,22 +318,16 @@ const ModelTree = (props) => {
}
}
const
moveNode
=
(
steps
)
=>
{
const
moveNode
=
(
steps
)
=>
{
if
(
!
item
)
{
showMessage
(
'info'
,
'请先选择目录'
);
return
;
}
setLoading
(
true
);
setLoading
(
true
);
dispatch
({
dispatch
({
type
:
'datamodel.upDownModelCatalog'
,
type
:
'datamodel.upDownModelCatalog'
,
payload
:
{
payload
:
{
modelCatalogId
:
item
.
id
,
modelCatalogId
:
currentRightClickDir
.
id
,
steps
steps
},
},
callback
:
()
=>
{
callback
:
()
=>
{
showMessage
(
'success'
,
(
steps
===-
1
)?
'上移目录成功'
:
'下移目录成功'
);
showMessage
(
'success'
,
(
steps
===-
1
)?
'上移目录成功'
:
'下移目录成功'
);
setItem
(
null
);
getDirTreeData
(
item
.
id
);
getDirTreeData
(
item
.
key
);
},
},
error
:
()
=>
{
error
:
()
=>
{
setLoading
(
false
);
setLoading
(
false
);
...
@@ -350,11 +336,6 @@ const ModelTree = (props) => {
...
@@ -350,11 +336,6 @@ const ModelTree = (props) => {
}
}
const
deleteNode
=
()
=>
{
const
deleteNode
=
()
=>
{
if
(
!
item
)
{
showMessage
(
'info'
,
'请先选择目录'
);
return
;
}
modal
.
confirm
({
modal
.
confirm
({
title
:
'提示!'
,
title
:
'提示!'
,
content
:
'删除目录会删除相关的模型,您确定删除吗?'
,
content
:
'删除目录会删除相关的模型,您确定删除吗?'
,
...
@@ -364,14 +345,17 @@ const ModelTree = (props) => {
...
@@ -364,14 +345,17 @@ const ModelTree = (props) => {
type
:
'datamodel.deleteDataModelCatalog'
,
type
:
'datamodel.deleteDataModelCatalog'
,
payload
:
{
payload
:
{
params
:
{
params
:
{
easyDataModelerCatalogId
:
item
.
id
easyDataModelerCatalogId
:
currentRightClickDir
.
id
}
}
},
},
callback
:
()
=>
{
callback
:
()
=>
{
showMessage
(
'success'
,
'删除目录成功'
);
showMessage
(
'success'
,
'删除目录成功'
);
setItem
(
null
);
i
temRef
.
current
=
null
;
i
f
(
item
&&
currentRightClickDir
&&
item
.
id
===
currentRightClickDir
.
id
)
{
getDirTreeData
();
getDirTreeData
();
}
else
{
getDirTreeData
(
item
.
id
);
}
},
},
error
:
()
=>
{
error
:
()
=>
{
setLoading
(
false
);
setLoading
(
false
);
...
@@ -384,20 +368,22 @@ const ModelTree = (props) => {
...
@@ -384,20 +368,22 @@ const ModelTree = (props) => {
const
onUpdateTreeItemModalOk
=
(
id
,
updateItem
)
=>
{
const
onUpdateTreeItemModalOk
=
(
id
,
updateItem
)
=>
{
setVisible
(
false
);
setVisible
(
false
);
if
(
type
===
'add'
)
{
getDirTreeData
(
id
);
}
else
{
setItem
(
updateItem
);
itemRef
.
current
=
updateItem
;
getDirTreeData
(
id
);
getDirTreeData
(
id
);
}
}
}
const
onUpdateTreeItemModalCancel
=
()
=>
{
const
onUpdateTreeItemModalCancel
=
()
=>
{
setVisible
(
false
);
setVisible
(
false
);
}
}
const
displayMenu
=
(
e
)
=>
{
show
(
e
,
{
position
:
{
x
:
e
.
clientX
+
30
,
y
:
e
.
clientY
-
10
}
});
}
const
exportMenu
=
(
const
exportMenu
=
(
<
Menu
selectedKeys=
{
[
viewSelectedKey
]
}
onClick=
{
onViewClick
}
>
<
Menu
selectedKeys=
{
[
viewSelectedKey
]
}
onClick=
{
onViewClick
}
>
{
{
...
@@ -439,7 +425,8 @@ const ModelTree = (props) => {
...
@@ -439,7 +425,8 @@ const ModelTree = (props) => {
display
:
'flex'
,
display
:
'flex'
,
borderBottom
:
"1px solid #EFEFEF"
,
borderBottom
:
"1px solid #EFEFEF"
,
height
:
57
,
height
:
57
,
alignItems
:
'center'
alignItems
:
'center'
,
justifyContent
:
(
viewSelectedKey
===
'dir'
)?
'space-between'
:
''
,
}
}
}
}
>
>
<
Dropdown
overlay=
{
exportMenu
}
placement=
"bottomLeft"
>
<
Dropdown
overlay=
{
exportMenu
}
placement=
"bottomLeft"
>
...
@@ -457,13 +444,6 @@ const ModelTree = (props) => {
...
@@ -457,13 +444,6 @@ const ModelTree = (props) => {
}
}
{
{
viewSelectedKey
===
'dir'
&&
(
viewSelectedKey
===
'dir'
&&
(
<
Tooltip
title=
"修改目录"
className=
'ml-2'
>
<
EditOutlined
className=
'default'
onClick=
{
update
}
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
</
Tooltip
>
)
}
{
viewSelectedKey
===
'dir'
&&
(
<
Tooltip
title=
"存量模型导入"
className=
'ml-2'
>
<
Tooltip
title=
"存量模型导入"
className=
'ml-2'
>
<
ImportOutlined
className=
'default'
onClick=
{
()
=>
{
importStockModel
&&
importStockModel
()
}
}
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
<
ImportOutlined
className=
'default'
onClick=
{
()
=>
{
importStockModel
&&
importStockModel
()
}
}
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
</
Tooltip
>
</
Tooltip
>
...
@@ -491,30 +471,6 @@ const ModelTree = (props) => {
...
@@ -491,30 +471,6 @@ const ModelTree = (props) => {
</
Tooltip
>
</
Tooltip
>
)
)
}
}
{
viewSelectedKey
===
'dir'
&&
(
<
Tooltip
title=
"上移目录"
className=
'ml-2'
>
<
ArrowUpOutlined
className=
'default'
onClick=
{
()
=>
{
moveNode
(
-
1
);
}
}
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
</
Tooltip
>
)
}
{
viewSelectedKey
===
'dir'
&&
(
<
Tooltip
title=
"下移目录"
className=
'ml-2'
>
<
ArrowDownOutlined
className=
'default'
onClick=
{
()
=>
{
moveNode
(
1
);
}
}
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
</
Tooltip
>
)
}
{
viewSelectedKey
===
'dir'
&&
(
<
Tooltip
title=
"删除目录"
className=
'ml-2'
>
<
DeleteOutlined
className=
'default'
onClick=
{
deleteNode
}
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
</
Tooltip
>
)
}
</
div
>
</
div
>
}
}
<
div
className=
'p-3'
>
<
div
className=
'p-3'
>
...
@@ -531,17 +487,38 @@ const ModelTree = (props) => {
...
@@ -531,17 +487,38 @@ const ModelTree = (props) => {
titleRender=
{
(
nodeData
)
=>
{
titleRender=
{
(
nodeData
)
=>
{
return
<
span
title=
{
nodeData
?.
remark
||
''
}
>
{
nodeData
?.
name
||
''
}
</
span
>;
return
<
span
title=
{
nodeData
?.
remark
||
''
}
>
{
nodeData
?.
name
||
''
}
</
span
>;
}
}
}
}
onRightClick=
{
({
event
,
node
})
=>
{
if
(
viewSelectedKey
===
'dir'
)
{
setCurrentRightClickDir
(
node
);
displayMenu
(
event
);
}
}
}
/>
/>
</
Spin
>
</
Spin
>
</
div
>
</
div
>
<
UpdateTreeItemModal
<
UpdateTreeItemModal
visible=
{
visible
}
visible=
{
visible
}
type=
{
type
}
type=
{
type
}
item=
{
item
}
item=
{
(
type
===
'add'
)?
item
:
currentRightClickDir
}
rootId=
{
rootId
}
rootId=
{
rootId
}
onOk=
{
onUpdateTreeItemModalOk
}
onOk=
{
onUpdateTreeItemModalOk
}
onCancel=
{
onUpdateTreeItemModalCancel
}
onCancel=
{
onUpdateTreeItemModalCancel
}
/>
/>
<
RcMenu
id=
{
MENU_ID
}
>
<
RcItem
id=
"edit"
onClick=
{
update
}
>
修改目录
</
RcItem
>
<
RcItem
id=
"up"
onClick=
{
()
=>
{
moveNode
(
-
1
);
}
}
>
上移目录
</
RcItem
>
<
RcItem
id=
"down"
onClick=
{
()
=>
{
moveNode
(
1
);
}
}
>
下移目录
</
RcItem
>
<
RcItem
id=
"delete"
onClick=
{
deleteNode
}
>
删除目录
</
RcItem
>
</
RcMenu
>
{
contextHolder
}
{
contextHolder
}
</
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