| | |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'fileupload') { |
| | | let filelist = this.props.data ? this.props.data[item.field] : item.initval |
| | | if (filelist && item.readin) { |
| | | try { |
| | | filelist = filelist.split(',').map((url, index) => { |
| | | return { |
| | | uid: `${index}`, |
| | | name: url.slice(url.lastIndexOf('/') + 1), |
| | | status: 'done', |
| | | url: url, |
| | | origin: true |
| | | } |
| | | }) |
| | | } catch { |
| | | filelist = [] |
| | | } |
| | | } else { |
| | | filelist = [] |
| | | } |
| | | |
| | | fields.push( |
| | | <Col span={item.span || 24} key={index}> |
| | | <Form.Item |
| | |
| | | } |
| | | > |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: filelist, |
| | | initialValue: item.initval || '', |
| | | rules: [ |
| | | { |
| | | required: item.required === 'true', |
| | |
| | | } |
| | | ] |
| | | })( |
| | | <FileUpload accept={item.suffix} maxFile={item.maxfile} fileType={item.fileType || 'text'} /> |
| | | <FileUpload config={item}/> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | |
| | | } else if (item.type === 'multiselect' || item.type === 'checkbox') { |
| | | _value = _value ? _value.join(',') : '' |
| | | |
| | | } else if (item.type === 'fileupload') { |
| | | let vals = [] |
| | | |
| | | if (_value && _value.length > 0) { |
| | | _value.forEach(_val => { |
| | | if (_val.origin && _val.url) { |
| | | vals.push(_val.url) |
| | | } else if (!_val.origin && _val.status === 'done' && _val.response) { |
| | | vals.push(_val.response) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | _value = vals.join(',') |
| | | } else if (item.type === 'text' || item.type === 'textarea') { |
| | | _value = _value.replace(/\t*|\v*/g, '') // 去除制表符 |
| | | |