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
11105d8e
Commit
11105d8e
authored
Jan 22, 2024
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
岗位
parent
7278b225
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
13 deletions
+50
-13
AddAssetModel.jsx
src/view/Manage/AssetManage/Component/AddAssetModel.jsx
+3
-2
post-relation.jsx
src/view/Manage/AssetManage/Component/post-relation.jsx
+47
-11
No files found.
src/view/Manage/AssetManage/Component/AddAssetModel.jsx
View file @
11105d8e
...
@@ -3,6 +3,7 @@ import { Modal, Form, Space, Button, Spin } from 'antd';
...
@@ -3,6 +3,7 @@ import { Modal, Form, Space, Button, Spin } from 'antd';
import
{
showMessage
}
from
'../../../../util'
;
import
{
showMessage
}
from
'../../../../util'
;
import
{
dispatch
}
from
'../../../../model'
;
import
{
dispatch
}
from
'../../../../model'
;
import
AssetAction
from
'./AssetAction'
;
import
AssetAction
from
'./AssetAction'
;
import
{
getTemplateType
}
from
'../../../../util/axios'
;
const
AddAssetModel
=
(
props
)
=>
{
const
AddAssetModel
=
(
props
)
=>
{
const
{
onCancel
,
visible
,
nodeId
}
=
props
;
const
{
onCancel
,
visible
,
nodeId
}
=
props
;
...
@@ -48,9 +49,9 @@ const AddAssetModel = (props) => {
...
@@ -48,9 +49,9 @@ const AddAssetModel = (props) => {
payload
:
{
payload
:
{
params
:
{
params
:
{
dirId
:
nodeId
,
dirId
:
nodeId
,
operation
:
'
chang
e'
,
operation
:
'
releas
e'
,
},
},
data
:
{
elements
:
newElements
}
data
:
{
elements
:
newElements
,
templateType
:
getTemplateType
()
}
},
},
callback
:
()
=>
{
callback
:
()
=>
{
showMessage
(
"success"
,
"新增成功"
);
showMessage
(
"success"
,
"新增成功"
);
...
...
src/view/Manage/AssetManage/Component/post-relation.jsx
View file @
11105d8e
...
@@ -7,8 +7,7 @@ import SelectResource from './select-resource'
...
@@ -7,8 +7,7 @@ import SelectResource from './select-resource'
import
{
dispatch
}
from
'../../../../model'
;
import
{
dispatch
}
from
'../../../../model'
;
import
{
AssetDraftReference
}
from
'../../../../util/constant'
import
{
AssetDraftReference
}
from
'../../../../util/constant'
const
FC
=
(
props
)
=>
{
const
FC
=
React
.
forwardRef
(
function
({
item
,
reference
,
action
},
ref
)
{
const
{
item
,
reference
,
action
}
=
props
const
[
activeKey
,
setActiveKey
]
=
React
.
useState
(
'asset'
)
const
[
activeKey
,
setActiveKey
]
=
React
.
useState
(
'asset'
)
const
[
keyword
,
setKeyword
]
=
React
.
useState
()
const
[
keyword
,
setKeyword
]
=
React
.
useState
()
const
[
pagination
,
setPagination
]
=
React
.
useState
({
const
[
pagination
,
setPagination
]
=
React
.
useState
({
...
@@ -28,11 +27,22 @@ const FC = (props) => {
...
@@ -28,11 +27,22 @@ const FC = (props) => {
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
()
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
()
// React.useImperativeHandle(ref, () => ({
// selectedRows
// }), [selectedRows])
React
.
useEffect
(()
=>
{
React
.
useEffect
(()
=>
{
getRelatedAssets
()
getRelatedAssets
()
getRelatedServices
()
getRelatedServices
()
},
[])
},
[])
React
.
useEffect
(()
=>
{
if
(
item
)
{
setAssets
(
item
?.
postAssets
)
setServices
(
item
?.
postServices
)
}
},
[
item
])
const
[
tableData
,
total
]
=
React
.
useMemo
(()
=>
{
const
[
tableData
,
total
]
=
React
.
useMemo
(()
=>
{
let
newTableData
=
(
activeKey
===
'asset'
)?[...
assets
??[]]:[...
services
??[]]
let
newTableData
=
(
activeKey
===
'asset'
)?[...
assets
??[]]:[...
services
??[]]
if
(
keyword
)
{
if
(
keyword
)
{
...
@@ -42,7 +52,28 @@ const FC = (props) => {
...
@@ -42,7 +52,28 @@ const FC = (props) => {
return
[
paginate
(
newTableData
,
pagination
.
pageNum
,
pagination
.
pageSize
),
(
newTableData
??[]).
length
]
return
[
paginate
(
newTableData
,
pagination
.
pageNum
,
pagination
.
pageSize
),
(
newTableData
??[]).
length
]
},
[
activeKey
,
assets
,
services
,
keyword
,
pagination
])
},
[
activeKey
,
assets
,
services
,
keyword
,
pagination
])
const
cols
=
[
const
assetCols
=
[
{
title
:
'序号'
,
dataIndex
:
'index'
,
width
:
60
,
render
:(
_
,
__
,
index
)
=>
((
pagination
.
pageNum
-
1
)
*
pagination
.
pageSize
+
index
+
1
)
},
{
title
:
'路径'
,
dataIndex
:
'path'
,
},
{
title
:
'资产编码'
,
dataIndex
:
'relatedAssetCode'
,
},
{
title
:
'名称'
,
dataIndex
:
'name'
,
},
]
const
seriveCols
=
[
{
{
title
:
'序号'
,
title
:
'序号'
,
dataIndex
:
'index'
,
dataIndex
:
'index'
,
...
@@ -55,7 +86,7 @@ const FC = (props) => {
...
@@ -55,7 +86,7 @@ const FC = (props) => {
},
},
{
{
title
:
'数据服务资产编号'
,
title
:
'数据服务资产编号'
,
dataIndex
:
'
c
ode'
,
dataIndex
:
'
relatedServiceC
ode'
,
},
},
{
{
title
:
'数据服务名称'
,
title
:
'数据服务名称'
,
...
@@ -131,11 +162,15 @@ const FC = (props) => {
...
@@ -131,11 +162,15 @@ const FC = (props) => {
if
(
data
)
{
if
(
data
)
{
if
(
activeKey
===
'asset'
)
{
if
(
activeKey
===
'asset'
)
{
setAssets
(
prevAssets
=>
{
setAssets
(
prevAssets
=>
{
return
[...
prevAssets
??[],
...
data
]
const
filterData
=
(
data
??[]).
filter
(
item
=>
(
prevAssets
??[]).
map
(
_item
=>
_item
.
relatedAssetId
).
indexOf
(
item
.
relatedAssetId
)
===-
1
)
return
[...
prevAssets
??[],
...
filterData
]
})
})
}
else
if
(
activeKey
===
'service'
)
{
}
else
if
(
activeKey
===
'service'
)
{
setServices
(
prevServices
=>
{
setServices
(
prevServices
=>
{
return
[...
prevServices
??[],
...
data
]
const
filterData
=
(
data
??[]).
filter
(
item
=>
(
prevServices
??[]).
map
(
_item
=>
_item
.
relatedServiceId
).
indexOf
(
item
.
relatedServiceId
)
===-
1
)
return
[...
prevServices
??[],
...
filterData
]
})
})
}
}
}
}
...
@@ -149,15 +184,15 @@ const FC = (props) => {
...
@@ -149,15 +184,15 @@ const FC = (props) => {
</
Tabs
>
</
Tabs
>
<
div
style=
{
{
display
:
'flex'
,
justifyContent
:
'space-between'
}
}
>
<
div
style=
{
{
display
:
'flex'
,
justifyContent
:
'space-between'
}
}
>
{
{
action
===
'edit'
&&
<
Space
>
action
===
'edit'
?
<
Space
>
<
Button
onClick=
{
onEditClick
}
>
编辑
</
Button
>
<
Button
onClick=
{
onEditClick
}
>
编辑
</
Button
>
<
Tooltip
title=
{
(
selectedRows
??[]).
length
===
0
?(
activeKey
===
'asset'
?
'请先选择资产'
:
'请先选择服务'
):
''
}
>
<
Tooltip
title=
{
(
selectedRows
??[]).
length
===
0
?(
activeKey
===
'asset'
?
'请先选择资产'
:
'请先选择服务'
):
''
}
>
<
Button
disabled=
{
(
selectedRows
??[]).
length
===
0
}
onClick=
{
onDeleteClick
}
>
删除
</
Button
>
<
Button
disabled=
{
(
selectedRows
??[]).
length
===
0
}
onClick=
{
onDeleteClick
}
>
删除
</
Button
>
</
Tooltip
>
</
Tooltip
>
</
Space
>
</
Space
>
:
<
div
/>
}
}
<
Input
size=
"middle"
<
Input
size=
"middle"
placeholder=
{
activeKey
===
'
service'
?
'搜索服务名称'
:
'
'
}
placeholder=
{
activeKey
===
'
asset'
?
'搜索资产名称'
:
'搜索服务名称
'
}
value=
{
keyword
}
value=
{
keyword
}
bordered=
{
true
}
allowClear
bordered=
{
true
}
allowClear
style=
{
{
width
:
200
}
}
style=
{
{
width
:
200
}
}
...
@@ -170,7 +205,7 @@ const FC = (props) => {
...
@@ -170,7 +205,7 @@ const FC = (props) => {
<
Table
<
Table
rowKey=
'id'
rowKey=
'id'
loading=
{
loadingAssets
||
loadingServices
}
loading=
{
loadingAssets
||
loadingServices
}
columns=
{
c
ols
}
columns=
{
activeKey
===
'asset'
?
assetCols
:
seriveC
ols
}
dataSource=
{
tableData
??[]
}
dataSource=
{
tableData
??[]
}
pagination=
{
false
}
pagination=
{
false
}
rowSelection=
{
{
rowSelection=
{
{
...
@@ -202,6 +237,6 @@ const FC = (props) => {
...
@@ -202,6 +237,6 @@ const FC = (props) => {
{
contextHolder
}
{
contextHolder
}
</
div
>
</
div
>
)
)
}
}
)
export
default
FC
export
default
FC
\ 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