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
8213b630
Commit
8213b630
authored
Jul 12, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
存量模型导入权限控制
parent
e7d85537
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
13 deletions
+31
-13
ModelTree.jsx
src/view/Manage/Model/Component/ModelTree.jsx
+31
-13
No files found.
src/view/Manage/Model/Component/ModelTree.jsx
View file @
8213b630
import
React
,
{
useState
,
useEffect
,
useContext
}
from
"react"
;
import
React
,
{
useState
,
useEffect
,
useContext
,
useMemo
}
from
"react"
;
import
{
Tooltip
,
Tree
,
Modal
,
Spin
,
Dropdown
,
Menu
,
Button
,
AutoComplete
}
from
"antd"
;
import
{
Tooltip
,
Tree
,
Modal
,
Spin
,
Dropdown
,
Menu
,
Button
,
AutoComplete
}
from
"antd"
;
import
{
PlusOutlined
,
SyncOutlined
,
ImportOutlined
,
UnorderedListOutlined
,
ReloadOutlined
}
from
'@ant-design/icons'
;
import
{
PlusOutlined
,
SyncOutlined
,
ImportOutlined
,
UnorderedListOutlined
,
ReloadOutlined
}
from
'@ant-design/icons'
;
import
classnames
from
'classnames'
;
import
classnames
from
'classnames'
;
...
@@ -107,6 +107,10 @@ const ModelTree = (props) => {
...
@@ -107,6 +107,10 @@ const ModelTree = (props) => {
//eslint-disable-next-line react-hooks/exhaustive-deps
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
keyword
])
},
[
keyword
])
const
haveStockImportPermission
=
useMemo
(()
=>
{
return
(
item
?.
optionList
||
[]).
findIndex
(
option
=>
option
.
name
===
'存量模型导入'
&&
option
.
enabled
)
!==
-
1
},
[
item
])
const
getShowSyncAndDomains
=
()
=>
{
const
getShowSyncAndDomains
=
()
=>
{
dispatch
({
dispatch
({
type
:
'datamodel.isSetRootDomainId'
,
type
:
'datamodel.isSetRootDomainId'
,
...
@@ -517,7 +521,7 @@ const ModelTree = (props) => {
...
@@ -517,7 +521,7 @@ const ModelTree = (props) => {
borderBottom
:
"1px solid #EFEFEF"
,
borderBottom
:
"1px solid #EFEFEF"
,
height
:
57
,
height
:
57
,
alignItems
:
'center'
,
alignItems
:
'center'
,
justifyContent
:
(
viewSelectedKey
===
'dir'
&&
isAdmin
)?
'space-between'
:
'
'
,
justifyContent
:
'space-between
'
,
}
}
}
}
>
>
<
Dropdown
overlay=
{
exportMenu
}
placement=
"bottomLeft"
>
<
Dropdown
overlay=
{
exportMenu
}
placement=
"bottomLeft"
>
...
@@ -528,28 +532,28 @@ const ModelTree = (props) => {
...
@@ -528,28 +532,28 @@ const ModelTree = (props) => {
{
{
(
viewSelectedKey
===
'dir'
&&
isAdmin
)
&&
(
(
viewSelectedKey
===
'dir'
&&
isAdmin
)
&&
(
<
Tooltip
title=
"新增目录"
className=
'ml-2'
>
<
Tooltip
title=
"新增目录"
>
<
PlusOutlined
className=
'default'
onClick=
{
add
}
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
<
PlusOutlined
className=
'default'
onClick=
{
add
}
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
</
Tooltip
>
</
Tooltip
>
)
)
}
}
{
{
(
viewSelectedKey
===
'dir'
&&
isAdmin
)
&&
(
(
viewSelectedKey
===
'dir'
)
&&
(
<
Tooltip
title=
"存量模型导入"
className=
'ml-2'
>
<
Tooltip
title=
{
haveStockImportPermission
?
'存量模型导入'
:
'暂无权限'
}
>
<
ImportOutlined
className=
'default'
onClick=
{
()
=>
{
importStockModel
&&
importStockModel
()
}
}
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
<
ImportOutlined
className=
{
(
!
haveStockImportPermission
)?
'disable'
:
'default'
}
onClick=
{
()
=>
{
haveStockImportPermission
&&
importStockModel
&&
importStockModel
()
}
}
style=
{
{
fontSize
:
16
,
cursor
:(
!
haveStockImportPermission
)?
'not-allowed'
:
'pointer'
}
}
/>
</
Tooltip
>
</
Tooltip
>
)
)
}
}
<
Tooltip
title=
"刷新目录"
className=
'ml-2'
>
<
Tooltip
title=
"刷新目录"
>
<
Button
type=
'text'
icon=
{
<
ReloadOutlined
className=
'default'
/>
}
size=
'small'
onClick=
{
refresh
}
/>
<
ReloadOutlined
className=
'default'
onClick=
{
refrence
}
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
</
Tooltip
>
</
Tooltip
>
{
{
(
viewSelectedKey
===
'dir'
&&
isAdmin
)
&&
!
isSetRootId
&&
(
(
viewSelectedKey
===
'dir'
&&
isAdmin
)
&&
!
isSetRootId
&&
(
<
Dropdown
overlay=
{
syncMenu
}
placement=
"bottomLeft"
>
<
Dropdown
overlay=
{
syncMenu
}
placement=
"bottomLeft"
>
<
Tooltip
title=
"同步目录"
>
<
Tooltip
title=
"同步目录"
>
<
SyncOutlined
className=
'default
ml-2
'
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
<
SyncOutlined
className=
'default'
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
</
Tooltip
>
</
Tooltip
>
</
Dropdown
>
</
Dropdown
>
)
)
...
@@ -557,11 +561,25 @@ const ModelTree = (props) => {
...
@@ -557,11 +561,25 @@ const ModelTree = (props) => {
{
{
(
viewSelectedKey
===
'dir'
&&
isAdmin
)
&&
isSetRootId
&&
(
(
viewSelectedKey
===
'dir'
&&
isAdmin
)
&&
isSetRootId
&&
(
<
Tooltip
title=
"同步目录"
className=
'ml-2'
>
<
Tooltip
title=
"同步目录"
className=
'ml-2'
>
<
Button
type=
'text'
icon=
{
<
SyncOutlined
className=
'default'
/>
}
size=
'small'
onClick=
{
sync
}
/>
<
SyncOutlined
className=
'default'
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
onClick=
{
sync
}
/>
</
Tooltip
>
</
Tooltip
>
)
)
}
}
{
(
viewSelectedKey
===
'dir'
&&
!
isAdmin
)
&&
<
React
.
Fragment
>
<
div
style=
{
{
width
:
16
}
}
></
div
>
<
div
style=
{
{
width
:
16
}
}
></
div
>
</
React
.
Fragment
>
}
{
(
viewSelectedKey
!==
'dir'
)
&&
<
React
.
Fragment
>
<
div
style=
{
{
width
:
16
}
}
></
div
>
<
div
style=
{
{
width
:
16
}
}
></
div
>
<
div
style=
{
{
width
:
16
}
}
></
div
>
</
React
.
Fragment
>
}
</
div
>
</
div
>
}
}
<
div
className=
'p-3'
>
<
div
className=
'p-3'
>
...
...
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