From c0c820559b46f3a5ede6fbd7f66e77d09981829f Mon Sep 17 00:00:00 2001
From: Mr Ke <kelq@hugeinfo.com.cn>
Date: Wed, 29 Apr 2020 11:56:31 +0800
Subject: [PATCH] 提升菜单栏体验,升级公共查询表单组件

---
 src/components/page/DocumentEditPage/index.jsx |   31 +++++++++++++++----------------
 1 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/src/components/page/DocumentEditPage/index.jsx b/src/components/page/DocumentEditPage/index.jsx
index 65f4acf..4ec5c62 100644
--- a/src/components/page/DocumentEditPage/index.jsx
+++ b/src/components/page/DocumentEditPage/index.jsx
@@ -42,8 +42,6 @@
 
   loadData = () => {
     const { id } = this.props.match.params;
-    console.log(this.props)
-    console.log(id)
     let _this = this;
     _this.setState({
       loading: true,
@@ -55,15 +53,16 @@
         id: id || 'new'
       }
     }).then(res => {
-      console.log(res)
-      _this.setState({
-        saveData: {
-          ...res,
-          documentType: res.documentType || 'DT00002'
-        },
-        loading: false,
-        fileList: res.attachmentList && res.attachmentList.map((a) => ({ ...a, key: a.id, uid: a.id, name: a.fileName + '.' + a.suffix, })) || []
-      });
+      if (res) {
+        _this.setState({
+          saveData: {
+            ...res,
+            documentType: res.documentType || 'DT00002'
+          },
+          loading: false,
+          fileList: res.attachmentList && res.attachmentList.map((a) => ({ ...a, key: a.id, uid: a.id, name: a.fileName + '.' + a.suffix, })) || []
+        });
+      }
     });
   }
 
@@ -79,7 +78,6 @@
   submit = () => {
     let { saveData, editorContent } = this.state;
     // editorContent = emoveTAG(editorContent);
-    console.log(saveData)
     if (!saveData.documentTitle) {
       return message.warning(this.switchWordByType(saveData.documentType).title + '标题不能为空');
     }
@@ -98,12 +96,13 @@
         documentContent: editorContent
       }
     }).then(res => {
-      console.log(res)
       _this.setState({
         iconLoading: false,
       });
-      message.success("提交成功!");
-      this.props.history.push(this.switchWordByType(saveData.documentType).href);
+      if (res) {
+        message.success("提交成功!");
+        this.props.history.push(this.switchWordByType(saveData.documentType).href);
+      }
     });
   }
 
@@ -135,7 +134,7 @@
   }
 
   handleChange = (editorState) => {
-    console.log(editorState, editorState.toHTML())
+    console.log('htnl', editorState.toHTML())
     this.setState({ editorState, editorContent: editorState.toHTML() })
   }
 

--
Gitblit v1.8.0