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
cd6a21e3
Commit
cd6a21e3
authored
Sep 12, 2024
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资产非结构化模板字段动态显示
parent
4fd612c1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
85 additions
and
63 deletions
+85
-63
assetmanage.js
src/model/assetmanage.js
+4
-0
dataassetmanager.js
src/service/dataassetmanager.js
+4
-0
AssetAction.jsx
src/view/Manage/AssetManage/Component/AssetAction.jsx
+77
-63
No files found.
src/model/assetmanage.js
View file @
cd6a21e3
...
...
@@ -190,6 +190,10 @@ export function* loadDataAssets(payload) {
return
yield
call
(
service
.
loadDataAssets
,
payload
);
}
export
function
*
listBusinessColumnElements
(
payload
)
{
return
yield
call
(
service
.
listBusinessColumnElements
,
payload
)
}
export
function
*
listDraftStates
()
{
return
yield
call
(
service
.
listDraftStates
)
}
...
...
src/service/dataassetmanager.js
View file @
cd6a21e3
...
...
@@ -92,6 +92,10 @@ export function loadDataAssets(payload) {
return
PostJSON
(
"/dataassetmanager/dataAssetApi/loadDataAssets"
,
payload
);
}
export
function
listBusinessColumnElements
(
payload
)
{
return
GetJSON
(
"/dataassetmanager/elementApi/listBusinessColumnElements"
,
payload
);
}
export
function
listDraftStates
()
{
return
GetJSON
(
"/dataassetmanager/draftApi/listDraftStates"
)
}
...
...
src/view/Manage/AssetManage/Component/AssetAction.jsx
View file @
cd6a21e3
...
...
@@ -11,7 +11,7 @@ import { highlightSearchContentByTerms, showMessage, paginate, isPostAsset } fro
import
{
AppContext
,
appId
}
from
'../../../../App'
;
import
Tag
from
'../../Tag'
;
import
Separate
from
'./Separate'
;
import
{
AnchorId
,
AnchorDirId
,
AssetManageReference
,
AssetRecycleReference
,
AssetDraftReference
}
from
'../../../../util/constant'
;
import
{
AnchorId
,
AnchorDirId
,
AssetManageReference
,
AssetRecycleReference
,
AssetDraftReference
,
Action
}
from
'../../../../util/constant'
;
import
IndexCode
from
'./IndexCode'
;
import
Upload
from
'./Upload'
;
import
Table
from
'../../ResizeableTable'
;
...
...
@@ -64,6 +64,8 @@ const AssetAction = React.forwardRef(function (props, ref) {
const
[
publishedAssetPaths
,
setPublishedAssetPaths
]
=
useState
([]);
const
[
publishedAsset
,
setPublishedAsset
]
=
useState
();
const
[
isStructured
,
setStructured
]
=
useState
();
const
[
businessElements
,
setBusinessElements
]
=
useState
();
const
[
businessColumns
,
setBusinessColumns
]
=
useState
();
const
[
loadingSaveAsDraft
,
setLoadingSaveAsDraft
]
=
React
.
useState
(
false
)
const
[
needSaveAsDraft
,
setNeedSaveAsDraft
]
=
React
.
useState
()
...
...
@@ -141,64 +143,6 @@ const AssetAction = React.forwardRef(function (props, ref) {
},
];
const
businessColumns
=
[
{
title
:
<
span
>
<
span
style=
{
{
marginRight
:
4
,
color
:
'#ff4d4f'
,
}
}
>
*
</
span
>
英文名称
</
span
>,
dataIndex
:
'enName'
,
ellipsis
:
true
,
render
:
(
text
,
record
,
index
)
=>
{
columnForm
?.
setFieldsValue
({
[
`column
${
index
}
`
]:
text
})
return
(
<
Form
.
Item
name=
{
`column${index}`
}
rules=
{
[{
required
:
true
,
message
:
'请填写英文名称!'
}]
}
style=
{
{
marginBottom
:
0
}
}
>
<
MetadataColumnEditableItem
value=
{
text
}
isEdit=
{
currentAction
!==
'detail'
}
terms=
{
terms
}
onChange=
{
(
e
)
=>
{
onMetadataColumnEditableItemChange
(
e
.
target
.
value
,
'enName'
,
index
)
}
}
/>
</
Form
.
Item
>
)
}
},
{
title
:
'中文名称'
,
dataIndex
:
'cnName'
,
ellipsis
:
true
,
render
:
(
text
,
_
,
index
)
=>
<
MetadataColumnEditableItem
value=
{
text
}
isEdit=
{
currentAction
!==
'detail'
}
terms=
{
terms
}
onChange=
{
(
e
)
=>
{
onMetadataColumnEditableItemChange
(
e
.
target
.
value
,
'cnName'
,
index
)
}
}
/>
},
{
title
:
'备注'
,
dataIndex
:
'remarks'
,
ellipsis
:
true
,
render
:
(
text
,
_
,
index
)
=>
<
MetadataColumnEditableItem
value=
{
text
}
isEdit=
{
currentAction
!==
'detail'
}
terms=
{
terms
}
onChange=
{
(
e
)
=>
{
onMetadataColumnEditableItemChange
(
e
.
target
.
value
,
'remarks'
,
index
)
}
}
/>
},
];
const
businessActionCol
=
{
title
:
'操作'
,
dataIndex
:
'action'
,
...
...
@@ -266,6 +210,51 @@ const AssetAction = React.forwardRef(function (props, ref) {
return
[];
},
[
currentDomainGroup
,
treeDataMap
])
useEffect
(()
=>
{
if
((
businessElements
??[]).
length
>
0
)
{
setBusinessColumns
(
(
businessElements
??[]).
map
(
item
=>
({
...
item
,
title
:
<
span
>
{
item
.
required
===
'是'
&&
<
span
style=
{
{
marginRight
:
4
,
color
:
'#ff4d4f'
,
}
}
>
*
</
span
>
}
{
item
.
name
}
</
span
>,
dataIndex
:
item
.
enName
,
ellipsis
:
true
,
render
:
(
text
,
record
,
index
)
=>
{
let
value
=
''
const
_index
=
(
record
.
columnElements
??[]).
findIndex
(
_item
=>
item
.
id
===
_item
.
id
)
if
(
_index
!==
-
1
)
{
value
=
record
.
columnElements
[
_index
].
value
}
columnForm
?.
setFieldsValue
({
[
`column
${
item
.
enName
}${
index
}
`
]:
value
})
return
(
<
Form
.
Item
name=
{
`column${item.enName}${index}`
}
rules=
{
[{
required
:
(
item
.
required
===
'是'
)?
true
:
false
,
message
:
`请填写${item.enName}!`
}]
}
style=
{
{
marginBottom
:
0
}
}
>
<
MetadataColumnEditableItem
value=
{
value
}
isEdit=
{
currentAction
!==
'detail'
}
terms=
{
terms
}
onChange=
{
(
e
)
=>
{
onMetadataColumnEditableItemChange
(
e
.
target
.
value
,
item
.
enName
,
index
)
}
}
/>
</
Form
.
Item
>
)
}
}))
)
}
},
[
businessElements
,
currentAction
,
terms
,
modifyMetadataColumnList
])
const
businessData
=
useMemo
(()
=>
{
if
(
currentDomainGroup
&&
currentBussinessDomain
&&
treeDataMap
)
{
const
currentLevel2Data
=
treeDataMap
[
currentDomainGroup
];
...
...
@@ -280,7 +269,13 @@ const AssetAction = React.forwardRef(function (props, ref) {
},
[
currentDomainGroup
,
currentBussinessDomain
,
treeDataMap
])
useEffect
(()
=>
{
setStructured
(
template
?.
structedStateEnum
===
'structured'
||
assets
?.
structedState
===
'structured'
)
let
_isStructured
=
template
?.
structedStateEnum
===
'structured'
||
assets
?.
structedState
===
'structured'
setStructured
(
_isStructured
)
if
(
!
_isStructured
)
{
getBusinessColumns
()
}
},
[
assets
,
template
])
useEffect
(()
=>
{
...
...
@@ -293,7 +288,7 @@ const AssetAction = React.forwardRef(function (props, ref) {
const
cols
=
useMemo
(()
=>
{
let
newCols
=
[]
newCols
=
isStructured
?[...
columns
]:[...
businessColumns
]
newCols
=
isStructured
?[...
columns
]:[...
businessColumns
??[]
]
if
(
!
isStructured
&&
currentAction
!==
'detail'
)
{
newCols
.
push
(
businessActionCol
)
}
...
...
@@ -382,6 +377,20 @@ const AssetAction = React.forwardRef(function (props, ref) {
})
}
const
getBusinessColumns
=
()
=>
{
if
(
template
?.
type
||
assets
?.
templateType
)
{
dispatch
({
type
:
'assetmanage.listBusinessColumnElements'
,
payload
:
{
templateType
:
template
?.
type
||
assets
?.
templateType
,
},
callback
:
(
data
)
=>
{
setBusinessElements
(
data
)
}
})
}
}
const
getElements
=
()
=>
{
setLoading
(
true
);
dispatch
({
...
...
@@ -555,7 +564,12 @@ const AssetAction = React.forwardRef(function (props, ref) {
setModifyMetadataColumnList
(
produce
(
modifyMetadataColumnList
,
(
draft
)
=>
{
if
((
draft
??[]).
length
>
_index
)
{
draft
[
_index
][
`
${
dataIndex
}
`
]
=
val
const
columnElements
=
draft
[
_index
].
columnElements
const
__index
=
(
columnElements
??[]).
findIndex
(
item
=>
item
.
enName
===
dataIndex
)
if
(
__index
!==
-
1
)
{
columnElements
[
__index
].
value
=
val
}
}
})
)
...
...
@@ -957,7 +971,7 @@ const AssetAction = React.forwardRef(function (props, ref) {
await columnForm?.validateFields()
setModifyMetadataColumnList(prev => {
return [{
columnElements: [...businessColumns??[]]
}, ...prev??[]]
})
} catch (errInfo) {
...
...
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