From ce70be666bcd78a7e16e739040488cf7e7256cc2 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 31 五月 2021 15:49:43 +0800 Subject: [PATCH] 2021-05-31 --- src/templates/zshare/modalform/datatable/index.jsx | 40 +++++++--------------------------------- 1 files changed, 7 insertions(+), 33 deletions(-) diff --git a/src/templates/zshare/modalform/datatable/index.jsx b/src/templates/zshare/modalform/datatable/index.jsx index 50e0cc6..e7a12a1 100644 --- a/src/templates/zshare/modalform/datatable/index.jsx +++ b/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] -- Gitblit v1.8.0