Commit 859070a9 by zhaochengxiang

资产送审

parent d3982338
......@@ -252,4 +252,8 @@ export function* updateResourceState(payload) {
export function* subs(payload) {
return yield call(service.subs, payload);
}
export function* startFlow(payload) {
return yield call(service.startFlow, payload)
}
\ No newline at end of file
......@@ -258,4 +258,8 @@ export function updateResourceState(payload) {
export function subs(payload) {
return Get("/dataassetmanager/subApi/subs", payload);
}
export function startFlow(payload) {
return Post("/dataassetmanager/flowApi/startDataAssetFlow", payload);
}
\ No newline at end of file
......@@ -17,6 +17,7 @@ import { AnchorId, AnchorDirId, AnchorTimestamp, AssetBrowseReference, AssetMana
import { FullScreenSvg, CancelFullScreenSvg } from './AssetSvg';
import AssetDeleteModal from './AssetDeleteModal';
import { AppContext } from "../../../../App";
import StartFlowModal from "./StartFlow";
import "./AssetTable.less";
import 'react-contexify/dist/ReactContexify.css';
......@@ -149,6 +150,7 @@ const AssetTable = (props) => {
const [ TableWidth, setTableWidth ] = useState(0);
const [ compact, setCompact ] = useState(false);
const [ assetDeleteModalVisible, setAssetDeleteModalVisible ] = useState(false);
const [ startFlowModalVisible, setStartFlowModalVisible ] = useState(false);
const [ modal, contextHolder ] = Modal.useModal();
const anchorId = getQueryParam(AnchorId, props?.location?.search);
......@@ -726,6 +728,17 @@ const AssetTable = (props) => {
onFullScreenChange && onFullScreenChange(!fullScreen);
}
const onStartFlowClick = () => {
setStartFlowModalVisible(true);
}
const onStartFlowModalCancel = (refresh = false) => {
setStartFlowModalVisible(false);
if (refresh) {
setCheckedKeys([]);
}
}
const handleResize = index => (e, { size }) => {
const nextColumns = [...realColumns];
nextColumns[index] = {
......@@ -802,6 +815,14 @@ const AssetTable = (props) => {
const moreMenu = (
<Menu>
{
(reference===AssetManageReference) &&
<Menu.Item disabled={(checkedKeys||[]).length===0}>
<div className='text-center' onClick={onStartFlowClick}>
送审
</div>
</Menu.Item>
}
{
(reference!==AssetRecycleReference) &&
<Menu.Item disabled={(checkedKeys||[]).length===0}>
<div className='text-center' onClick={subscriptAsset}>
......@@ -888,6 +909,13 @@ const AssetTable = (props) => {
<Button>其他操作</Button>
</Dropdown> : <React.Fragment>
{
(reference===AssetManageReference) &&
<Tooltip title={(checkedKeys||[]).length===0?'请先选择资产':''}>
<Button onClick={onStartFlowClick} disabled={(checkedKeys||[]).length===0} >送审</Button>
</Tooltip>
}
{
(reference!==AssetRecycleReference) &&
<Tooltip title={(checkedKeys||[]).length===0?'请先选择资产':''}>
<Button onClick={subscriptAsset} disabled={(checkedKeys||[]).length===0} >订阅</Button>
......@@ -1056,6 +1084,11 @@ const AssetTable = (props) => {
onDelete={onAssetDeleteModalDelete}
onDeleteAll={onAssetDeleteModalDeleteAll}
/>
<StartFlowModal
visible={startFlowModalVisible}
ids={checkedKeys||[]}
onCancel={onStartFlowModalCancel}
/>
<RcMenu id={MENU_ID}>
{/* {
(contextMenuItem.resourceState==='notRelatedAsset') && <RcItem id="uncombed" onClick={handleItemClick}>
......
import React, { useState, useContext } from 'react';
import { Modal, Form, Input } from 'antd';
import { dispatchLatest } from '../../../../model';
import { showNotifaction } from '../../../../util';
import { AppContext } from '../../../../App';
const StartFlowModal = (props) => {
const { visible, onCancel, ids } = props;
const [ form ] = Form.useForm();
const [ confirmLoading, setConfirmLoading ] = useState(false);
const app = useContext(AppContext);
const formItemLayout = {
labelCol: {
xs: { span: 24 },
sm: { span: 4 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 20 },
},
};
const handleOk = async () => {
try {
const values = await form.validateFields();
setConfirmLoading(true);
dispatchLatest({
type: 'assetmanage.startFlow',
payload: {
params: {
env: app?.env?.domainId,
dataAssetIds: ids.join(','),
flowDesc: values?.desc
}
},
callback: data => {
reset();
if ((data||'') !== '') {
showNotifaction('送审提示', data, 5);
}
onCancel && onCancel(true);
},
error: () => {
setConfirmLoading(false);
}
})
} catch (errInfo) {
}
}
const reset = () => {
setConfirmLoading(false);
form.resetFields();
}
return (
<Modal
forceRender
visible={visible}
title='资产送审'
width={520}
confirmLoading={confirmLoading}
onCancel={() => {
reset();
onCancel && onCancel();
}}
onOk={handleOk}
>
<Form
{...formItemLayout}
form={form}
>
<Form.Item
label="送审内容"
name="desc"
rules={[{ required: true, message: '请填写送审内容' }]}
>
<Input.TextArea rows={6} />
</Form.Item>
</Form>
</Modal>
);
}
export default StartFlowModal;
\ No newline at end of file
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