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
3ef9f302
Commit
3ef9f302
authored
Jul 22, 2024
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资产人员列表
parent
9fdfdc4c
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
35 deletions
+61
-35
AssetAction.jsx
src/view/Manage/AssetManage/Component/AssetAction.jsx
+5
-3
AssetManageTree.jsx
src/view/Manage/AssetManage/Component/AssetManageTree.jsx
+8
-0
AssetTable.jsx
src/view/Manage/AssetManage/Component/AssetTable.jsx
+39
-31
AssetTree.jsx
src/view/Manage/AssetManage/Component/AssetTree.jsx
+9
-1
No files found.
src/view/Manage/AssetManage/Component/AssetAction.jsx
View file @
3ef9f302
...
...
@@ -1255,7 +1255,7 @@ const DepartmentItem = ({ loading, departments, value, onChange, multiple = fals
)
}
const UserItem = ({ loading, users, value, onChange, readonly=false, terms = [], multiple
= false }) => {
export const UserItem = ({ loading, users, value, onChange, readonly=false, terms = [], multiple = false, showTooltip
= false }) => {
const [searchValue, setSearchValue] = React.useState()
const [options, setOptions] = React.useState()
...
...
@@ -1308,9 +1308,11 @@ const UserItem = ({ loading, users, value, onChange, readonly=false, terms = [],
return
(
<
React
.
Fragment
>
{
readonly
?
<
Typography
.
Text
>
readonly
?
<
Tooltip
title=
{
showTooltip
?
userInfo
:
''
}
>
<
Typography
.
Text
ellipsis=
{
true
}
>
{
highlightSearchContentByTerms
(
userInfo
,
terms
)
}
</
Typography
.
Text
>
:
<
Select
loading=
{
loading
}
showSearch
allowClear
</
Typography
.
Text
>
</
Tooltip
>
:
<
Select
loading=
{
loading
}
showSearch
allowClear
placeholder=
'请选择用户'
mode=
{
multiple
?
'multiple'
:
null
}
value=
{
currentValue
}
...
...
src/view/Manage/AssetManage/Component/AssetManageTree.jsx
View file @
3ef9f302
...
...
@@ -141,6 +141,10 @@ const AssetManageTree = (props) => {
if
((
data
??[]).
length
>
0
)
{
setTemplateType
(
data
[
0
].
type
)
LocalStorage
.
set
(
`templateType-
${
appId
}
`
,
data
[
0
].
type
)
let
event
=
new
Event
(
'storage'
);
event
.
key
=
'assetTemplateChange'
;
window
?.
dispatchEvent
(
event
);
getAllDirectoryAsTree
(
true
)
}
},
...
...
@@ -781,6 +785,10 @@ const AssetManageTree = (props) => {
onChange=
{
(
val
)
=>
{
setTemplateType
(
val
)
LocalStorage
.
set
(
`templateType-${appId}`
,
val
);
let
event
=
new
Event
(
'storage'
);
event
.
key
=
'assetTemplateChange'
;
window
?.
dispatchEvent
(
event
);
setCurrentDirId
();
onSelect
?.(
null
,
null
);
setTimeout
(()
=>
{
...
...
src/view/Manage/AssetManage/Component/AssetTable.jsx
View file @
3ef9f302
...
...
@@ -22,6 +22,7 @@ import StartFlowModal from "./StartFlow";
import
"./AssetTable.less"
;
import
'react-contexify/dist/ReactContexify.css'
;
import
{
getTemplateType
}
from
"../../../../util/axios"
;
import
{
UserItem
}
from
"./AssetAction"
;
const
{
Text
}
=
Typography
;
const
{
Search
}
=
Input
;
...
...
@@ -170,6 +171,7 @@ const AssetTable = (props) => {
const
[
templates
,
setTemplates
]
=
useState
()
const
[
currentTemplateType
,
setTemplateType
]
=
useState
()
const
[
sorter
,
setSorter
]
=
useState
()
const
[
elements
,
setElements
]
=
useState
()
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
const
anchorId
=
getQueryParam
(
AnchorId
,
props
?.
location
?.
search
);
...
...
@@ -214,22 +216,34 @@ const AssetTable = (props) => {
}
useEffect
(()
=>
{
if
(
TableWidth
>
0
&&
columns
.
length
>
0
)
{
if
(
TableWidth
>
0
&&
columns
.
length
>
0
&&
(
elements
??[]).
length
>
0
)
{
const
newColumns
=
[...
columns
??[]];
const
currentWidth
=
(
newColumns
.
reduce
((
preVal
,
col
)
=>
(
col
.
width
?
col
.
width
:
0
)
+
preVal
,
0
))
+
32.0
;
if
(
currentWidth
<
TableWidth
)
{
newColumns
.
forEach
(
column
=>
{
if
(
currentWidth
<
TableWidth
)
{
column
.
width
=
(
TableWidth
-
32.0
)
/
newColumns
.
length
;
})
}
const
index
=
(
elements
??[]).
findIndex
(
item
=>
item
.
name
===
column
.
title
)
if
(
index
!==
-
1
)
{
const
tmp
=
(
elements
[
index
].
optional
??
''
).
split
(
','
)
if
((
tmp
??[]).
indexOf
(
'用户列表'
)
!==-
1
)
{
column
.
render
=
(
text
,
record
)
=>
{
return
<
UserItem
readonly=
{
true
}
value=
{
text
||
''
}
users=
{
users
}
multiple=
{
elements
[
index
].
selectMode
===
'多选'
}
showTooltip=
{
true
}
/>
}
}
}
})
setRealColumns
([...
newColumns
,
<
Column
key=
'auto'
/>]);
}
else
{
setRealColumns
([]);
}
},
[
columns
,
TableWidth
])
},
[
columns
,
TableWidth
,
elements
,
users
])
useEffect
(()
=>
{
getUsers
();
...
...
@@ -294,31 +308,6 @@ const AssetTable = (props) => {
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
keyword
,
pagination
,
elementsChanged
])
const
realAssets
=
useMemo
(()
=>
{
const
newAssets
=
[...
assets
];
if
(
users
?.
length
>
0
&&
assets
?.
length
>
0
&&
columns
?.
length
>
0
)
{
const
specialCol
=
[
'数据关键用户'
,
'业务数据owner'
,
'it责任人'
,
'创建人'
,
'更新人'
];
const
indexArray
=
[];
columns
.
forEach
((
item
,
index
)
=>
{
if
(
specialCol
.
indexOf
(
item
.
title
?.
toLowerCase
())
!==
-
1
)
{
indexArray
.
push
(
index
);
}
});
newAssets
?.
forEach
((
item
)
=>
{
indexArray
?.
forEach
(
index
=>
{
const
user
=
users
?.
filter
((
user
)
=>
(
user
.
pernr
===
item
[
`element
${
index
+
1
}
`
]));
if
(
user
&&
user
.
length
>
0
)
{
item
[
`element
${
index
+
1
}
`
]
=
user
[
0
].
nachn
?
`
${
user
[
0
].
nachn
}
(
${
user
[
0
].
pernr
}
)`
:
user
[
0
].
pernr
;
}
})
})
}
return
newAssets
;
},
[
users
,
assets
,
columns
])
const
storageChange
=
(
e
)
=>
{
if
(
e
.
key
===
'assetRelationOnClickEvent'
)
{
remoteRelationRef
.
current
=
e
.
relation
;
...
...
@@ -329,6 +318,8 @@ const AssetTable = (props) => {
dirId
:
e
.
dirId
};
shouldScrollRef
.
current
=
true
;
}
else
if
(
e
.
key
===
'assetTemplateChange'
)
{
getElements
()
}
}
...
...
@@ -342,6 +333,10 @@ const AssetTable = (props) => {
if
((
data
??[]).
length
>
0
)
{
setTemplateType
(
data
[
0
].
type
)
LocalStorage
.
set
(
`templateType-
${
appId
}
`
,
data
[
0
].
type
)
let
event
=
new
Event
(
'storage'
);
event
.
key
=
'assetTemplateChange'
;
window
?.
dispatchEvent
(
event
);
getFilterElementsGroupThenGetDataAssets
();
}
},
...
...
@@ -351,9 +346,18 @@ const AssetTable = (props) => {
})
}
const
getElements
=
()
=>
{
dispatch
({
type
:
'assetmanage.listElements'
,
callback
:
data
=>
{
setElements
(
data
)
}
})
}
const
getUsers
=
()
=>
{
dispatch
({
type
:
'
pds.getOwn
ers'
,
type
:
'
user.getMcclUs
ers'
,
callback
:
(
data
)
=>
{
setUsers
(
data
);
}
...
...
@@ -1045,6 +1049,10 @@ const AssetTable = (props) => {
onChange=
{
(
val
)
=>
{
setTemplateType
(
val
)
LocalStorage
.
set
(
`templateType-${appId}`
,
val
);
let
event
=
new
Event
(
'storage'
);
event
.
key
=
'assetTemplateChange'
;
window
?.
dispatchEvent
(
event
);
setPagination
({
...
pagination
,
pageNum
:
1
});
}
}
style=
{
{
width
:
100
}
}
...
...
@@ -1196,7 +1204,7 @@ const AssetTable = (props) => {
})
}
rowKey=
'id'
dataSource=
{
realA
ssets
}
dataSource=
{
a
ssets
}
pagination=
{
false
}
size=
'default'
scroll=
{
{
y
:
scrollY
}
}
...
...
src/view/Manage/AssetManage/Component/AssetTree.jsx
View file @
3ef9f302
...
...
@@ -131,6 +131,10 @@ const AssetTree = (props) => {
LocalStorage
.
set
(
`templateType-
${
appId
}
`
,
data
[
0
].
type
)
}
let
event
=
new
Event
(
'storage'
);
event
.
key
=
'assetTemplateChange'
;
window
?.
dispatchEvent
(
event
);
if
(
_dirId
)
{
getAllDirectoryAsTree
(
true
,
_dirId
)
}
else
{
...
...
@@ -580,6 +584,10 @@ const AssetTree = (props) => {
onChange=
{
(
val
)
=>
{
setTemplateType
(
val
)
LocalStorage
.
set
(
`templateType-${appId}`
,
val
);
let
event
=
new
Event
(
'storage'
);
event
.
key
=
'assetTemplateChange'
;
window
?.
dispatchEvent
(
event
);
setCurrentDirId
();
onSelect
?.(
null
,
null
);
setTimeout
(()
=>
{
...
...
@@ -587,7 +595,7 @@ const AssetTree = (props) => {
getAllDirectoryAsTree
(
true
)
},
100
)
}
}
style=
{
{
width
:
8
0
}
}
style=
{
{
width
:
10
0
}
}
>
{
(
templates
??[]).
map
((
item
,
index
)
=>
<
Select
.
Option
key=
{
index
}
value=
{
item
.
type
}
>
{
item
.
name
}
</
Select
.
Option
>)
...
...
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