| | |
| | | |
| | | list = list.map(item => { |
| | | item.icon = this.getIcon(item.attachments_url) |
| | | item.name = this.getName(item.attachments_url) |
| | | return item |
| | | }) |
| | | |
| | |
| | | file.attachments = file.attachments.map(item => { |
| | | item.id = item.attach_id |
| | | item.icon = this.getIcon(item.attachments_url) |
| | | item.name = this.getName(item.attachments_url) |
| | | item.data_code = file.data_code |
| | | item.data_name = file.data_name |
| | | item.BID = file.id |
| | |
| | | } |
| | | |
| | | item.icon = this.getIcon(res.url) |
| | | item.name = this.getName(res.url) |
| | | |
| | | list.push(item) |
| | | |
| | |
| | | |
| | | deleteFile = (id) => { |
| | | this.setState({list: this.state.list.filter(item => item.id !== id)}) |
| | | } |
| | | |
| | | getName = (url) => { |
| | | if (!url || !/\//.test(url)) return url |
| | | |
| | | let names = url.split('/') |
| | | |
| | | return names[names.length - 1] |
| | | } |
| | | |
| | | getIcon = (url) => { |
| | |
| | | <img src={item.icon} alt=""/> |
| | | <div className="attach-msg"> |
| | | <div>{item.attachments_title}</div> |
| | | <div>{item.data_name ? item.data_name + ' / ' : ''}{item.attachments_url}</div> |
| | | <div>{item.data_name ? item.data_name + ' / ' : ''}{item.name}</div> |
| | | </div> |
| | | <div> |
| | | <DeleteOutlined onClick={() => this.deleteFile(item.id)}/> |