import React, { Component } from 'react'; import {Button, message} from "antd"; import ProForm, { ModalForm, ProFormText, ProFormDateRangePicker, ProFormSelect, } from '@ant-design/pro-form'; import { addSupPermission, addPermission, } from '../services/API'; import { urlType } from '@/utils/dataDic'; class NewPermission extends Component{ constructor(props) { super(props); this.newPermission = this.newPermission.bind(this); this.addNewPermission = this.addNewPermission.bind(this); } // 添加导航权限 newPermission= async(values) => { const msg = await addSupPermission(values); if(msg.error.length === 0){ message.success('新增成功'); this.props.tableRef.current.reload();// 刷新列表 this.props.onCancel(); }else{ message.warning(msg.error[0].message); } } // 添加导航下级权限 addNewPermission= async(values) => { const msg = await addPermission({...values,superId:this.props.superData.name}); if(msg.error.length === 0){ message.success('新增成功'); this.props.tableRef.current.reload();// 刷新列表 this.props.onCancel(); }else{ message.warning(msg.error[0].message); } } render() { return ( {e.stopPropagation();this.props.onCancel && this.props.onCancel();}, }} onFinish={this.props.superData ? this.addNewPermission : this.newPermission} > urlType} /> {this.props.superData && 上级功能模块: {this.props.superData.name} } ); } } export default NewPermission