DeleteOrgModal.jsx 1.33 KB
Newer Older
1 2 3 4
/*
 * @Description:
 * @Author: leizhe
 * @Date: 2022-01-13 17:26:14
5
 * @LastEditTime: 2022-04-27 11:24:57
6 7
 * @LastEditors: leizhe
 */
8 9
import React from 'react';
import { Modal, notification, message } from 'antd';
邓超's avatar
邓超 committed
10
import { deleteOrg } from '@/services/userManage/api';
11
import { Margin } from 'gojs';
12 13

const DeleteOrgModal = props => {
14
  const { title, visible, orgID, onCancel, updateTrees, orgTitle } = props;
15 16 17

  // 提交-删除机构
  const submitDeleteOrg = () =>
皮倩雯's avatar
皮倩雯 committed
18
    deleteOrg(orgID.id)
19
      .then(res => {
20
        if (res.msg === '') {
21 22 23 24 25 26 27 28 29 30
          onCancel();
          notification.success({
            message: '提交成功',
            duration: 2,
          });
          // 重新获取机构树与用户表
          updateTrees();
        } else {
          notification.error({
            message: '提交失败',
31
            description: res.msg,
32 33 34 35 36 37 38 39 40 41 42
          });
        }
      })
      .catch(err => {
        message.error(err);
      });
  return (
    <Modal
      title={title}
      visible={visible}
      onCancel={onCancel}
43
      maskClosable={false}
44 45 46 47
      onOk={submitDeleteOrg}
      okText="确认"
      cancelText="取消"
    >
48 49 50
      <p style={{ marginLeft: '17px' }}>
        即将删除<span style={{ color: 'red' }}>{orgTitle}</span>,是否确认删除?
      </p>
51 52 53 54 55
    </Modal>
  );
};

export default DeleteOrgModal;