浏览代码

Merge remote-tracking branch 'origin/dev' into dev

zhouna 3 年之前
父节点
当前提交
a3d44a931c

+ 1 - 1
src/components/DataManager/AddData.js

@@ -57,7 +57,7 @@ function AddData(props) {
     setVisible(false)
   }
   const goback = () => {
-    if ((form.getFieldsValue().name != undefined || isChange) && !isEdit) {
+    if (form.isFieldsTouched()) {
       setVisible(true)
     } else {
       back()

+ 1 - 1
src/components/OrgManager/AddSubOrg.js

@@ -49,7 +49,7 @@ function AddSubOrg(props) {
         setVisible(false)
     }
     const goback = () => {
-        if (form.getFieldsValue().name != undefined && type != 2) {
+        if (form.isFieldsTouched()) {
             setVisible(true)
         } else {
             back()

+ 3 - 7
src/components/RoleManager/AddRole.js

@@ -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])