import ConfirmButton from '../../components/common/ConfirmButton';
import { message } from "antd/lib/index";
import React from 'react';
import {Button} from 'antd';
export default {
    closed: ({ record, close, loadData, getLoadParam, login, btn, dispatch }) => {
        const confirmRevert = () => {
            dispatch({
                type: 'app/getDataByGet',
                url: 'FM/FMNotificationTask/Archive?ID='+record.ID,
                onComplete: (ret) => {
                    if (ret) {
                            //回调函数
                            dispatch({
                                type: 'app/getDataByGet',
                                url: ret + "?id=" + record.SOURCE_DATA_ID,
                                onlyData: false,
                                onComplete: (callbak) => {
                                    if (callbak && callbak.IsSuccessful) {
                                        message.success('执行成功');
                                        loadData();
                                    } else {
                                        message.error("归档失败");
                                    }
                                }
                            });
                    }
                    else {
                        message.error("归档失败");
                   }
                }
            })
        };
        const isReturn = record.NOTICE_STATUS !==0;
        return {
            content: <ConfirmButton isConfirm={true} confirmTitle="确认直接归档?" onClick={confirmRevert}
                type={'default'} icon={'close'} size="small" title={btn.LABEL} disabled={isReturn} />
        }
    },
};

