Commit 87ee4442 by zhaochengxiang

草稿状态

parent 03638d17
...@@ -190,6 +190,10 @@ export function* loadDataAssets(payload) { ...@@ -190,6 +190,10 @@ export function* loadDataAssets(payload) {
return yield call(service.loadDataAssets, payload); return yield call(service.loadDataAssets, payload);
} }
export function* listDraftStates() {
return yield call(service.listDraftStates)
}
export function* loadDataAssetsAsDraft(payload) { export function* loadDataAssetsAsDraft(payload) {
return yield call(service.loadDataAssetsAsDraft, payload); return yield call(service.loadDataAssetsAsDraft, payload);
} }
......
...@@ -92,6 +92,10 @@ export function loadDataAssets(payload) { ...@@ -92,6 +92,10 @@ export function loadDataAssets(payload) {
return PostJSON("/dataassetmanager/dataAssetApi/loadDataAssets", payload); return PostJSON("/dataassetmanager/dataAssetApi/loadDataAssets", payload);
} }
export function listDraftStates() {
return GetJSON("/dataassetmanager/draftApi/listDraftStates")
}
export function loadDataAssetsAsDraft(payload) { export function loadDataAssetsAsDraft(payload) {
return PostJSON("/dataassetmanager/draftApi/loadDataAssetsAsDraft", payload) return PostJSON("/dataassetmanager/draftApi/loadDataAssetsAsDraft", payload)
} }
......
...@@ -30,18 +30,20 @@ const operationMap = { ...@@ -30,18 +30,20 @@ const operationMap = {
changeToPendingSubmit: '转为待提交', changeToPendingSubmit: '转为待提交',
} }
const draftStates = [ // const draftStates = [
{ id: 'PENDINGSUBMIT', name: '待提交' }, // { id: 'PENDINGSUBMIT', name: '待提交' },
{ id: 'tobeReleased', name: '待发布' }, // { id: 'tobeReleased', name: '待发布' },
{ id: 'PROCESSING', name: '处理中' }, // { id: 'PROCESSING', name: '处理中' },
{ id: 'DONE', name: '已完成' }, // { id: 'DONE', name: '已完成' },
{ id: 'PUBLISHED', name: '已发布' }, // { id: 'PUBLISHED', name: '已发布' },
] // ]
const FC = (props) => { const FC = (props) => {
const [loadingTemplates, setLoadingTemplates] = React.useState(false) const [loadingTemplates, setLoadingTemplates] = React.useState(false)
const [templates, setTemplates] = React.useState() const [templates, setTemplates] = React.useState()
const [currentTemplateValue, setTemplateValue] = 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 [pagination, setPagination] = React.useState({ pageNum: 1, pageSize: 20 })
const [currentElementValue, setElementValue] = React.useState() const [currentElementValue, setElementValue] = React.useState()
const [keyword, setKeyword] = React.useState() const [keyword, setKeyword] = React.useState()
...@@ -86,6 +88,7 @@ const FC = (props) => { ...@@ -86,6 +88,7 @@ const FC = (props) => {
getAdmin() getAdmin()
getUsers() getUsers()
getTemplates() getTemplates()
getStates()
}, []) }, [])
React.useEffect(() => { React.useEffect(() => {
...@@ -337,8 +340,30 @@ const FC = (props) => { ...@@ -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 = () => { const getDrafts = () => {
setLoading(true) 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({ dispatch({
type: 'assetmanage.getDrafts', type: 'assetmanage.getDrafts',
payload: { payload: {
...@@ -346,7 +371,7 @@ const FC = (props) => { ...@@ -346,7 +371,7 @@ const FC = (props) => {
queryElementId: currentElementValue, queryElementId: currentElementValue,
templateType: currentTemplateValue, templateType: currentTemplateValue,
keyword: encodeURIComponent(keyword??''), keyword: encodeURIComponent(keyword??''),
state: draftState, state: code,
pageNum: pagination.pageNum, pageNum: pagination.pageNum,
pageSize: pagination.pageSize, pageSize: pagination.pageSize,
}, },
...@@ -570,11 +595,12 @@ const FC = (props) => { ...@@ -570,11 +595,12 @@ const FC = (props) => {
onChange={(val) => { onChange={(val) => {
setDraftState(val) setDraftState(val)
}} }}
loading={loadingDraftStates}
style={{ width: 160 }} style={{ width: 160 }}
> >
{ {
draftStates.map((item, index) => ( draftStates?.map((item, index) => (
<Select.Option key={item.id} value={item.id}>{item.name}</Select.Option> <Select.Option key={item.id} value={item.id}>{item.desc}</Select.Option>
)) ))
} }
</Select> </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