| | |
| | | import React, {Component} from 'react' |
| | | import { fromJS } from 'immutable' |
| | | |
| | | class Documents extends Component { |
| | | state = { |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | const { documents } = this.props |
| | | const { documents, list } = this.props |
| | | |
| | | let actFolder = documents[0] || null |
| | | let actFolder = null |
| | | |
| | | if (documents[0]) { |
| | | actFolder = fromJS(documents[0]).toJS() |
| | | |
| | | let ids = list.map(item => item.id) |
| | | actFolder.attachments = actFolder.attachments.filter(doc => !ids.includes(doc.id)) |
| | | } |
| | | |
| | | this.setState({selectKey: [], actFolder: actFolder}) |
| | | } |
| | |
| | | } |
| | | |
| | | checkfolder = (id) => { |
| | | const { documents } = this.props |
| | | const { documents, list } = this.props |
| | | const { actFolder } = this.state |
| | | |
| | | if (!actFolder || actFolder.id === id) return |
| | | |
| | | let _actFolder = null |
| | | let ids = list.map(item => item.id) |
| | | documents.forEach(item => { |
| | | if (item.id === id) { |
| | | _actFolder = item |
| | | _actFolder = fromJS(item).toJS() |
| | | _actFolder.attachments = _actFolder.attachments.filter(doc => !ids.includes(doc.id)) |
| | | } |
| | | }) |
| | | |