mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 16:29:17 +08:00
feat: 文件增加批量删除功能 (#521)
This commit is contained in:
parent
a481a8b322
commit
e3b542665d
@ -58,6 +58,9 @@
|
|||||||
<el-button plain @click="openDownload" :disabled="selects.length === 0">
|
<el-button plain @click="openDownload" :disabled="selects.length === 0">
|
||||||
{{ $t('file.download') }}
|
{{ $t('file.download') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button plain @click="batchDelFiles" :disabled="selects.length === 0">
|
||||||
|
{{ $t('commons.button.delete') }}
|
||||||
|
</el-button>
|
||||||
</el-button-group>
|
</el-button-group>
|
||||||
<div class="search search-button">
|
<div class="search search-button">
|
||||||
<el-input
|
<el-input
|
||||||
@ -170,7 +173,7 @@ import Process from './process/index.vue';
|
|||||||
// import Detail from './detail/index.vue';
|
// import Detail from './detail/index.vue';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { Back, Refresh } from '@element-plus/icons-vue';
|
import { Back, Refresh } from '@element-plus/icons-vue';
|
||||||
import { MsgWarning } from '@/utils/message';
|
import { MsgSuccess, MsgWarning } from '@/utils/message';
|
||||||
|
|
||||||
interface FilePaths {
|
interface FilePaths {
|
||||||
url: string;
|
url: string;
|
||||||
@ -323,6 +326,28 @@ const delFile = async (row: File.File | null) => {
|
|||||||
search();
|
search();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const batchDelFiles = () => {
|
||||||
|
ElMessageBox.confirm(i18n.global.t('commons.msg.delete'), i18n.global.t('commons.msg.deleteTitle'), {
|
||||||
|
confirmButtonText: i18n.global.t('commons.button.confirm'),
|
||||||
|
cancelButtonText: i18n.global.t('commons.button.cancel'),
|
||||||
|
type: 'info',
|
||||||
|
}).then(() => {
|
||||||
|
const pros = [];
|
||||||
|
for (const s of selects.value) {
|
||||||
|
pros.push(DeleteFile({ path: s['path'], isDir: s['isDir'] }));
|
||||||
|
}
|
||||||
|
loading.value = true;
|
||||||
|
Promise.all(pros)
|
||||||
|
.then(() => {
|
||||||
|
MsgSuccess(i18n.global.t('commons.msg.deleteSuccess'));
|
||||||
|
search();
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const getFileSize = (size: number) => {
|
const getFileSize = (size: number) => {
|
||||||
return computeSize(size);
|
return computeSize(size);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user