| | |
| | | |
| | | class EditableCell extends Component { |
| | | getInput = (form) => { |
| | | const { inputType } = this.props |
| | | const { inputType, record } = this.props |
| | | if (inputType === 'file') { |
| | | return <FileUpload maxFile={1} fileType="picture-card"/> |
| | | return <FileUpload config={{ |
| | | initval: record ? (record.$url || '') : '', |
| | | suffix: '', |
| | | maxfile: 1, |
| | | fileType: 'picture-card' |
| | | }}/> |
| | | } else { |
| | | return <Input onPressEnter={() => this.getValue(form)} /> |
| | | } |
| | |
| | | return |
| | | } |
| | | |
| | | if (row.$url && Array.isArray(row.$url)) { |
| | | if (!row.$url[0]) { |
| | | row.$url = '' |
| | | } else if (row.$url[0].origin) { |
| | | row.$url = row.$url[0].url || '' |
| | | } else if (!row.$url[0].origin && row.$url[0].status === 'done' && row.$url[0].response) { |
| | | row.$url = row.$url[0].response |
| | | } |
| | | } |
| | | this.props.onSave({...record, ...row}) |
| | | }) |
| | | } |
| | |
| | | |
| | | if (record && dataIndex) { |
| | | _val = record[dataIndex] |
| | | } |
| | | |
| | | if (dataIndex === '$url' && _val) { |
| | | _val = [{ |
| | | uid: `10086`, |
| | | name: _val.slice(_val.lastIndexOf('/') + 1), |
| | | status: 'done', |
| | | url: _val, |
| | | origin: true |
| | | }] |
| | | } else if (dataIndex === '$url') { |
| | | _val = [] |
| | | } |
| | | |
| | | return ( |
| | |
| | | return; |
| | | } |
| | | |
| | | if (row.$url && Array.isArray(row.$url)) { |
| | | if (!row.$url[0]) { |
| | | row.$url = '' |
| | | } else if (row.$url[0].origin) { |
| | | row.$url = row.$url[0].url || '' |
| | | } else if (!row.$url[0].origin && row.$url[0].status === 'done' && row.$url[0].response) { |
| | | row.$url = row.$url[0].response |
| | | } |
| | | } |
| | | |
| | | const newData = [...this.state.data] |
| | | const index = newData.findIndex(item => key === item.key) |
| | | if (index > -1) { |
| | |
| | | |
| | | handleAdd = () => { |
| | | const { fields, type } = this.props |
| | | if (this.state.data.length >= 20) { |
| | | if (this.state.data.length >= 100) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '最多可添加20项!', |
| | | message: '最多可添加100项!', |
| | | duration: 5 |
| | | }) |
| | | return |