|
@@ -19,14 +19,11 @@ function AddRole(props){
|
|
|
function handleOk() {
|
|
|
back()
|
|
|
}
|
|
|
- function getChange(){
|
|
|
- setIsChange(true)
|
|
|
- }
|
|
|
function handleCancel() {
|
|
|
setVisible(false)
|
|
|
}
|
|
|
const goback = () => {
|
|
|
- if ((form.getFieldsValue().name != undefined || isChange) && !detail) {
|
|
|
+ if (form.isFieldsTouched()) {
|
|
|
setVisible(true)
|
|
|
} else {
|
|
|
back()
|
|
@@ -41,7 +38,7 @@ function AddRole(props){
|
|
|
<Breadcrumb.Item>新增角色</Breadcrumb.Item>
|
|
|
</Breadcrumb>
|
|
|
<div className="add-container">
|
|
|
- <ContentForm back={goback} form={form} getChange={getChange}></ContentForm>
|
|
|
+ <ContentForm back={goback} form={form}></ContentForm>
|
|
|
</div>
|
|
|
<Modal
|
|
|
title="提示"
|
|
@@ -64,7 +61,7 @@ function ContentForm(props){
|
|
|
const [activeTab, setActiveTab] = useState('');
|
|
|
const { save,detail } = useContext(RoleContext);
|
|
|
const [sysCheckeds, setSysCheckeds] = useState();
|
|
|
- const { back, form, getChange } = props;
|
|
|
+ const { back, form } = props;
|
|
|
const initialValues=detail||{
|
|
|
status:'1'
|
|
|
};
|
|
@@ -158,7 +155,6 @@ function ContentForm(props){
|
|
|
form.setFieldsValue({
|
|
|
softwares:arr
|
|
|
});
|
|
|
- getChange()
|
|
|
}
|
|
|
function onTabChange(activeTab){
|
|
|
setActiveTab(activeTab.split('-')[0])
|