ReminderModal.jsx 1.27 KB
Newer Older
DarkForst's avatar
DarkForst committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
import React from 'react';
import {Modal} from 'antd';

const ReminderModal = (props) => {
    const {
        visible,
        setVisible,
        removeAction,
        addAction,
        loading,
        setLoading,
        type,
        setSelectIds
    } = props
    const handleOk = () => {
        if(type === 'delete'){
            removeAction()
        }else{
            addAction()
        }
        setLoading(false)

    }
    const handleCancel = () => {
        // if(type === 'add'){
            // closeCurrentPage()
        // }
        setLoading(false)
        setVisible(false)
        setSelectIds([])
    }
    return <Modal
        title='操作提醒'
        visible={visible}
        confirmLoading={loading}
        onOk={handleOk}
        onCancel={handleCancel}
    >
        {/* {
            (type === 'delete' && '确认删除您所选择的设备?') ||
            (type === 'add' && '确认增加此新计划?') ||
            (type === 'edit' && '确认修改此新计划?')
        } */}
        {
            ({
                'delete': '确认删除您所选择的设备?',
                'add': '确认增加此新计划?',
                'edit': '确认修改此计划?'
            }[type])
        }
    </Modal>
}

export default ReminderModal;