From 80f916f4c73bc643a29ae68dd5baf4ceeee11099 Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Tue, 7 Nov 2023 14:05:28 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=A4=8D=E5=88=B6-=E7=B2=98=E8=B4=B4=E9=80=BB=E8=BE=91=20(#283?= =?UTF-8?q?0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/host/file-management/move/index.vue | 39 +++++++++++-------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/frontend/src/views/host/file-management/move/index.vue b/frontend/src/views/host/file-management/move/index.vue index 722c2bd58..a55e8d8a2 100644 --- a/frontend/src/views/host/file-management/move/index.vue +++ b/frontend/src/views/host/file-management/move/index.vue @@ -109,6 +109,21 @@ const changeType = () => { } }; +const mvFile = () => { + MoveFile(addForm) + .then(() => { + if (type.value === 'cut') { + MsgSuccess(i18n.global.t('file.moveSuccess')); + } else { + MsgSuccess(i18n.global.t('file.copySuccess')); + } + handleClose(true); + }) + .finally(() => { + loading.value = false; + }); +}; + const submit = async (formEl: FormInstance | undefined) => { if (!formEl) return; await formEl.validate((valid) => { @@ -116,18 +131,7 @@ const submit = async (formEl: FormInstance | undefined) => { return; } loading.value = true; - MoveFile(addForm) - .then(() => { - if (type.value === 'cut') { - MsgSuccess(i18n.global.t('file.moveSuccess')); - } else { - MsgSuccess(i18n.global.t('file.copySuccess')); - } - handleClose(true); - }) - .finally(() => { - loading.value = false; - }); + mvFile(); }); }; @@ -136,20 +140,21 @@ const acceptParams = async (props: MoveProps) => { addForm.oldPaths = props.oldPaths; addForm.type = props.type; addForm.newPath = props.path; + type.value = props.type; if (props.name && props.name != '') { oldName.value = props.name; - changeName.value = true; const res = await CheckFile(props.path + '/' + props.name); if (res.data) { + changeName.value = true; addForm.cover = false; addForm.name = props.name + '-' + getDateStr(); + open.value = true; } else { - addForm.cover = true; - addForm.name = props.name; + mvFile(); } + } else { + mvFile(); } - type.value = props.type; - open.value = true; }; defineExpose({ acceptParams });