Commit 7b5fd0d3 by zhaochengxiang

复核

parent b10d7767
...@@ -302,6 +302,10 @@ export function* deleteResources(payload) { ...@@ -302,6 +302,10 @@ export function* deleteResources(payload) {
return yield call(service.deleteResources, payload) return yield call(service.deleteResources, payload)
} }
export function* checkResources(payload) {
return yield call(service.checkResources, payload)
}
export function* getTasks(payload) { export function* getTasks(payload) {
return yield call(service.getTasks, payload) return yield call(service.getTasks, payload)
} }
......
...@@ -292,6 +292,10 @@ export function getPreviewRangeByDirId(payload) { ...@@ -292,6 +292,10 @@ export function getPreviewRangeByDirId(payload) {
return PostJSON("/dataassetmanager/resourceApi/deleteResources", payload) return PostJSON("/dataassetmanager/resourceApi/deleteResources", payload)
} }
export function checkResources(payload) {
return PostJSON("/dataassetmanager/resourceApi/check", payload)
}
export function getTasks(payload) { export function getTasks(payload) {
return GetJSON("/dataassetmanager/resource/taskApi/listTasksByPage", payload) return GetJSON("/dataassetmanager/resource/taskApi/listTasksByPage", payload)
} }
......
import React from 'react'
import { Modal, Button, Spin, Form, Radio } from 'antd'
import { dispatch } from '../../../model'
const FC = (props) => {
const { items, visible, onCancel } = props
const [waiting, setWaiting] = React.useState(false)
const basicRef = React.useRef()
const close = (refresh = false) => {
setWaiting(false)
onCancel?.(refresh)
}
const save = async() => {
try {
const rows = await basicRef.current?.validate()
setWaiting(true)
dispatch({
type: 'assetmanage.checkResources',
payload: {
params: {
resourceIds: (items??[]).filter(item => (item.allowButtons??[]).findIndex(item => item==='check') !== -1).map(item => item.id).toString(),
status: rows.status
},
},
callback: () => {
setWaiting(false)
onCancel(true)
},
error: () => {
setWaiting(false)
}
})
} catch (e) {
}
}
const footer = React.useMemo(() => {
return [
<Button key={'cancel'}
onClick={() => close()}
>取消</Button>,
<Button key={'save'} type='primary'
onClick={() => save()}
>确定</Button>
]
}, [close, save])
return (
<Modal
visible={visible}
footer={footer}
width={520}
bodyStyle={{ padding: '15px 15px 0px 15px', overflowX: 'auto', maxHeight: '80vh' }}
title='复核确认'
centered destroyOnClose
onCancel={() => { close() }}
>
<Spin spinning={waiting} >
<Basic ref={basicRef} items={items} />
</Spin>
</Modal>
)
}
export default FC
export const Basic = React.forwardRef(function ({ items }, ref) {
const [form] = Form.useForm()
React.useImperativeHandle(ref, () => ({
validate: async () => {
return await form.validateFields()
},
}), [form])
const checkInfo = React.useMemo(() => {
const toBeCheckCount = (items??[]).filter(item => (item.allowButtons??[]).findIndex(item => item==='check') !== -1).length
const noNeedToBeCheckCount = (items??[]).filter(item => (item.allowButtons??[]).findIndex(item => item==='check') === -1).length
return `已选数据:${(items??[]).length} 无需复核:${noNeedToBeCheckCount} 待复核:${toBeCheckCount}`
}, [items])
const onValuesChange = (changedValues, allValues) => {
console.log('all values', allValues)
}
return (
<Form
form={form}
labelCol={{ span: 3 }}
wrapperCol={{ span: 21 }}
autoComplete="off"
onValuesChange={onValuesChange}
>
<Form.Item style={{ marginBottom: 5 }}>
<span>{checkInfo}</span>
</Form.Item>
<Form.Item
name='status'
rules={[{ required: true, message: '请选择复核方式!' }]}
>
<Radio.Group>
<Radio value="checked"> 验证通过 </Radio>
<Radio value="changeToNotAsset"> 转为非资产 </Radio>
</Radio.Group>
</Form.Item>
</Form>
)
})
\ No newline at end of file
...@@ -27,6 +27,7 @@ import { AssetDirectorySubject } from '../AssetManage/Component/AssetDirectory' ...@@ -27,6 +27,7 @@ import { AssetDirectorySubject } from '../AssetManage/Component/AssetDirectory'
import { AssetActionSubject } from '../AssetManage/Component/AssetAction' import { AssetActionSubject } from '../AssetManage/Component/AssetAction'
import TagCell from '../Model/Component/tag-help' import TagCell from '../Model/Component/tag-help'
import DistributeTask from './distribute-task' import DistributeTask from './distribute-task'
import CheckAssets from './check-assets'
import '../AssetManage/Component/AssetTable.less' import '../AssetManage/Component/AssetTable.less'
...@@ -113,6 +114,10 @@ const FC = (props) => { ...@@ -113,6 +114,10 @@ const FC = (props) => {
visible: false, visible: false,
items: undefined items: undefined
}) })
const [checkAssetsParams, setCheckAssetsParams] = React.useState({
visible: false,
items: undefined
})
const [page, setPage] = usePage() const [page, setPage] = usePage()
const [modal, contextHolder] = Modal.useModal() const [modal, contextHolder] = Modal.useModal()
...@@ -626,7 +631,10 @@ const FC = (props) => { ...@@ -626,7 +631,10 @@ const FC = (props) => {
} }
const onCheckClick = () => { const onCheckClick = () => {
setCheckAssetsParams({
visible: true,
items: selectedRows
})
} }
const onImportClick = () => { const onImportClick = () => {
...@@ -743,6 +751,13 @@ const FC = (props) => { ...@@ -743,6 +751,13 @@ const FC = (props) => {
}) })
} }
const onRightCheckClick = () => {
setCheckAssetsParams({
visible: true,
items: [rightRow]
})
}
const onRightChangeToUncombedClick = () => { const onRightChangeToUncombedClick = () => {
modal.confirm({ modal.confirm({
title: '提示', title: '提示',
...@@ -871,7 +886,7 @@ const FC = (props) => { ...@@ -871,7 +886,7 @@ const FC = (props) => {
} else if (key === '转分配') { } else if (key === '转分配') {
} else if (key === '复核') { } else if (key === '复核') {
onRightCheckClick()
} else if (key === '转为非资产') { } else if (key === '转为非资产') {
onRightChangeToNotAssetClick() onRightChangeToNotAssetClick()
} else if (key === '转为未梳理') { } else if (key === '转为未梳理') {
...@@ -1343,6 +1358,17 @@ const FC = (props) => { ...@@ -1343,6 +1358,17 @@ const FC = (props) => {
refresh && getAssets() refresh && getAssets()
}} }}
/> />
<CheckAssets
{...checkAssetsParams}
onCancel={(refresh) => {
setCheckAssetsParams({
visible: false,
items: undefined
})
refresh && getAssets()
}}
/>
{contextHolder} {contextHolder}
</div> </div>
) )
......
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