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
157e6de2
Commit
157e6de2
authored
Oct 28, 2025
by
放生的三文鱼
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成草稿
parent
57d2e62e
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
182 additions
and
43 deletions
+182
-43
assetmanage.js
src/model/assetmanage.js
+9
-0
dataassetmanager.js
src/service/dataassetmanager.js
+18
-0
AssetDraft.jsx
src/view/Manage/AssetDraft/component/AssetDraft.jsx
+60
-8
assetData.jsx
src/view/Manage/AssetDraft/hooks/assetData.jsx
+49
-29
AssetAction.jsx
src/view/Manage/AssetManage/Component/AssetAction.jsx
+46
-6
No files found.
src/model/assetmanage.js
View file @
157e6de2
...
...
@@ -355,3 +355,12 @@ export function* listDraftDataAssetsByPage(payload) {
export
function
*
checkIsNeedSaveAsDraft
(
payload
)
{
return
yield
call
(
service
.
checkIsNeedSaveAsDraft
,
payload
)
}
// checkIsNeedSaveAsDraftDataAsset
export
function
*
checkIsNeedSaveAsDraftDataAsset
(
payload
)
{
return
yield
call
(
service
.
checkIsNeedSaveAsDraftDataAsset
,
payload
)
}
// saveAsDraftDataAsset
export
function
*
saveAsDraftDataAsset
(
payload
)
{
return
yield
call
(
service
.
saveAsDraftDataAsset
,
payload
)
}
src/service/dataassetmanager.js
View file @
157e6de2
import
{
PostJSON
,
GetJSON
,
PostFile
,
Post
,
Get
,
callFetchRaw
}
from
"../util/axios"
import
qs
from
"qs"
;
export
function
listDataAssets
(
payload
)
{
}
export
function
importElement
(
payload
)
{
return
PostFile
(
"/dataassetmanager/elementApi/import"
,
payload
);
}
...
...
@@ -346,10 +350,24 @@ export function deleteDraftDataAsset(payload) {
return
PostJSON
(
'/dataassetmanager/draftApi/deleteDrafts'
,
payload
);
}
// /draftApi/publishDrafts
export
function
publishDraftDataAsset
(
payload
)
{
return
PostJSON
(
`/dataassetmanager/draftApi/publishDrafts?
${
qs
.
stringify
(
payload
,
{
arrayFormat
:
'repeat'
})}
`
);
}
// /draftApi/getDraftDetail
export
function
getDraftDataAssetDetail
(
payload
)
{
return
PostJSON
(
'/dataassetmanager/draftApi/getDraftDetail'
,
payload
);
}
// /dataAssetApi/checkIsNeedSaveAsDraft
export
function
checkIsNeedSaveAsDraftDataAsset
(
payload
)
{
return
PostJSON
(
'/dataassetmanager/dataAssetApi/checkIsNeedSaveAsDraft'
,
payload
);
}
// /draftApi/saveAsDraft
export
function
saveAsDraftDataAsset
(
payload
)
{
return
PostJSON
(
'/dataassetmanager/draftApi/saveAsDraft'
,
payload
);
}
src/view/Manage/AssetDraft/component/AssetDraft.jsx
View file @
157e6de2
import
React
,
{
useCallback
}
from
"react"
;
import
React
,
{
useCallback
,
createContext
,
useMemo
}
from
"react"
;
import
{
Table
,
Button
,
...
...
@@ -9,16 +9,18 @@ import {
Modal
,
Pagination
,
}
from
"antd"
;
import
{
ExclamationCircleFilled
}
from
"@ant-design/icons"
;
import
{
useGetAssetDraft
}
from
"../hooks/assetData"
;
import
{
debounce
}
from
"lodash"
;
import
AssetDetailDrawer
from
"../../AssetManage/Component/AssetDetailDrawer"
;
import
"./index.less"
;
// 主组件
const
AssetManagementTable
=
()
=>
{
const
[
draftParams
,
setDraftParams
]
=
React
.
useState
({
visible
:
false
,
dirId
:
""
,
draftId
:
''
,
draftId
:
""
,
templateType
:
""
,
});
const
{
...
...
@@ -32,8 +34,13 @@ const AssetManagementTable = () => {
setPagination
,
dataLoading
,
draftData
,
getDraftData
,
selectedRowKeys
,
setSelectedRowKeys
,
batchDelete
,
batchPublish
,
}
=
useGetAssetDraft
({
setDraftParams
});
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
const
changeTemplate
=
(
value
)
=>
{
setCurrentTemplate
(
value
);
};
...
...
@@ -61,6 +68,31 @@ const AssetManagementTable = () => {
}));
};
const
rowSelection
=
{
onChange
:
(
selectedRowKeys
)
=>
{
setSelectedRowKeys
(
selectedRowKeys
);
},
};
const
showConfirm
=
(
type
)
=>
{
const
confirmed
=
modal
.
confirm
({
title
:
"提示"
,
content
:
`确认
${
type
}
选中的草稿吗?`
,
onOk
:
()
=>
{
if
(
type
===
"删除"
)
{
batchDelete
();
}
else
if
(
type
===
"送审"
)
{
batchPublish
();
}
confirmed
.
destroy
();
},
});
};
const
hasItems
=
useMemo
(()
=>
{
return
selectedRowKeys
.
length
===
0
;
},
[
selectedRowKeys
]);
return
(
<
div
style=
{
{
background
:
"#fff"
}
}
className=
"container"
>
{
/* 操作按钮区域 */
}
...
...
@@ -81,10 +113,26 @@ const AssetManagementTable = () => {
value=
{
currentTemplate
}
onChange=
{
changeTemplate
}
/>
<
Button
>
批量修改
</
Button
>
<
Button
>
导出
</
Button
>
<
Button
type=
"primary"
>
送审
</
Button
>
<
Button
danger
>
删除
</
Button
>
<
Button
disabled=
{
hasItems
}
>
批量修改
</
Button
>
<
Button
disabled=
{
hasItems
}
>
导出
</
Button
>
<
Button
disabled=
{
hasItems
}
type=
"primary"
onClick=
{
()
=>
{
showConfirm
(
"送审"
);
}
}
>
送审
</
Button
>
<
Button
disabled=
{
hasItems
}
danger
onClick=
{
()
=>
{
showConfirm
(
"删除"
);
}
}
>
删除
</
Button
>
</
Space
>
<
Space
>
...
...
@@ -127,6 +175,8 @@ const AssetManagementTable = () => {
pagination=
{
null
}
size=
"middle"
scroll=
{
{
x
:
true
}
}
rowSelection=
{
rowSelection
}
rowKey=
{
"id"
}
/>
<
Pagination
style=
{
{
margin
:
"12px auto"
,
textAlign
:
"center"
}
}
...
...
@@ -143,14 +193,16 @@ const AssetManagementTable = () => {
<
AssetDetailDrawer
{
...
draftParams
}
onCancel=
{
()
=>
{
getDraftData
();
setDraftParams
({
visible
:
false
,
dirId
:
""
,
draftId
:
''
,
draftId
:
""
,
templateType
:
""
,
});
}
}
/>
{
contextHolder
}
</
div
>
);
};
...
...
src/view/Manage/AssetDraft/hooks/assetData.jsx
View file @
157e6de2
...
...
@@ -5,10 +5,11 @@ import {
getDraftDataAsset
,
listFilterElementsGroupByType
,
deleteDraftDataAsset
,
publishDraftDataAsset
,
}
from
"../../../../service/dataassetmanager"
;
import
{
AssetItem
}
from
"../../AssetManage/Component/AssetTable"
;
import
{
showMessage
}
from
"../../../../util"
;
import
LocalStorage
from
'local-storage'
;
import
{
showMessage
,
showErrorNotifaction
}
from
"../../../../util"
;
import
LocalStorage
from
"local-storage"
;
import
{
appId
}
from
"../../../../App"
;
const
{
Text
}
=
Typography
;
...
...
@@ -28,6 +29,37 @@ export function useGetAssetDraft({ setDraftParams }) {
});
const
[
dataLoading
,
setDataLoading
]
=
useState
(
false
);
const
[
draftData
,
setDraftData
]
=
useState
();
const
[
selectedRowKeys
,
setSelectedRowKeys
]
=
useState
([]);
// 批量删除
const
batchDelete
=
async
(
id
=
""
)
=>
{
try
{
await
deleteDraftDataAsset
({
data
:
id
?
id
:
selectedRowKeys
,
});
showMessage
(
"success"
,
"删除成功"
);
getDraftData
();
}
catch
(
error
)
{
console
.
log
(
"error"
,
error
);
let
message
=
error
?.
ApiError
?.
cnMessage
||
"操作失败,请稍后再试"
;
showErrorNotifaction
(
"提示"
,
message
,
3
);
}
};
// 批量送审
const
batchPublish
=
async
(
id
=
""
)
=>
{
try
{
await
publishDraftDataAsset
({
draftIds
:
id
?
id
:
selectedRowKeys
,
});
showMessage
(
"success"
,
"送审成功"
);
getDraftData
();
}
catch
(
error
)
{
console
.
log
(
"error"
,
error
);
let
message
=
error
?.
ApiError
?.
cnMessage
||
"操作失败,请稍后再试"
;
showErrorNotifaction
(
"提示"
,
message
,
3
);
}
};
const
getTemplatesList
=
async
()
=>
{
try
{
setLoading
(
true
);
...
...
@@ -183,10 +215,7 @@ export function useGetAssetDraft({ setDraftParams }) {
width
:
160
,
render
:
(
text
,
record
)
=>
{
const
disabled
=
record
?.
draftState
!==
"draft"
;
const
handlePublish
=
()
=>
{
// 发布操作逻辑
console
.
log
(
"发布记录:"
,
record
);
};
const
handleEdit
=
(
record
)
=>
{
// 编辑操作逻辑
console
.
log
(
"编辑记录:"
,
record
);
...
...
@@ -197,33 +226,18 @@ export function useGetAssetDraft({ setDraftParams }) {
templateType
:
currentTemplate
,
});
};
const
handleDelete
=
async
(
record
)
=>
{
// 删除操作逻辑
console
.
log
(
"record:"
,
record
);
try
{
await
deleteDraftDataAsset
({
data
:
[
record
?.
id
],
});
showMessage
(
"success"
,
"删除成功"
);
getDraftData
();
}
catch
(
error
)
{
console
.
log
(
"error"
,
error
);
let
message
=
error
?.
ApiError
?.
cnMessage
||
"操作失败,请稍后再试"
;
showMessage
(
"warn"
,
message
);
}
};
return
(
<
div
>
<
Button
disabled=
{
disabled
}
type=
"link"
size=
"small"
onClick=
{
handlePublish
}
<
Popconfirm
title=
"确认送审吗?"
onConfirm=
{
()
=>
{
batchPublish
([
record
?.
id
]);
}
}
>
<
Button
disabled=
{
disabled
}
type=
"link"
size=
"small"
>
送审
</
Button
>
</
Popconfirm
>
<
Button
size=
"small"
waring
...
...
@@ -238,7 +252,7 @@ export function useGetAssetDraft({ setDraftParams }) {
<
Popconfirm
title=
"确认删除草稿?"
onConfirm=
{
()
=>
{
handleDelete
(
record
);
batchPublish
([
record
?.
id
]
);
}
}
>
<
Button
disabled=
{
disabled
}
size=
"small"
type=
"link"
danger
>
...
...
@@ -304,6 +318,7 @@ export function useGetAssetDraft({ setDraftParams }) {
setDataLoading
(
false
);
}
catch
(
error
)
{
setDataLoading
(
false
);
}
finally
{
}
};
...
...
@@ -324,5 +339,10 @@ export function useGetAssetDraft({ setDraftParams }) {
setPagination
,
dataLoading
,
draftData
,
getDraftData
,
selectedRowKeys
,
setSelectedRowKeys
,
batchDelete
,
batchPublish
,
};
}
src/view/Manage/AssetManage/Component/AssetAction.jsx
View file @
157e6de2
...
...
@@ -54,6 +54,7 @@ const AssetAction = (props) => {
const
[
currentDomainGroup
,
setCurrentDomainGroup
]
=
useState
(
undefined
);
const
[
currentBussinessDomain
,
setCurrentBussinessDomain
]
=
useState
(
undefined
);
const
[
canEdit
,
setEdit
]
=
useState
(
false
);
const
[
isExist
,
setIsExist
]
=
useState
(
false
);
const
[
metadata
,
setMetadata
]
=
useState
(
undefined
);
const
[
loadingMetadataColumnList
,
setLoadingMetadataColumnList
]
=
useState
(
false
);
const
[
metadataColumnList
,
setMetadataColumnList
]
=
useState
(
undefined
);
...
...
@@ -171,6 +172,7 @@ const AssetAction = (props) => {
setPagination
({...
pagination
,
pageNum
:
1
});
getElements
();
getDraftData
()
checkIsNeedSaveAsDraftDataAsset
()
}
else
if
((
id
||
''
)
!==
''
)
{
setPagination
({...
pagination
,
pageNum
:
1
});
...
...
@@ -387,6 +389,21 @@ const AssetAction = (props) => {
})
}
// 判断当前模版内容操作需不需要保存为草稿
const
checkIsNeedSaveAsDraftDataAsset
=
()
=>
{
dispatch
({
type
:
'assetmanage.checkIsNeedSaveAsDraftDataAsset'
,
payload
:
{
params
:
{
templateType
}
},
callback
:
value
=>
{
setEdit
(
value
);
}
})
}
const
getAsset
=
(
userElements
=
null
)
=>
{
setLoading
(
true
);
dispatch
({
...
...
@@ -478,7 +495,7 @@ const AssetAction = (props) => {
},
callback
:
data
=>
{
setLoading
(
false
);
setIsExist
(
data
?.
existDraft
)
const
metadataIndex
=
data
?.
elements
?.
findIndex
(
item
=>
item
.
name
===
'资产项'
);
if
(
metadataIndex
!==
-
1
)
{
...
...
@@ -652,7 +669,29 @@ const AssetAction = (props) => {
}
setConfirmLoading(true);
console.log('assets',assets);
console.log('newElements',newElements);
if(draftId){
dispatch({
type: 'assetmanage.saveAsDraftDataAsset',
payload: {
params: {
operation:'change'
},
data:{ ...assets, elements: newElements }
},
callback: () => {
setConfirmLoading(false);
setCurrentAction('detail');
getDraftData();
showMessage("success",(action==='add')?"新增成功":"修改成功");
onChange && onChange();
},
error: () => {
setConfirmLoading(false);
}
})
}else{
dispatch({
type: 'assetmanage.checkCodeIsExist',
payload: {
...
...
@@ -686,7 +725,7 @@ const AssetAction = (props) => {
setConfirmLoading(false);
}
})
}
} catch (errInfo) {
showMessage('warn', '请完成资产必填项')
}
...
...
@@ -950,12 +989,13 @@ const AssetAction = (props) => {
}}
>
{
(!readonly && (reference===AssetManageReference||canEdit)) && <div className='flex' style={{ justifyContent: 'right' }}>
(!readonly && (reference===AssetManageReference||canEdit
||draftId
)) && <div className='flex' style={{ justifyContent: 'right' }}>
<Space>
{
currentAction==='detail' ? <
Button type='primary' onClick={onActionButtonClick}>编辑</Button
> : <React.Fragment>
currentAction==='detail' ? <
Tooltip title={isExist?'资产存在草稿箱中,不允许编辑':''}><Button type='primary' disabled={isExist} onClick={onActionButtonClick}>编辑</Button></Tooltip
> : <React.Fragment>
<Button type='primary' onClick={onCancelButtonClick}>取消</Button>
<Button type='primary' onClick={onActionButtonClick}>保存</Button>
{(canEdit&&draftId)?<Button type='primary' onClick={onActionButtonClick}>保存为草稿</Button>:
<Button type='primary' onClick={onActionButtonClick}>保存</Button>}
</React.Fragment>
}
{/* <Button type='primary' onClick={onAuthorizationButtonClick}>授权</Button> */}
...
...
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