forked from huge/frontEnd/hugeOA

Mr Ke
2020-04-29 c0c820559b46f3a5ede6fbd7f66e77d09981829f
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() })
  }