king
2021-05-31 ce70be666bcd78a7e16e739040488cf7e7256cc2
src/templates/zshare/modalform/datatable/index.jsx
@@ -70,9 +70,14 @@
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)} />
    }
@@ -85,15 +90,6 @@
        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})
    })
  }
@@ -116,18 +112,6 @@
    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 (
@@ -289,16 +273,6 @@
    form.validateFields((error, row) => {
      if (error) {
        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]