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
3638feac
Commit
3638feac
authored
Jun 25, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资产权限
parent
ed86c059
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
115 additions
and
64 deletions
+115
-64
App.js
src/App.js
+3
-1
assetmanage.js
src/model/assetmanage.js
+5
-0
dataassetmanager.js
src/service/dataassetmanager.js
+6
-1
AssetDetail.jsx
src/view/Manage/AssetManage/Component/AssetDetail.jsx
+94
-60
ImportAction.jsx
src/view/Manage/Model/Component/ImportAction.jsx
+1
-1
ModelTable.jsx
src/view/Manage/Model/Component/ModelTable.jsx
+6
-1
No files found.
src/App.js
View file @
3638feac
...
...
@@ -61,10 +61,11 @@ export class App extends React.Component {
const
{
setGlobalState
,
onGlobalStateChange
}
=
this
.
props
;
const
{
hostParams
}
=
this
.
state
;
let
message
=
''
,
id
=
''
,
terms
=
[];
let
message
=
''
,
id
=
''
,
terms
=
[]
,
dirId
=
''
;
if
(
hostParams
)
{
message
=
hostParams
.
message
||
''
;
id
=
hostParams
.
id
||
''
;
dirId
=
hostParams
.
dirId
||
''
;
terms
=
hostParams
.
terms
||
[];
}
...
...
@@ -92,6 +93,7 @@ export class App extends React.Component {
<
AssetDetail
reference
=
'full-search'
id
=
{
id
}
dirId
=
{
dirId
}
terms
=
{
terms
}
/
>
<
/AppContext.Provider
>
...
...
src/model/assetmanage.js
View file @
3638feac
...
...
@@ -227,4 +227,8 @@ export function* getPrivilegeByRange(payload) {
export
function
*
getPrivilegeByRangeAndDirId
(
payload
)
{
return
yield
call
(
service
.
getPrivilegeByRangeAndDirId
,
payload
);
}
export
function
*
getPreviewRangeByDirId
(
payload
)
{
return
yield
call
(
service
.
getPreviewRangeByDirId
,
payload
);
}
\ No newline at end of file
src/service/dataassetmanager.js
View file @
3638feac
import
{
PostJSON
,
GetJSON
,
PostFile
,
Post
}
from
"../util/axios"
import
{
PostJSON
,
GetJSON
,
PostFile
,
Post
,
Get
}
from
"../util/axios"
export
function
importElement
(
payload
)
{
return
PostFile
(
"/dataassetmanager/elementApi/import"
,
payload
);
...
...
@@ -234,4 +234,8 @@ export function getPrivilegeByRange(payload) {
export
function
getPrivilegeByRangeAndDirId
(
payload
)
{
return
GetJSON
(
"/dataassetmanager/AuthorityApi/listAllowButtonsByRangeAndOptionId"
,
payload
);
}
export
function
getPreviewRangeByDirId
(
payload
)
{
return
Get
(
"/dataassetmanager/dataAssetApi/getPreviewRangeByDirId"
,
payload
);
}
\ No newline at end of file
src/view/Manage/AssetManage/Component/AssetDetail.jsx
View file @
3638feac
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
React
,
{
useEffect
,
use
Memo
,
use
State
}
from
"react"
;
import
{
Spin
,
Descriptions
,
Divider
}
from
"antd"
;
import
MetadataInfo
from
'./MetadataInfo'
;
...
...
@@ -8,24 +8,72 @@ import { dispatch } from '../../../../model';
const
AssetDetail
=
(
props
)
=>
{
const
{
id
,
dirId
,
terms
,
reference
=
''
}
=
props
;
const
[
asset
,
setAsset
]
=
useState
(
''
);
const
[
asset
,
setAsset
]
=
useState
(
undefined
);
const
[
types
,
setTypes
]
=
useState
([]);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
userElements
,
setUserElements
]
=
useState
(
undefined
);
useEffect
(()
=>
{
if
((
id
||
''
)
!==
''
)
{
getUserElements
();
}
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
id
])
useEffect
(()
=>
{
if
(
dirId
)
{
getPreviewRangeByDirIdThenGetAsset
();
}
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
dirId
])
const
_asset
=
useMemo
(()
=>
{
let
newAsset
=
{};
if
(
asset
)
{
const
userElementIds
=
[];
userElements
?.
forEach
(
element
=>
{
userElementIds
.
push
(
element
?.
id
);
})
const
filterElements
=
(
asset
?.
elements
||
[]).
filter
(
element
=>
userElementIds
.
indexOf
(
element
?.
id
)
!==
-
1
);
newAsset
=
{
...
asset
,
elements
:
filterElements
}
}
return
newAsset
;
},
[
asset
,
userElements
])
const
havePreviewPermission
=
useMemo
(()
=>
{
return
((
asset
||
{}).
allowButtons
||
[]).
findIndex
(
item
=>
item
===
'preview'
)
!==
-
1
},
[
asset
])
const
getPreviewRangeByDirIdThenGetAsset
=
()
=>
{
dispatch
({
type
:
'assetmanage.getPreviewRangeByDirId'
,
payload
:
{
dirId
},
callback
:
data
=>
{
getAsset
(
data
);
}
});
}
const
getUserElements
=
()
=>
{
setLoading
(
true
);
dispatch
({
type
:
'assetmanage.listUserElements'
,
callback
:
data
=>
{
getAsset
(
data
||
[]);
setUserElements
(
data
||
[]);
const
_types
=
[];
(
data
||
[]).
forEach
(
element
=>
{
if
(
_types
.
indexOf
(
element
.
type
)
===
-
1
)
{
_types
.
push
(
element
.
type
);
}
})
setTypes
(
_types
);
},
error
:
()
=>
{
setLoading
(
false
);
...
...
@@ -33,36 +81,18 @@ const AssetDetail = (props)=>{
})
}
const
getAsset
=
(
userElements
)
=>
{
const
getAsset
=
(
range
)
=>
{
dispatch
({
type
:
'assetmanage.getDataAssetDetail'
,
payload
:
{
range
,
dataAssetId
:
id
,
dirId
:
dirId
||
''
,
checkPermission
:
true
},
callback
:
data
=>
{
setLoading
(
false
);
const
userElementIds
=
[];
(
userElements
||
[]).
forEach
(
element
=>
{
userElementIds
.
push
(
element
?.
id
);
})
const
filterElements
=
(
data
?.
elements
||
[]).
filter
(
element
=>
userElementIds
.
indexOf
(
element
?.
id
)
!==
-
1
);
data
=
{
...
data
,
elements
:
filterElements
}
setAsset
(
data
);
const
_types
=
[];
(
data
?.
elements
||
[]).
forEach
(
element
=>
{
if
(
_types
.
indexOf
(
element
.
type
)
===
-
1
)
{
_types
.
push
(
element
.
type
);
}
})
setTypes
(
_types
);
},
error
:
()
=>
{
setLoading
(
false
);
...
...
@@ -73,45 +103,49 @@ const AssetDetail = (props)=>{
return
(
<
Spin
spinning=
{
loading
}
>
{
((
dirId
||
''
)
!==
''
)
&&
<
React
.
Fragment
>
<
Descriptions
column=
{
2
}
>
<
Descriptions
.
Item
label=
'路径'
>
{
asset
.
currentPath
||
''
}
</
Descriptions
.
Item
>
</
Descriptions
>
<
Divider
style=
{
{
margin
:
'10px 0'
}
}
/>
</
React
.
Fragment
>
}
{
(
types
||
[]).
map
((
type
,
index
)
=>
{
const
_currentValues
=
(
asset
.
elements
||
[]).
filter
(
element
=>
element
.
type
===
type
);
return
(
<
div
key=
{
index
}
>
<
div
className=
'flex'
style=
{
{
alignItems
:
'center'
,
padding
:
(
reference
===
'full-search'
&&
index
===
0
)?
'0 0 15px'
:
'15px 0'
}
}
>
<
div
style=
{
{
width
:
3
,
height
:
14
,
backgroundColor
:
'#0069AC'
,
marginRight
:
5
}
}
/>
<
span
style=
{
{
fontWeight
:
'bold'
,
color
:
'#464646'
}
}
>
{
type
||
''
}
</
span
>
</
div
>
havePreviewPermission
?
<
React
.
Fragment
>
{
((
dirId
||
''
)
!==
''
)
&&
<
React
.
Fragment
>
<
Descriptions
column=
{
2
}
>
{
(
_currentValues
||
[]).
map
((
item
,
index
)
=>
{
return
(
<
Descriptions
.
Item
label=
{
item
.
name
||
''
}
key=
{
index
}
>
{
item
.
name
===
'资产项'
?
<
MetadataInfo
config=
{
false
}
value=
{
item
.
value
||
''
}
terms=
{
terms
}
/>
:
<
span
>
{
highlightSearchContentByTerms
(
item
.
value
||
''
,
terms
)
}
</
span
>
}
</
Descriptions
.
Item
>
);
})
}
<
Descriptions
.
Item
label=
'路径'
>
{
_asset
?.
currentPath
||
''
}
</
Descriptions
.
Item
>
</
Descriptions
>
<
Divider
style=
{
{
margin
:
'10px 0'
}
}
/>
</
div
>
)
})
</
React
.
Fragment
>
}
{
(
types
||
[]).
map
((
type
,
index
)
=>
{
const
_currentValues
=
(
_asset
?.
elements
||
[]).
filter
(
element
=>
element
.
type
===
type
);
return
(
<
div
key=
{
index
}
>
<
div
className=
'flex'
style=
{
{
alignItems
:
'center'
,
padding
:
(
reference
===
'full-search'
&&
index
===
0
)?
'0 0 15px'
:
'15px 0'
}
}
>
<
div
style=
{
{
width
:
3
,
height
:
14
,
backgroundColor
:
'#0069AC'
,
marginRight
:
5
}
}
/>
<
span
style=
{
{
fontWeight
:
'bold'
,
color
:
'#464646'
}
}
>
{
type
||
''
}
</
span
>
</
div
>
<
Descriptions
column=
{
2
}
>
{
(
_currentValues
||
[]).
map
((
item
,
index
)
=>
{
return
(
<
Descriptions
.
Item
label=
{
item
.
name
||
''
}
key=
{
index
}
>
{
item
.
name
===
'资产项'
?
<
MetadataInfo
config=
{
false
}
value=
{
item
.
value
||
''
}
terms=
{
terms
}
/>
:
<
span
>
{
highlightSearchContentByTerms
(
item
.
value
||
''
,
terms
)
}
</
span
>
}
</
Descriptions
.
Item
>
);
})
}
</
Descriptions
>
<
Divider
style=
{
{
margin
:
'10px 0'
}
}
/>
</
div
>
)
})
}
</
React
.
Fragment
>
:
<
div
className=
'pb-4'
>
{
loading
?
''
:
'暂无权限'
}
</
div
>
}
</
Spin
>
)
...
...
src/view/Manage/Model/Component/ImportAction.jsx
View file @
3638feac
...
...
@@ -543,7 +543,7 @@ const ImportAction = React.forwardRef((props, ref) => {
<Spin spinning={loading}>
{
(action==='detail' && ((modelerData||{}).optionList||[]).findIndex(item => item.enabled && item.name==='查看') === -1) ? <span>
暂无权限
{loading?'':'暂无权限'}
</span> : <React.Fragment>
<ImportActionHeader
form={form}
...
...
src/view/Manage/Model/Component/ModelTable.jsx
View file @
3638feac
...
...
@@ -565,7 +565,12 @@ const ModelTable = (props) => {
历史版本
</
PermissionRcItem
>
{
(
getDataModelerRole
(
user
)
!==
DataModelerRoleReader
)
&&
<
PermissionRcItem
id=
"copy"
onClick=
{
handleItemClick
}
>
(
getDataModelerRole
(
user
)
!==
DataModelerRoleReader
)
&&
<
PermissionRcItem
id=
"copy"
onClick=
{
handleItemClick
}
permissionKey=
'新增'
permissions=
{
currentItem
?.
optionList
?.
filter
(
item
=>
item
.
enabled
).
map
(
item
=>
item
.
name
)
}
>
复制模型
</
PermissionRcItem
>
}
...
...
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