From 3c58171167cec1a567a63007c8e497cd6be0eb42 Mon Sep 17 00:00:00 2001 From: vapao Date: Mon, 4 Jul 2022 10:33:38 +0800 Subject: [PATCH] =?UTF-8?q?A=20=E6=96=87=E4=BB=B6=E5=88=86=E5=8F=91?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=A4=9A=E9=80=89=E6=96=87=E4=BB=B6=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_web/src/pages/exec/transfer/index.js | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/spug_web/src/pages/exec/transfer/index.js b/spug_web/src/pages/exec/transfer/index.js index fac1930..b7d82da 100644 --- a/spug_web/src/pages/exec/transfer/index.js +++ b/spug_web/src/pages/exec/transfer/index.js @@ -66,22 +66,13 @@ function TransferIndex() { .finally(() => setLoading(false)) } - function _handleAdd(type, name, path, host_id) { - let tmp = [] - if (type === 'upload' && files.length > 0 && files[0].type === type) { - tmp = [...files] - } - tmp.push({id: uniqueId(), type, name, path, host_id}) - setFiles(tmp) - } - function handleAddHostFile() { setSProps({ visible: true, onlyOne: true, selectedRowKeys: [], onCancel: () => setSProps({visible: false}), - onOk: (_, __, row) => _handleAdd('host', row.name, '', row.id), + onOk: (_, __, row) => setFiles([{id: uniqueId(), type: 'host', name: row.name, path: '', host_id: row.id}]), }) } @@ -94,8 +85,12 @@ function TransferIndex() { }) } - function handleUpload(file) { - _handleAdd('upload', '本地上传', file) + function handleUpload(_, fileList) { + const tmp = files.length > 0 && files[0].type === 'upload' ? [...files] : [] + for (let file of fileList) { + tmp.push({id: uniqueId(), type: 'upload', name: '本地上传', path: file}) + } + setFiles(tmp) return Upload.LIST_IGNORE } @@ -113,7 +108,7 @@ function TransferIndex() {