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
8f0a0408
Commit
8f0a0408
authored
Dec 07, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
草稿详情差异对比
parent
f1cc21d5
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
87 additions
and
19 deletions
+87
-19
index.jsx
src/view/Manage/AssetDraft/index.jsx
+3
-0
AssetAction.jsx
src/view/Manage/AssetManage/Component/AssetAction.jsx
+58
-12
IndexCode.jsx
src/view/Manage/AssetManage/Component/IndexCode.jsx
+6
-2
SelectUsers.jsx
src/view/Manage/Model/Component/SelectUsers.jsx
+20
-5
No files found.
src/view/Manage/AssetDraft/index.jsx
View file @
8f0a0408
...
...
@@ -33,6 +33,7 @@ const FC = (props) => {
const
[
updateAssetParams
,
setUpdateAssetParams
]
=
React
.
useState
({
visible
:
false
,
id
:
undefined
,
dirId
:
undefined
,
})
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
...
...
@@ -340,6 +341,7 @@ const FC = (props) => {
setUpdateAssetParams({
visible: true,
id: record?.id,
dirId: record?.dirId,
})
}
}
...
...
@@ -374,6 +376,7 @@ const FC = (props) => {
setUpdateAssetParams({
visible: false,
id: undefined,
dirId: undefined,
})
refresh && getDrafts()
...
...
src/view/Manage/AssetManage/Component/AssetAction.jsx
View file @
8f0a0408
...
...
@@ -65,6 +65,7 @@ const AssetAction = (props) => {
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
const
[
permissions
,
setPermissions
]
=
useState
(
undefined
);
const
[
keyword
,
setKeyword
]
=
useState
(
''
);
const
[
publishedAsset
,
setPublishedAsset
]
=
useState
();
const
app
=
useContext
(
AppContext
);
const
uploadRef
=
useRef
(
undefined
);
...
...
@@ -226,6 +227,7 @@ const AssetAction = (props) => {
}
getAsset
();
}
else
{
setMetadataId
(
''
);
setAssetParams
({...
assetParams
,
...{
assets
:
{},
attributes
:
[]}});
...
...
@@ -412,6 +414,10 @@ const AssetAction = (props) => {
callback
:
data
=>
{
setLoading
(
false
);
if
(
reference
===
AssetDraftReference
&&
data
?.
dataAssetId
&&
(
data
?.
dirIds
??[]).
length
>
0
)
{
getPublishedAsset
(
data
?.
dataAssetId
,
data
?.
dirIds
[
0
])
}
const
metadataIndex
=
data
?.
elements
?.
findIndex
(
item
=>
item
.
name
===
'资产项'
);
if
(
metadataIndex
!==
-
1
)
{
...
...
@@ -456,6 +462,20 @@ const AssetAction = (props) => {
})
}
const
getPublishedAsset
=
(
id
,
dirId
)
=>
{
dispatch
({
type
:
'assetmanage.getDataAssetDetail'
,
payload
:
{
dataAssetId
:
id
,
dirId
:
dirId
,
checkPermission
:
false
},
callback
:
data
=>
{
setPublishedAsset
(
data
)
}
})
}
const
getMetadataAttributes
=
()
=>
{
setMetadata
(
prevMetadata
=>
{
const
ids
=
prevMetadata
?.
columnItems
.
map
(
item
=>
item
.
metadataColumnId
);
...
...
@@ -595,6 +615,27 @@ const AssetAction = (props) => {
setConfirmLoading(true);
if (reference === AssetDraftReference) {
dispatch({
type: 'assetmanage.updateDraft',
payload: {
params: {
isAdmin: true,
},
data: action==='add' ? { elements: newElements } : { ...assets, elements: newElements }
},
callback: () => {
setConfirmLoading(false);
setCurrentAction('detail');
getAsset();
showMessage("success",(action==='add')?"新增成功":"修改成功");
onChange && onChange();
},
error: () => {
setConfirmLoading(false);
}
})
} else {
dispatch({
type: 'assetmanage.checkCodeIsExist',
payload: {
...
...
@@ -612,13 +653,6 @@ const AssetAction = (props) => {
operation: 'change',
}
if (reference === AssetDraftReference) {
url = 'assetmanage.updateDraft'
params = {
isAdmin: true,
}
}
dispatch({
type: url,
payload: {
...
...
@@ -642,7 +676,7 @@ const AssetAction = (props) => {
setConfirmLoading(false);
}
})
}
} catch (errInfo) {
console.log('Validate Failed:', errInfo);
showMessage('warn', '请完成资产必填项')
...
...
@@ -795,13 +829,13 @@ const AssetAction = (props) => {
return <Input disabled={element.manualMaintain==='否'} />;
}
const elementDetailComponent = (item) => {
const elementDetailComponent = (item
, publishedItem
) => {
if (item.name === '资产项') {
return <MetadataInfo config={false} value={item.value||''} terms={terms} />;
}
if (item.name === '指标标准编码') {
return <IndexCode value={item.value||''} terms={terms} />;
return <IndexCode value={item.value||''} terms={terms}
publishedValue={publishedItem?.value}
/>;
}
if (item.name==='数据关键用户' || item.name?.toLowerCase()==='业务数据owner' || item.name?.toLowerCase()==='it责任人' || item.name==='创建人' || item.name==='更新人') {
...
...
@@ -810,10 +844,16 @@ const AssetAction = (props) => {
users={users}
terms={terms}
value={item.value||''}
publishedValue={publishedItem?.value}
/>
}
return <span className='text-color'>{highlightSearchContentByTerms(item.value||'', terms)}</span>;
return <span>
<Typography.Text>{highlightSearchContentByTerms(item.value||'', terms)}</Typography.Text>
{
publishedItem?.value && publishedItem?.value!==item.value && <Typography.Text className='ml-2' type='danger'><del>{publishedItem?.value}</del></Typography.Text>
}
</span>;
}
const onExportClick = () => {
...
...
@@ -957,6 +997,12 @@ const AssetAction = (props) => {
elements?.map((element, index) => {
if (element.type!==attribute || element.name === '资产项') return null;
const _index = (publishedAsset?.elements??[]).findIndex(item => item.name===element.name)
let publishedElement = null;
if (_index !== -1) {
publishedElement = publishedAsset?.elements[_index];
}
return (
<Descriptions.Item
key={index}
...
...
@@ -994,7 +1040,7 @@ const AssetAction = (props) => {
: <React.Fragment>
<Row gutter={8} align='middle'>
<Col span={22}>
{ elementDetailComponent(element) }
{ elementDetailComponent(element
, publishedElement
) }
</Col>
{
element.interpretation && <Col span={2}>
...
...
src/view/Manage/AssetManage/Component/IndexCode.jsx
View file @
8f0a0408
import
React
from
'react'
;
import
{
Typography
}
from
'antd'
;
import
{
highlightSearchContentByTerms
}
from
'../../../../util'
;
import
{
AppContext
}
from
'../../../../App'
;
const
FC
=
({
value
=
''
,
terms
=
[]
})
=>
{
const
FC
=
({
value
=
''
,
terms
=
[]
,
publishedValue
=
''
})
=>
{
return
(
<
AppContext
.
Consumer
>
{
...
...
@@ -13,7 +14,10 @@ const FC = ({ value = '', terms = [] }) => {
data
:
{
name
:
value
}
})
}
}
>
<
span
>
{
highlightSearchContentByTerms
(
value
,
terms
)
}
</
span
>
<
Typography
.
Text
>
{
highlightSearchContentByTerms
(
value
,
terms
)
}
</
Typography
.
Text
>
{
publishedValue
&&
(
publishedValue
!==
value
)
&&
<
Typography
.
Text
className=
'ml-2'
type=
'danger'
><
del
>
{
publishedValue
}
</
del
></
Typography
.
Text
>
}
</
a
>
}
</
AppContext
.
Consumer
>
...
...
src/view/Manage/Model/Component/SelectUsers.jsx
View file @
8f0a0408
import
React
,
{
useState
,
useMemo
,
useEffect
}
from
"react"
import
{
Select
}
from
"antd"
import
{
Select
,
Typography
}
from
"antd"
import
debounce
from
'lodash/debounce'
;
import
{
highlightSearchContentByTerms
}
from
'../../../../util'
;
...
...
@@ -8,7 +8,7 @@ const {Option} = Select
const
SelectUser
:
React
.
FC
=
(
props
)
=>
{
const
{
value
,
onChange
,
users
,
type
,
loading
,
terms
}
=
props
const
{
value
,
onChange
,
users
,
type
,
loading
,
terms
,
publishedValue
}
=
props
const
[
searchValue
,
setSearchValue
]
=
useState
(
undefined
)
...
...
@@ -53,10 +53,25 @@ const SelectUser:React.FC=(props)=>{
)
}
else
if
(
type
===
'detail'
){
try
{
const
user
=
users
?.
filter
((
item
)
=>
(
item
.
pernr
===
value
))
return
highlightSearchContentByTerms
(
`
${
user
[
0
].
nachn
}
(
${
user
[
0
].
pernr
}
)`
,
terms
);
const
user
=
(
users
??[]).
filter
((
item
)
=>
(
item
.
pernr
===
value
))
let
publishedUser
=
null
;
if
(
publishedValue
&&
publishedValue
!==
value
)
{
publishedUser
=
(
users
??[]).
filter
((
item
)
=>
(
item
.
pernr
===
publishedValue
))
}
return
<
span
>
<
Typography
.
Text
>
{
highlightSearchContentByTerms
(
`${user[0].nachn}(${user[0].pernr})`
,
terms
)
}
</
Typography
.
Text
>
{
publishedUser
&&
<
Typography
.
Text
className=
'ml-2'
type=
'danger'
><
del
>
{
`${publishedUser[0].nachn}(${publishedUser[0].pernr})`
}
</
del
></
Typography
.
Text
>
}
</
span
>;
}
catch
(
error
)
{
return
highlightSearchContentByTerms
(
value
,
terms
)
return
<
span
>
<
Typography
.
Text
>
{
highlightSearchContentByTerms
(
value
,
terms
)
}
</
Typography
.
Text
>
{
publishedValue
&&
publishedValue
!==
value
&&
<
Typography
.
Text
className=
'ml-2'
type=
'danger'
><
del
>
{
publishedValue
}
</
del
></
Typography
.
Text
>
}
</
span
>
}
}
else
{
return
null
...
...
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