Commit 87ee4442 by zhaochengxiang

草稿状态

parent 03638d17
......@@ -190,6 +190,10 @@ export function* loadDataAssets(payload) {
return yield call(service.loadDataAssets, payload);
}
export function* listDraftStates() {
return yield call(service.listDraftStates)
}
export function* loadDataAssetsAsDraft(payload) {
return yield call(service.loadDataAssetsAsDraft, payload);
}
......
......@@ -92,6 +92,10 @@ export function loadDataAssets(payload) {
return PostJSON("/dataassetmanager/dataAssetApi/loadDataAssets", payload);
}
export function listDraftStates() {
return GetJSON("/dataassetmanager/draftApi/listDraftStates")
}
export function loadDataAssetsAsDraft(payload) {
return PostJSON("/dataassetmanager/draftApi/loadDataAssetsAsDraft", payload)
}
......
......@@ -30,18 +30,20 @@ const operationMap = {
changeToPendingSubmit: '转为待提交',
}
const draftStates = [
{ id: 'PENDINGSUBMIT', name: '待提交' },
{ id: 'tobeReleased', name: '待发布' },
{ id: 'PROCESSING', name: '处理中' },
{ id: 'DONE', name: '已完成' },
{ id: 'PUBLISHED', name: '已发布' },
]
// const draftStates = [
// { id: 'PENDINGSUBMIT', name: '待提交' },
// { id: 'tobeReleased', name: '待发布' },
// { id: 'PROCESSING', name: '处理中' },
// { id: 'DONE', name: '已完成' },
// { id: 'PUBLISHED', name: '已发布' },
// ]
const FC = (props) => {
const [loadingTemplates, setLoadingTemplates] = React.useState(false)
const [templates, setTemplates] = React.useState()
const [currentTemplateValue, setTemplateValue] = React.useState()
const [loadingDraftStates, setLoadingDraftStates] = React.useState(false)
const [draftStates, setDraftStates] = React.useState()
const [pagination, setPagination] = React.useState({ pageNum: 1, pageSize: 20 })
const [currentElementValue, setElementValue] = React.useState()
const [keyword, setKeyword] = React.useState()
......@@ -86,6 +88,7 @@ const FC = (props) => {
getAdmin()
getUsers()
getTemplates()
getStates()
}, [])
React.useEffect(() => {
......@@ -337,8 +340,30 @@ const FC = (props) => {
})
}
const getStates = () => {
setLoadingDraftStates(true)
dispatch({
type: 'assetmanage.listDraftStates',
callback: data => {
setLoadingDraftStates(false)
setDraftStates(data)
},
error: () => {
setLoadingDraftStates(false)
}
})
}
const getDrafts = () => {
setLoading(true)
let code = null
if (draftState!==undefined&&draftState!==null&&draftState!=='') {
const index = (draftStates??[]).findIndex(item => item.id === draftState)
if (index !== -1) {
code = draftStates[index].state
}
}
dispatch({
type: 'assetmanage.getDrafts',
payload: {
......@@ -346,7 +371,7 @@ const FC = (props) => {
queryElementId: currentElementValue,
templateType: currentTemplateValue,
keyword: encodeURIComponent(keyword??''),
state: draftState,
state: code,
pageNum: pagination.pageNum,
pageSize: pagination.pageSize,
},
......@@ -570,11 +595,12 @@ const FC = (props) => {
onChange={(val) => {
setDraftState(val)
}}
loading={loadingDraftStates}
style={{ width: 160 }}
>
{
draftStates.map((item, index) => (
<Select.Option key={item.id} value={item.id}>{item.name}</Select.Option>
draftStates?.map((item, index) => (
<Select.Option key={item.id} value={item.id}>{item.desc}</Select.Option>
))
}
</Select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment