mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 16:29:17 +08:00
feat: 优化文件复制-粘贴逻辑 (#2830)
This commit is contained in:
parent
dd60eb099d
commit
80f916f4c7
@ -109,13 +109,7 @@ const changeType = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const submit = async (formEl: FormInstance | undefined) => {
|
const mvFile = () => {
|
||||||
if (!formEl) return;
|
|
||||||
await formEl.validate((valid) => {
|
|
||||||
if (!valid) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
loading.value = true;
|
|
||||||
MoveFile(addForm)
|
MoveFile(addForm)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if (type.value === 'cut') {
|
if (type.value === 'cut') {
|
||||||
@ -128,6 +122,16 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||||||
.finally(() => {
|
.finally(() => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const submit = async (formEl: FormInstance | undefined) => {
|
||||||
|
if (!formEl) return;
|
||||||
|
await formEl.validate((valid) => {
|
||||||
|
if (!valid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
loading.value = true;
|
||||||
|
mvFile();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -136,20 +140,21 @@ const acceptParams = async (props: MoveProps) => {
|
|||||||
addForm.oldPaths = props.oldPaths;
|
addForm.oldPaths = props.oldPaths;
|
||||||
addForm.type = props.type;
|
addForm.type = props.type;
|
||||||
addForm.newPath = props.path;
|
addForm.newPath = props.path;
|
||||||
|
type.value = props.type;
|
||||||
if (props.name && props.name != '') {
|
if (props.name && props.name != '') {
|
||||||
oldName.value = props.name;
|
oldName.value = props.name;
|
||||||
changeName.value = true;
|
|
||||||
const res = await CheckFile(props.path + '/' + props.name);
|
const res = await CheckFile(props.path + '/' + props.name);
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
|
changeName.value = true;
|
||||||
addForm.cover = false;
|
addForm.cover = false;
|
||||||
addForm.name = props.name + '-' + getDateStr();
|
addForm.name = props.name + '-' + getDateStr();
|
||||||
} else {
|
|
||||||
addForm.cover = true;
|
|
||||||
addForm.name = props.name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
type.value = props.type;
|
|
||||||
open.value = true;
|
open.value = true;
|
||||||
|
} else {
|
||||||
|
mvFile();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mvFile();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
defineExpose({ acceptParams });
|
defineExpose({ acceptParams });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user