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
83c55773
Commit
83c55773
authored
Oct 27, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增为资产
parent
c1a1d299
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
296 additions
and
98 deletions
+296
-98
assetmanage.js
src/model/assetmanage.js
+16
-0
dataassetmanager.js
src/service/dataassetmanager.js
+16
-0
MetadataInfo.jsx
src/view/Manage/AssetManage/Component/MetadataInfo.jsx
+2
-2
add-resources.jsx
src/view/Manage/AssetManage/add-resources.jsx
+7
-1
asset-item.jsx
src/view/Manage/AssetManage/asset-item.jsx
+127
-0
table.jsx
src/view/Manage/AssetManage/table.jsx
+11
-42
add-to-asset.jsx
src/view/Manage/AssetResourceManage/add-to-asset.jsx
+114
-48
table.jsx
src/view/Manage/AssetResourceManage/table.jsx
+3
-5
No files found.
src/model/assetmanage.js
View file @
83c55773
...
@@ -232,6 +232,10 @@ export function* getAssetPaths(payload) {
...
@@ -232,6 +232,10 @@ export function* getAssetPaths(payload) {
return
yield
call
(
service
.
getAssetPaths
,
payload
);
return
yield
call
(
service
.
getAssetPaths
,
payload
);
}
}
export
function
*
getMetadataItems
(
payload
)
{
return
yield
call
(
service
.
getMetadataItems
,
payload
);
}
export
function
*
getResourceRelations
(
payload
)
{
export
function
*
getResourceRelations
(
payload
)
{
return
yield
call
(
service
.
getResourceRelations
,
payload
);
return
yield
call
(
service
.
getResourceRelations
,
payload
);
}
}
...
@@ -324,6 +328,18 @@ export function* addOrUpdateResource(payload) {
...
@@ -324,6 +328,18 @@ export function* addOrUpdateResource(payload) {
return
yield
call
(
service
.
addOrUpdateResource
,
payload
)
return
yield
call
(
service
.
addOrUpdateResource
,
payload
)
}
}
export
function
*
resourceAddAsAsset
(
payload
)
{
return
yield
call
(
service
.
resourceAddAsAsset
,
payload
)
}
export
function
*
resourceFillElementValueBeforeAddAsAsset
(
payload
)
{
return
yield
call
(
service
.
resourceFillElementValueBeforeAddAsAsset
,
payload
)
}
export
function
*
resourceCombineDataAsset
(
payload
)
{
return
yield
call
(
service
.
resourceCombineDataAsset
,
payload
)
}
export
function
*
getTasks
(
payload
)
{
export
function
*
getTasks
(
payload
)
{
return
yield
call
(
service
.
getTasks
,
payload
)
return
yield
call
(
service
.
getTasks
,
payload
)
}
}
...
...
src/service/dataassetmanager.js
View file @
83c55773
...
@@ -120,6 +120,10 @@ export function getAssetPaths(payload) {
...
@@ -120,6 +120,10 @@ export function getAssetPaths(payload) {
return
GetJSON
(
"/dataassetmanager/dataAssetApi/getMultiPath"
,
payload
);
return
GetJSON
(
"/dataassetmanager/dataAssetApi/getMultiPath"
,
payload
);
}
}
export
function
getMetadataItems
(
payload
)
{
return
PostJSON
(
"/dataassetmanager/dataAssetApi/getMetadataItems"
,
payload
);
}
export
function
addOrUpdateDirectory
(
payload
)
{
export
function
addOrUpdateDirectory
(
payload
)
{
return
PostJSON
(
"/dataassetmanager/directoryApi/addOrUpdateDirectory"
,
payload
);
return
PostJSON
(
"/dataassetmanager/directoryApi/addOrUpdateDirectory"
,
payload
);
}
}
...
@@ -316,6 +320,18 @@ export function getPreviewRangeByDirId(payload) {
...
@@ -316,6 +320,18 @@ export function getPreviewRangeByDirId(payload) {
return
PostJSON
(
"/dataassetmanager/resourceApi/addResource"
,
payload
);
return
PostJSON
(
"/dataassetmanager/resourceApi/addResource"
,
payload
);
}
}
export
function
resourceAddAsAsset
(
payload
)
{
return
PostJSON
(
"/dataassetmanager/resourceApi/addAsAsset"
,
payload
);
}
export
function
resourceFillElementValueBeforeAddAsAsset
(
payload
)
{
return
GetJSON
(
"/dataassetmanager/resourceApi/fillElementValueBeforeAddAsAsset"
,
payload
);
}
export
function
resourceCombineDataAsset
(
payload
)
{
return
PostJSON
(
"/dataassetmanager/resourceApi/combineExistDataAsset"
,
payload
);
}
export
function
getTasks
(
payload
)
{
export
function
getTasks
(
payload
)
{
return
GetJSON
(
"/dataassetmanager/resource/taskApi/listTasksByPage"
,
payload
)
return
GetJSON
(
"/dataassetmanager/resource/taskApi/listTasksByPage"
,
payload
)
}
}
...
...
src/view/Manage/AssetManage/Component/MetadataInfo.jsx
View file @
83c55773
...
@@ -72,11 +72,11 @@ const ResourceItem = ({ data, config, terms }) => {
...
@@ -72,11 +72,11 @@ const ResourceItem = ({ data, config, terms }) => {
const
AssetItem
=
({
data
,
config
,
terms
})
=>
{
const
AssetItem
=
({
data
,
config
,
terms
})
=>
{
const
app
=
React
.
useContext
(
AppContext
)
const
app
=
React
.
useContext
(
AppContext
)
return
(
return
(
<
div
className=
'flex'
>
<
div
className=
'flex'
style=
{
{
alignItems
:
'center'
}
}
>
{
{
(
typeof
data
===
'string'
)
?
<
span
style=
{
{
marginRight
:
5
}
}
>
(
typeof
data
===
'string'
)
?
<
span
style=
{
{
marginRight
:
5
}
}
>
{
highlightSearchContentByTerms
(
data
,
terms
)
}
{
highlightSearchContentByTerms
(
data
,
terms
)
}
</
span
>
:
(
IsArr
(
data
)
?
<
div
className=
'flex'
style=
{
{
flexDirection
:
'column'
}
}
>
</
span
>
:
(
IsArr
(
data
)
?
<
div
className=
'flex'
style=
{
{
flexDirection
:
'column'
,
lineHeight
:
'32px'
}
}
>
{
{
(
data
??[]).
map
((
item
,
index
)
=>
<
span
key=
{
index
}
>
(
data
??[]).
map
((
item
,
index
)
=>
<
span
key=
{
index
}
>
<
Tooltip
<
Tooltip
...
...
src/view/Manage/AssetManage/add-resources.jsx
View file @
83c55773
...
@@ -13,7 +13,7 @@ import { MetadataColumn } from "../AssetResourceManage/table"
...
@@ -13,7 +13,7 @@ import { MetadataColumn } from "../AssetResourceManage/table"
import
'./add-resources.less'
import
'./add-resources.less'
const
FC
=
(
props
)
=>
{
const
FC
=
(
props
)
=>
{
const
{
visible
,
item
,
onCancel
}
=
props
const
{
visible
,
item
,
onCancel
,
onOk
}
=
props
const
[
waiting
,
setWaiting
]
=
React
.
useState
(
false
)
const
[
waiting
,
setWaiting
]
=
React
.
useState
(
false
)
const
basicRef
=
React
.
useRef
()
const
basicRef
=
React
.
useRef
()
...
@@ -30,6 +30,9 @@ const FC = (props) => {
...
@@ -30,6 +30,9 @@ const FC = (props) => {
return
return
}
}
onOk
?.(
selectedRows
)
if
(
item
)
{
setWaiting
(
true
)
setWaiting
(
true
)
dispatch
({
dispatch
({
type
:
'assetmanage.dataAssetAddResources'
,
type
:
'assetmanage.dataAssetAddResources'
,
...
@@ -47,6 +50,9 @@ const FC = (props) => {
...
@@ -47,6 +50,9 @@ const FC = (props) => {
setWaiting
(
false
)
setWaiting
(
false
)
}
}
})
})
}
else
{
close
()
}
}
}
const
footer
=
React
.
useMemo
(()
=>
{
const
footer
=
React
.
useMemo
(()
=>
{
...
...
src/view/Manage/AssetManage/asset-item.jsx
0 → 100644
View file @
83c55773
import
React
from
'react'
import
{
Button
,
Tooltip
}
from
'antd'
import
{
AppContext
}
from
'../../../App'
import
{
highlightSearchContentByTerms
,
IsArr
}
from
'../../../util'
import
{
MetadataColumnTooltipTitle
}
from
'../AssetResourceManage/table'
import
AddResources
from
'./add-resources'
import
{
dispatch
}
from
'../../../model'
const
FC
=
({
value
,
onChange
,
readonly
=
true
,
terms
=
[]
})
=>
{
const
[
decodeData
,
setDecodeData
]
=
React
.
useState
()
const
[
addResourcesParams
,
setAddResourcesParams
]
=
React
.
useState
({
visible
:
false
,
})
const
app
=
React
.
useContext
(
AppContext
)
React
.
useMemo
(()
=>
{
if
(
value
)
{
try
{
setDecodeData
(
JSON
.
parse
(
value
))
}
catch
(
error
)
{
setDecodeData
(
value
)
}
}
else
{
setDecodeData
()
}
},
[
value
])
const
onAddResourcesOk
=
(
resources
)
=>
{
dispatch
({
type
:
'assetmanage.getMetadataItems'
,
payload
:
{
params
:
{
resourceIds
:
(
resources
??[]).
map
(
item
=>
item
.
id
).
toString
()
}
},
callback
:
data
=>
{
if
(
typeof
decodeData
===
'string'
)
{
onChange
?.(
JSON
.
stringify
(
data
??[]))
}
else
{
const
newData
=
[...
decodeData
??[]]
for
(
const
item
of
data
??[])
{
const
_index
=
(
newData
??[]).
findIndex
(
_item
=>
item
.
metadataId
===
_item
.
metadataId
)
if
(
_index
===
-
1
)
{
newData
.
push
(
item
)
}
}
onChange
?.(
JSON
.
stringify
(
newData
))
}
},
})
}
return
(
<
div
>
{
!
readonly
&&
<
Button
onClick=
{
()
=>
{
setAddResourcesParams
({
visible
:
true
})
}
}
>
添加资源
</
Button
>
}
{
(
typeof
decodeData
===
'string'
)
&&
<
div
className=
'flex'
style=
{
{
lineHeight
:
'32px'
,
alignItems
:
'center'
}
}
>
<
span
style=
{
{
marginRight
:
5
}
}
>
{
highlightSearchContentByTerms
(
decodeData
,
terms
)
}
</
span
>
{
!
readonly
&&
<
Button
size=
'small'
onClick=
{
()
=>
{
onChange
?.()
}
}
>
删除
</
Button
>
}
</
div
>
}
{
IsArr
(
decodeData
)
&&
<
div
>
{
//资源可能没有资源项
(
decodeData
??[]).
filter
(
item
=>
item
.
metadataId
).
map
((
item
,
index
)
=>
<
div
key=
{
index
}
className=
'flex'
style=
{
{
lineHeight
:
'32px'
,
alignItems
:
'center'
}
}
>
<
span
>
<
Tooltip
overlayClassName=
'tooltip-common'
title=
{
<
MetadataColumnTooltipTitle
data=
{
[
item
]
}
/>
}
>
<
a
onClick=
{
()
=>
{
app
?.
setGlobalState
?.({
message
:
'data-govern-show-metadata-message'
,
data
:
item
})
}
}
style=
{
{
marginRight
:
5
,
marginTop
:
readonly
?
0
:
5
}
}
>
{
highlightSearchContentByTerms
(
item
.
enName
,
terms
)
}
</
a
>
</
Tooltip
>
</
span
>
{
!
readonly
&&
<
Button
size=
'small'
onClick=
{
()
=>
{
const
newData
=
[...
decodeData
]
const
_index
=
(
newData
??[]).
findIndex
(
_item
=>
item
.
metadataId
===
_item
.
metadataId
)
if
(
_index
!==
-
1
)
{
newData
.
splice
(
_index
,
1
)
onChange
?.(
JSON
.
stringify
(
newData
))
}
}
}
>
删除
</
Button
>
}
</
div
>
)
}
</
div
>
}
<
AddResources
{
...
addResourcesParams
}
onCancel=
{
(
refresh
)
=>
{
setAddResourcesParams
({
visible
:
false
})
}
}
onOk=
{
onAddResourcesOk
}
/>
</
div
>
)
}
export
default
FC
\ No newline at end of file
src/view/Manage/AssetManage/table.jsx
View file @
83c55773
...
@@ -31,7 +31,8 @@ import './Component/AssetTable.less'
...
@@ -31,7 +31,8 @@ import './Component/AssetTable.less'
import
{
MetadataColumn
}
from
'../AssetResourceManage/table'
import
{
MetadataColumn
}
from
'../AssetResourceManage/table'
const
operationMap
=
{
const
operationMap
=
{
addResource
:
'添加资源'
,
publish
:
'发布'
,
}
}
const
FC
=
(
props
)
=>
{
const
FC
=
(
props
)
=>
{
...
@@ -210,7 +211,7 @@ const FC = (props) => {
...
@@ -210,7 +211,7 @@ const FC = (props) => {
_exportAble
=
(
permissions
??[]).
findIndex
(
item
=>
item
===
'export'
)
!==
-
1
_exportAble
=
(
permissions
??[]).
findIndex
(
item
=>
item
===
'export'
)
!==
-
1
}
else
{
}
else
{
let
[
allowImport
,
allowExport
]
=
[
true
,
true
]
let
[
allowImport
,
allowExport
]
=
[
true
,
true
]
for
(
const
row
of
selectedRows
)
{
for
(
const
row
of
selectedRows
??[]
)
{
const
importIndex
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'import'
)
const
importIndex
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'import'
)
const
exportIndex
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'export'
)
const
exportIndex
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'export'
)
if
(
importIndex
===
-
1
)
{
if
(
importIndex
===
-
1
)
{
...
@@ -226,7 +227,7 @@ const FC = (props) => {
...
@@ -226,7 +227,7 @@ const FC = (props) => {
}
}
let
[
allowBatchEdit
,
allowChangeDirectory
,
allowDelete
]
=
[
true
,
true
,
true
]
let
[
allowBatchEdit
,
allowChangeDirectory
,
allowDelete
]
=
[
true
,
true
,
true
]
for
(
const
row
of
selectedRows
)
{
for
(
const
row
of
selectedRows
??[]
)
{
const
batchEditIndex
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'batchEdit'
)
const
batchEditIndex
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'batchEdit'
)
const
changeDirecotoryIndex
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'changeDir'
)
const
changeDirecotoryIndex
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'changeDir'
)
const
deleteIndex
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'delete'
)
const
deleteIndex
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'delete'
)
...
@@ -259,45 +260,13 @@ const FC = (props) => {
...
@@ -259,45 +260,13 @@ const FC = (props) => {
},
[
rightRow
])
},
[
rightRow
])
const
notElementCol
=
[
const
notElementCol
=
[
// {
{
// title: '梳理状态',
title
:
'资产状态'
,
// dataIndex: 'sortingStatus',
dataIndex
:
'publishStatus'
,
// ellipsis: true,
ellipsis
:
true
,
// width: 120,
width
:
120
,
// render: (_, record) => record.resourceExtraAttribute?.sortingStatus
render
:
(
_
,
record
)
=>
record
.
assetExtraAttribute
?.
publishStatus
// },
},
// {
// title: '当前处理人',
// dataIndex: 'currentProcessor',
// ellipsis: true,
// width: 120,
// render: (_, record) => record.resourceExtraAttribute?.currentProcessor
// },
// {
// title: '任务编号',
// dataIndex: 'taskNO',
// ellipsis: true,
// width: 120,
// render: (_, record) => <a onClick={() => {
// window.open(`/center-home/menu/task-manage?id=${record.resourceExtraAttribute?.taskNO}`)
// }}>
// {record.resourceExtraAttribute?.taskNO}
// </a>
// },
// {
// title: '资产状态',
// dataIndex: 'resourceStatus',
// ellipsis: true,
// width: 120,
// render: (_, record) => record.resourceExtraAttribute?.resourceStatus
// },
// {
// title: '是否资产',
// dataIndex: 'transferDataAsset',
// ellipsis: true,
// width: 120,
// render: (_, record) => record.resourceExtraAttribute?.transferDataAsset
// },
{
{
title
:
'标签'
,
title
:
'标签'
,
dataIndex
:
'tag'
,
dataIndex
:
'tag'
,
...
...
src/view/Manage/AssetResourceManage/add-to-asset.jsx
View file @
83c55773
...
@@ -10,20 +10,93 @@ import { AppContext } from '../../../App'
...
@@ -10,20 +10,93 @@ import { AppContext } from '../../../App'
import
MetadataInfo
from
'../AssetManage/Component/MetadataInfo'
import
MetadataInfo
from
'../AssetManage/Component/MetadataInfo'
import
{
defaultPage
,
usePage
}
from
'../../../util/hooks/page'
import
{
defaultPage
,
usePage
}
from
'../../../util/hooks/page'
import
Table
from
'../../../util/Component/Table'
import
Table
from
'../../../util/Component/Table'
import
AssetItem
from
'../AssetManage/asset-item'
import
'./add-to-asset.less'
import
'./add-to-asset.less'
const
FC
=
(
props
)
=>
{
const
FC
=
(
props
)
=>
{
const
{
visible
,
items
,
onCancel
}
=
props
const
{
visible
,
items
,
onCancel
}
=
props
const
[
loading
,
setLoading
]
=
React
.
useState
(
false
)
const
[
waiting
,
setWaiting
]
=
React
.
useState
(
false
)
const
[
waiting
,
setWaiting
]
=
React
.
useState
(
false
)
const
[
autoFillElementValue
,
setAutoFillElementValue
]
=
React
.
useState
()
const
basicRef
=
React
.
useRef
()
React
.
useEffect
(()
=>
{
if
(
visible
)
{
fillElementValueBeforeAddAsAsset
()
}
},
[
visible
])
const
fillElementValueBeforeAddAsAsset
=
()
=>
{
setLoading
(
true
)
dispatch
({
type
:
'assetmanage.resourceFillElementValueBeforeAddAsAsset'
,
payload
:
{
resourceIds
:
(
items
??[]).
map
(
item
=>
item
.
id
).
toString
()
},
callback
:
data
=>
{
setLoading
(
false
)
setAutoFillElementValue
(
data
)
},
error
:
()
=>
{
setLoading
(
false
)
}
})
}
const
close
=
(
refresh
=
false
)
=>
{
const
close
=
(
refresh
=
false
)
=>
{
setLoading
(
false
)
setWaiting
(
false
)
setWaiting
(
false
)
setAutoFillElementValue
()
onCancel
?.(
refresh
)
onCancel
?.(
refresh
)
}
}
const
save
=
()
=>
{
const
save
=
async
()
=>
{
try
{
const
rows
=
await
basicRef
.
current
?.
validate
()
setWaiting
(
true
)
if
(
basicRef
.
current
?.
type
===
'add'
)
{
dispatch
({
type
:
'assetmanage.resourceAddAsAsset'
,
payload
:
{
data
:
{
elements
:
rows
.
asset
},
params
:
{
dirIds
:
(
rows
.
dirIds
??[]).
map
(
item
=>
item
.
value
).
toString
()
}
},
callback
:
data
=>
{
setWaiting
(
false
)
onCancel
?.(
true
)
},
error
:
()
=>
{
setWaiting
(
false
)
}
})
}
else
{
dispatch
({
type
:
'assetmanage.resourceCombineDataAsset'
,
payload
:
{
params
:
{
resourceIds
:
(
items
??[]).
map
(
item
=>
item
.
id
).
toString
(),
dataAssetId
:
rows
.
assetId
}
},
callback
:
data
=>
{
setWaiting
(
false
)
onCancel
?.(
true
)
},
error
:
()
=>
{
setWaiting
(
false
)
}
})
}
}
catch
(
e
)
{
}
}
}
const
footer
=
React
.
useMemo
(()
=>
{
const
footer
=
React
.
useMemo
(()
=>
{
...
@@ -48,8 +121,8 @@ const FC = (props) => {
...
@@ -48,8 +121,8 @@ const FC = (props) => {
centered
destroyOnClose
centered
destroyOnClose
onCancel=
{
()
=>
{
close
()
}
}
onCancel=
{
()
=>
{
close
()
}
}
>
>
<
Spin
spinning=
{
waiting
}
>
<
Spin
spinning=
{
loading
||
waiting
}
>
<
Basic
items=
{
items
}
/>
<
Basic
ref=
{
basicRef
}
defaultValue=
{
autoFillElementValue
}
/>
</
Spin
>
</
Spin
>
</
Modal
>
</
Modal
>
)
)
...
@@ -57,16 +130,29 @@ const FC = (props) => {
...
@@ -57,16 +130,29 @@ const FC = (props) => {
export
default
FC
export
default
FC
export
const
Basic
=
React
.
forwardRef
(
function
({
items
},
ref
)
{
export
const
Basic
=
React
.
forwardRef
(
function
({
items
,
defaultValue
},
ref
)
{
const
[
type
,
setType
]
=
React
.
useState
(
'add'
)
const
[
type
,
setType
]
=
React
.
useState
(
'add'
)
const
[
loadingTreeData
,
setLoadingTreeData
]
=
React
.
useState
(
false
)
const
[
loadingTreeData
,
setLoadingTreeData
]
=
React
.
useState
(
false
)
const
[
treeData
,
setTreeData
]
=
React
.
useState
()
const
[
treeData
,
setTreeData
]
=
React
.
useState
()
const
[
form
]
=
Form
.
useForm
()
const
[
form
]
=
Form
.
useForm
()
React
.
useImperativeHandle
(
ref
,
()
=>
({
validate
:
async
()
=>
{
return
await
form
.
validateFields
()
},
type
}),
[
form
,
type
])
React
.
useEffect
(()
=>
{
React
.
useEffect
(()
=>
{
getTreeData
()
getTreeData
()
},
[])
},
[])
React
.
useEffect
(()
=>
{
if
(
type
===
'add'
&&
defaultValue
)
{
form
?.
setFieldsValue
({
asset
:
defaultValue
})
}
},
[
type
,
defaultValue
])
const
treeData1
=
React
.
useMemo
(()
=>
{
const
treeData1
=
React
.
useMemo
(()
=>
{
if
(
treeData
)
{
if
(
treeData
)
{
const
newTreeData
=
produce
(
treeData
,
draft
=>
{
const
newTreeData
=
produce
(
treeData
,
draft
=>
{
...
@@ -93,7 +179,7 @@ export const Basic = React.forwardRef(function ({ items }, ref) {
...
@@ -93,7 +179,7 @@ export const Basic = React.forwardRef(function ({ items }, ref) {
const
getTreeData
=
()
=>
{
const
getTreeData
=
()
=>
{
setLoadingTreeData
(
true
)
setLoadingTreeData
(
true
)
dispatch
({
dispatch
({
type
:
'assetmanage.query
AssetDirectoryAs
Tree'
,
type
:
'assetmanage.query
DataAssetManage
Tree'
,
callback
:
data
=>
{
callback
:
data
=>
{
setLoadingTreeData
(
false
)
setLoadingTreeData
(
false
)
setTreeData
(
data
)
setTreeData
(
data
)
...
@@ -134,7 +220,7 @@ export const Basic = React.forwardRef(function ({ items }, ref) {
...
@@ -134,7 +220,7 @@ export const Basic = React.forwardRef(function ({ items }, ref) {
{
{
type
===
'add'
?
<
React
.
Fragment
>
type
===
'add'
?
<
React
.
Fragment
>
<
Form
.
Item
<
Form
.
Item
name=
'
catalogId
'
name=
'
dirIds
'
label=
'资产目录'
label=
'资产目录'
rules=
{
[{
required
:
true
,
message
:
'请选择资产目录!'
}]
}
rules=
{
[{
required
:
true
,
message
:
'请选择资产目录!'
}]
}
>
>
...
@@ -144,6 +230,8 @@ export const Basic = React.forwardRef(function ({ items }, ref) {
...
@@ -144,6 +230,8 @@ export const Basic = React.forwardRef(function ({ items }, ref) {
treeData=
{
treeData1
}
treeData=
{
treeData1
}
placeholder=
"请选择分组"
placeholder=
"请选择分组"
treeDefaultExpandAll
treeDefaultExpandAll
treeCheckable
treeCheckStrictly
/>
/>
</
Form
.
Item
>
</
Form
.
Item
>
<
Form
.
Item
<
Form
.
Item
...
@@ -159,16 +247,15 @@ export const Basic = React.forwardRef(function ({ items }, ref) {
...
@@ -159,16 +247,15 @@ export const Basic = React.forwardRef(function ({ items }, ref) {
label=
'选择资产'
label=
'选择资产'
rules=
{
[{
required
:
true
,
message
:
'请选择资产!'
}]
}
rules=
{
[{
required
:
true
,
message
:
'请选择资产!'
}]
}
>
>
</
Form
.
Item
>
<
SelectAssetItem
/>
<
SelectAssetItem
/>
</
Form
.
Item
>
</
React
.
Fragment
>
</
React
.
Fragment
>
}
}
</
Form
>
</
Form
>
)
)
})
})
const
AssetInfoItem
=
({
items
,
onChange
})
=>
{
const
AssetInfoItem
=
({
value
,
onChange
})
=>
{
const
[
loading
,
setLoading
]
=
React
.
useState
(
false
)
const
[
loading
,
setLoading
]
=
React
.
useState
(
false
)
const
[
elements
,
setElements
]
=
React
.
useState
()
const
[
elements
,
setElements
]
=
React
.
useState
()
const
[
groups
,
setGroups
]
=
React
.
useState
()
const
[
groups
,
setGroups
]
=
React
.
useState
()
...
@@ -176,6 +263,14 @@ const AssetInfoItem = ({ items, onChange }) => {
...
@@ -176,6 +263,14 @@ const AssetInfoItem = ({ items, onChange }) => {
const
[
form
]
=
Form
.
useForm
()
const
[
form
]
=
Form
.
useForm
()
React
.
useEffect
(()
=>
{
React
.
useEffect
(()
=>
{
let
fieldsValue
=
{}
for
(
const
element
of
value
??[])
{
fieldsValue
[
element
.
name
]
=
element
.
value
}
form
?.
setFieldsValue
(
fieldsValue
)
},
[
value
])
React
.
useEffect
(()
=>
{
getElements
()
getElements
()
},
[])
},
[])
...
@@ -200,27 +295,14 @@ const AssetInfoItem = ({ items, onChange }) => {
...
@@ -200,27 +295,14 @@ const AssetInfoItem = ({ items, onChange }) => {
})
})
}
}
const
fillElementValueBeforeCreate
=
(
metadataId
)
=>
{
const
onValuesChange
=
(
changedValues
,
allValues
)
=>
{
dispatch
({
const
newElements
=
[...
elements
]
type
:
'assetmanage.fillElementValueBeforeCreate'
,
for
(
const
element
of
newElements
??[])
{
payload
:
{
if
(
allValues
.
hasOwnProperty
(
element
.
name
))
{
params
:
{
element
.
value
=
allValues
[
element
.
name
];
metadataIds
:
metadataId
}
},
callback
:
data
=>
{
let
_fieldsValue
=
{}
for
(
const
item
of
data
??[])
{
_fieldsValue
[
item
.
name
]
=
item
.
value
}
form
?.
setFieldsValue
(
_fieldsValue
)
onChange
?.(
_fieldsValue
)
}
}
})
}
}
onChange
?.(
newElements
)
const
onValuesChange
=
(
changedValues
,
allValues
)
=>
{
onChange
?.(
allValues
)
}
}
const
formItemLayout
=
{
const
formItemLayout
=
{
...
@@ -238,6 +320,7 @@ const AssetInfoItem = ({ items, onChange }) => {
...
@@ -238,6 +320,7 @@ const AssetInfoItem = ({ items, onChange }) => {
<
React
.
Fragment
>
<
React
.
Fragment
>
<
div
style=
{
{
height
:
30
}
}
/>
<
div
style=
{
{
height
:
30
}
}
/>
<
Spin
spinning=
{
loading
}
>
<
Spin
spinning=
{
loading
}
>
<
Form
{
...
formItemLayout
}
form=
{
form
}
onValuesChange=
{
onValuesChange
}
>
{
{
(
groups
??[]).
map
((
group
,
index
)
=>
{
(
groups
??[]).
map
((
group
,
index
)
=>
{
const
filterElements
=
(
elements
??[]).
filter
(
element
=>
element
.
type
===
group
)
const
filterElements
=
(
elements
??[]).
filter
(
element
=>
element
.
type
===
group
)
...
@@ -255,22 +338,7 @@ const AssetInfoItem = ({ items, onChange }) => {
...
@@ -255,22 +338,7 @@ const AssetInfoItem = ({ items, onChange }) => {
<
div
className=
'title-text'
style=
{
{
fontWeight
:
'bold'
}
}
>
{
group
}
</
div
>
<
div
className=
'title-text'
style=
{
{
fontWeight
:
'bold'
}
}
>
{
group
}
</
div
>
</
div
>
</
div
>
<
div
className=
'px-common py-compact-common'
>
<
div
className=
'px-common py-compact-common'
>
<
Form
{
...
formItemLayout
}
form=
{
form
}
onValuesChange=
{
onValuesChange
}
>
<
AppContext
.
Consumer
>
{
{
value
=>
{
value
?.
onGlobalStateChange
&&
value
?.
onGlobalStateChange
((
state
,
prev
)
=>
{
if
(
state
.
message
===
'data-govern-show-metadata-list-callback-message'
)
{
form
?.
setFieldsValue
({
'资产项'
:
state
.
data
?.
metadataInfoJson
||
''
});
if
((
state
.
data
?.
metadataId
||
''
)
!==
''
)
{
fillElementValueBeforeCreate
(
state
.
data
?.
metadataId
||
''
);
}
}
});
return
(
(
filterElements
??[]).
map
((
element
,
_index
)
=>
{
(
filterElements
??[]).
map
((
element
,
_index
)
=>
{
return
(
return
(
<
Form
.
Item
<
Form
.
Item
...
@@ -278,19 +346,17 @@ const AssetInfoItem = ({ items, onChange }) => {
...
@@ -278,19 +346,17 @@ const AssetInfoItem = ({ items, onChange }) => {
name=
{
element
.
name
}
name=
{
element
.
name
}
key=
{
_index
}
key=
{
_index
}
>
>
{
(
element
.
name
===
'资产项'
)
?
<
MetadataInfo
config
=
{
false
}
/>
:
<
Input
disabled=
{
element
.
manualMaintain
===
'否'
}
/>
}
{
(
element
.
name
===
'资产项'
)
?
<
AssetItem
readonly
=
{
false
}
/>
:
<
Input
disabled=
{
element
.
manualMaintain
===
'否'
}
/>
}
</
Form
.
Item
>
</
Form
.
Item
>
)
)
})
})
);
}
}
}
</
AppContext
.
Consumer
>
</
Form
>
</
div
>
</
div
>
</
div
>
</
div
>
)
)
})
})
}
}
</
Form
>
</
Spin
>
</
Spin
>
</
React
.
Fragment
>
</
React
.
Fragment
>
)
)
...
...
src/view/Manage/AssetResourceManage/table.jsx
View file @
83c55773
...
@@ -37,8 +37,6 @@ const operationMap = {
...
@@ -37,8 +37,6 @@ const operationMap = {
addAsAsset
:
'新增为资产'
,
addAsAsset
:
'新增为资产'
,
distribute
:
'分配'
,
distribute
:
'分配'
,
reDistribute
:
'转分配'
,
reDistribute
:
'转分配'
,
autoDistribute
:
'自动分配'
,
batchEdit
:
'批量编辑'
,
check
:
'复核'
,
check
:
'复核'
,
changeToNotAsset
:
'转为非资产'
,
changeToNotAsset
:
'转为非资产'
,
changeToUncombed
:
'转为未梳理'
,
changeToUncombed
:
'转为未梳理'
,
...
@@ -249,7 +247,7 @@ const FC = (props) => {
...
@@ -249,7 +247,7 @@ const FC = (props) => {
_exportAble
=
(
permissions
??[]).
findIndex
(
item
=>
item
===
'export'
)
!==
-
1
_exportAble
=
(
permissions
??[]).
findIndex
(
item
=>
item
===
'export'
)
!==
-
1
}
else
{
}
else
{
let
[
allowImport
,
allowExport
]
=
[
true
,
true
]
let
[
allowImport
,
allowExport
]
=
[
true
,
true
]
for
(
const
row
of
selectedRows
)
{
for
(
const
row
of
selectedRows
??[]
)
{
const
importIndex
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'import'
)
const
importIndex
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'import'
)
const
exportIndex
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'export'
)
const
exportIndex
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'export'
)
if
(
importIndex
===
-
1
)
{
if
(
importIndex
===
-
1
)
{
...
@@ -265,7 +263,7 @@ const FC = (props) => {
...
@@ -265,7 +263,7 @@ const FC = (props) => {
}
}
let
[
allowAddAsAsset
,
allowDistribute
,
allowBatchEdit
,
allowCheck
,
allowChangeDirectory
,
allowDelete
]
=
[
true
,
true
,
true
,
true
,
true
,
true
]
let
[
allowAddAsAsset
,
allowDistribute
,
allowBatchEdit
,
allowCheck
,
allowChangeDirectory
,
allowDelete
]
=
[
true
,
true
,
true
,
true
,
true
,
true
]
for
(
const
row
of
selectedRows
)
{
for
(
const
row
of
selectedRows
??[]
)
{
const
addAsAssetIndex
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'addAsAsset'
)
const
addAsAssetIndex
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'addAsAsset'
)
const
distributeIndex
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'distribute'
)
const
distributeIndex
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'distribute'
)
const
batchEditIndex
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'batchEdit'
)
const
batchEditIndex
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'batchEdit'
)
...
@@ -898,7 +896,7 @@ const FC = (props) => {
...
@@ -898,7 +896,7 @@ const FC = (props) => {
onAutoDistributeTaskClick()
onAutoDistributeTaskClick()
} else if (key === 'batchEdit') {
} else if (key === 'batchEdit') {
onBatchEditClick()
onBatchEditClick()
}else if (key === 'check') {
}
else if (key === 'check') {
onCheckClick()
onCheckClick()
} else if (key === 'import') {
} else if (key === 'import') {
onImportClick()
onImportClick()
...
...
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