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
47a6bdd9
Commit
47a6bdd9
authored
Dec 26, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
字段编辑
parent
1812b954
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
97 additions
and
27 deletions
+97
-27
assetmanage.js
src/model/assetmanage.js
+4
-0
metadata.js
src/service/metadata.js
+4
-0
AssetAction.jsx
src/view/Manage/AssetManage/Component/AssetAction.jsx
+89
-27
No files found.
src/model/assetmanage.js
View file @
47a6bdd9
...
@@ -275,6 +275,10 @@ export function* getMetadataAttributes(payload) {
...
@@ -275,6 +275,10 @@ export function* getMetadataAttributes(payload) {
return
yield
call
(
metadataService
.
getAttributes
,
payload
);
return
yield
call
(
metadataService
.
getAttributes
,
payload
);
}
}
export
function
*
batchUpdateAttributes
(
payload
)
{
return
yield
call
(
metadataService
.
batchUpdateAttributes
,
payload
);
}
export
function
*
exportMetadataAttributes
(
payload
)
{
export
function
*
exportMetadataAttributes
(
payload
)
{
return
yield
call
(
metadataService
.
exportAttributes
,
payload
);
return
yield
call
(
metadataService
.
exportAttributes
,
payload
);
}
}
...
...
src/service/metadata.js
View file @
47a6bdd9
...
@@ -24,6 +24,10 @@ export function getAttributes(payload) {
...
@@ -24,6 +24,10 @@ export function getAttributes(payload) {
return
PostJSON
(
"/metadatarepo/rest/metadata/getByIdList"
,
payload
);
return
PostJSON
(
"/metadatarepo/rest/metadata/getByIdList"
,
payload
);
}
}
export
function
batchUpdateAttributes
(
payload
)
{
return
PostJSON
(
"/metadatarepo/rest/metadata/batchToUpdate"
,
payload
)
}
export
function
exportAttributes
(
payload
)
{
export
function
exportAttributes
(
payload
)
{
return
callFetchRawByFormData
(
'post'
,
'/metadatarepo/rest/download/exportAssetInfo'
,
payload
)
return
callFetchRawByFormData
(
'post'
,
'/metadatarepo/rest/download/exportAssetInfo'
,
payload
)
}
}
...
...
src/view/Manage/AssetManage/Component/AssetAction.jsx
View file @
47a6bdd9
...
@@ -141,25 +141,14 @@ const AssetAction = (props) => {
...
@@ -141,25 +141,14 @@ const AssetAction = (props) => {
dataIndex
:
'cnName'
,
dataIndex
:
'cnName'
,
// width: 200,
// width: 200,
ellipsis
:
true
,
ellipsis
:
true
,
render
:
(
text
,
_
,
index
)
=>
{
render
:
(
text
,
_
,
index
)
=>
<
MetadataColumnEditableItem
if
(
isMetadataEdit
)
{
value=
{
text
}
return
(
isEdit=
{
isMetadataEdit
}
<
Input
size=
'small'
allowClear
value=
{
text
}
terms=
{
terms
}
onChange=
{
(
e
)
=>
{
onChange=
{
(
e
)
=>
{
setModifyMetadataColumnList
(
onMetadataColumnEditableItemChange
(
e
.
target
.
value
,
'cnName'
,
index
)
produce
(
modifyMetadataColumnList
,
(
draft
)
=>
{
if
((
draft
??[]).
length
>
index
)
{
draft
[
index
].
cnName
=
e
.
target
.
value
}
})
)
}
}
}
}
/>
/>
)
}
return
highlightSearchContentByTerms
(
text
||
''
,
terms
)
}
},
},
{
{
title
:
'是否有权限'
,
title
:
'是否有权限'
,
...
@@ -180,19 +169,40 @@ const AssetAction = (props) => {
...
@@ -180,19 +169,40 @@ const AssetAction = (props) => {
dataIndex
:
'businessRules'
,
dataIndex
:
'businessRules'
,
width
:
240
,
width
:
240
,
ellipsis
:
true
,
ellipsis
:
true
,
render
:
(
text
,
_
)
=>
highlightSearchContentByTerms
(
text
||
''
,
terms
)
render
:
(
text
,
_
,
index
)
=>
<
MetadataColumnEditableItem
value=
{
text
}
isEdit=
{
isMetadataEdit
}
terms=
{
terms
}
onChange=
{
(
e
)
=>
{
onMetadataColumnEditableItemChange
(
e
.
target
.
value
,
'businessRules'
,
index
)
}
}
/>
},
},
{
{
title
:
'计量单位'
,
title
:
'计量单位'
,
dataIndex
:
'unitOfMeasurement'
,
dataIndex
:
'unitOfMeasurement'
,
ellipsis
:
true
,
ellipsis
:
true
,
render
:
(
text
,
_
)
=>
highlightSearchContentByTerms
(
text
||
''
,
terms
)
render
:
(
text
,
_
,
index
)
=>
<
MetadataColumnEditableItem
value=
{
text
}
isEdit=
{
isMetadataEdit
}
terms=
{
terms
}
onChange=
{
(
e
)
=>
{
onMetadataColumnEditableItemChange
(
e
.
target
.
value
,
'unitOfMeasurement'
,
index
)
}
}
/>
},
},
{
{
title
:
'备注信息'
,
title
:
'备注信息'
,
dataIndex
:
'remarks'
,
dataIndex
:
'remarks'
,
ellipsis
:
true
,
ellipsis
:
true
,
render
:
(
text
,
_
)
=>
highlightSearchContentByTerms
(
text
||
''
,
terms
)
render
:
(
text
,
_
,
index
)
=>
<
MetadataColumnEditableItem
value=
{
text
}
isEdit=
{
isMetadataEdit
}
terms=
{
terms
}
onChange=
{
(
e
)
=>
{
onMetadataColumnEditableItemChange
(
e
.
target
.
value
,
'remarks'
,
index
)
}
}
/>
},
},
{
{
title
:
'类型'
,
title
:
'类型'
,
...
@@ -542,8 +552,7 @@ const AssetAction = (props) => {
...
@@ -542,8 +552,7 @@ const AssetAction = (props) => {
payload
:
{
payload
:
{
data
:
ids
,
data
:
ids
,
params
:
{
params
:
{
// catalog: app?.env?.domainId||catalog||LocalStorage.get('assetsEnv'),
catalog
:
app
?.
env
?.
domainId
||
catalog
||
LocalStorage
.
get
(
'assetsEnv'
),
catalog
:
'1810295967'
}
}
},
},
callback
:
data
=>
{
callback
:
data
=>
{
...
@@ -593,6 +602,16 @@ const AssetAction = (props) => {
...
@@ -593,6 +602,16 @@ const AssetAction = (props) => {
})
})
}
}
const
onMetadataColumnEditableItemChange
=
(
val
,
dataIndex
,
index
)
=>
{
setModifyMetadataColumnList
(
produce
(
modifyMetadataColumnList
,
(
draft
)
=>
{
if
((
draft
??[]).
length
>
index
)
{
draft
[
index
][
`
${
dataIndex
}
`
]
=
val
}
})
)
}
const
onCancelButtonClick
=
()
=>
{
const
onCancelButtonClick
=
()
=>
{
setCurrentAction
(
'detail'
);
setCurrentAction
(
'detail'
);
getAsset
();
getAsset
();
...
@@ -1161,6 +1180,39 @@ const AssetAction = (props) => {
...
@@ -1161,6 +1180,39 @@ const AssetAction = (props) => {
<Space style={{ marginLeft: 'auto' }}>
<Space style={{ marginLeft: 'auto' }}>
{
{
(reference===AssetManageReference||(reference!==AssetDraftReference&&canEdit)) && <React.Fragment>
(reference===AssetManageReference||(reference!==AssetDraftReference&&canEdit)) && <React.Fragment>
{
isMetadataEdit ? <React.Fragment>
<Button onClick={() => {
setMetadataEdit(false)
}}>
取消
</Button>
<Button onClick={() => {
setLoadingMetadataColumnList(true)
dispatch({
type: 'assetmanage.batchUpdateAttributes',
payload: {
data: modifyMetadataColumnList
},
callback: () => {
setLoadingMetadataColumnList(false)
setMetadataEdit(false)
getMetadataAttributes()
},
error: () => {
setLoadingMetadataColumnList(false)
}
})
}}>
保存
</Button>
</React.Fragment> : <Button onClick={() => {
setModifyMetadataColumnList(metadataColumnList)
setMetadataEdit(true)
}}>
编辑
</Button>
}
<Button
<Button
onClick={() => {
onClick={() => {
if (metadata?.metadataTableId) {
if (metadata?.metadataTableId) {
...
@@ -1175,12 +1227,6 @@ const AssetAction = (props) => {
...
@@ -1175,12 +1227,6 @@ const AssetAction = (props) => {
>
>
字段级维护
字段级维护
</Button>
</Button>
<Button onClick={() => {
setModifyMetadataColumnList(metadataColumnList)
setMetadataEdit(true)
}}>
编辑
</Button>
</React.Fragment>
</React.Fragment>
}
}
<Input size="middle"
<Input size="middle"
...
@@ -1287,3 +1333,18 @@ const CascaderItem = ({ value = null, data, onChange, ...restProps }) => {
...
@@ -1287,3 +1333,18 @@ const CascaderItem = ({ value = null, data, onChange, ...restProps }) => {
/>
/>
)
)
}
}
const MetadataColumnEditableItem = ({ value, isEdit, terms, onChange }) => {
return (
<React.Fragment>
{
isEdit ? <Input size='small'
value={value}
onChange={(e) => { onChange?.(e) }}
/> : <span>
{highlightSearchContentByTerms(value, terms)}
</span>
}
</React.Fragment>
)
}
\ No newline at end of file
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