style: 修改文件列表部分样式 (#2741)

pull/2745/head
zhengkunwang 2023-10-31 20:45:57 +08:00 committed by GitHub
parent 9198707ca4
commit b6fc1efd6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 115 additions and 32 deletions

View File

@ -966,20 +966,21 @@ const message = {
unsupportType: 'Unsupported file type', unsupportType: 'Unsupported file type',
deleteHelper: deleteHelper:
'Are you sure you want to delete the following files? By default, it will enter the recycle bin after deletion', 'Are you sure you want to delete the following files? By default, it will enter the recycle bin after deletion',
fileHeper: 'Note: 1. Sorting is not supported after searching 2. Folders are not supported by size sorting', fileHeper: 'Note: 1. Search results do not support sorting. 2. Folders cannot be sorted by size.',
forceDeleteHelper: 'Permanently delete the file (without entering the recycle bin, delete it directly)', forceDeleteHelper: 'Permanently delete the file (without entering the recycle bin, delete it directly)',
recycleBin: 'Recycle bin', recycleBin: 'Recycle bin',
sourcePath: 'Original path', sourcePath: 'Original path',
deleteTime: 'Delete time', deleteTime: 'Delete time',
reduce: 'Reduction', reduce: 'Reduction',
reduceHelper: reduceHelper:
'Restore the file to its original path. If a file or directory with the same name exists at the original address of the file, it will be overwritten. Do you want to continue?', 'If a file or directory with the same name exists in the original path, it will be overwritten. Do you want to continue?',
clearRecycleBin: 'Clear the recycle bin', clearRecycleBin: 'Clear the recycle bin',
clearRecycleBinHelper: 'Do you want to clear the recycle bin?', clearRecycleBinHelper: 'Do you want to clear the recycle bin?',
favorite: 'favorites', favorite: 'favorites',
removeFavorite: 'Remove from favorites?', removeFavorite: 'Remove from favorites?',
addFavorite: 'Add to favorites', addFavorite: 'Add to favorites',
clearList: 'Clear list', clearList: 'Clear list',
deleteRecycleHelper: 'Are you sure you want to permanently delete the following files?',
}, },
ssh: { ssh: {
autoStart: 'Auto Start', autoStart: 'Auto Start',

View File

@ -927,19 +927,20 @@ const message = {
currentSelect: ': ', currentSelect: ': ',
unsupportType: '', unsupportType: '',
deleteHelper: ' ', deleteHelper: ' ',
fileHeper: '1. 2.', fileHeper: '1. 2. ',
forceDeleteHelper: '', forceDeleteHelper: '',
recycleBin: '', recycleBin: '',
sourcePath: '', sourcePath: '',
deleteTime: '', deleteTime: '',
reduce: '', reduce: '',
reduceHelper: ' ', reduceHelper: '',
clearRecycleBin: '', clearRecycleBin: '',
clearRecycleBinHelper: '', clearRecycleBinHelper: '',
favorite: '', favorite: '',
removeFavorite: '', removeFavorite: '',
addFavorite: '', addFavorite: '',
clearList: '', clearList: '',
deleteRecycleHelper: '',
}, },
ssh: { ssh: {
autoStart: '', autoStart: '',

View File

@ -928,19 +928,20 @@ const message = {
currentSelect: ': ', currentSelect: ': ',
unsupportType: '', unsupportType: '',
deleteHelper: ' ', deleteHelper: ' ',
fileHeper: '1. 2.', fileHeper: '1. 2. ',
forceDeleteHelper: '', forceDeleteHelper: '',
recycleBin: '', recycleBin: '',
sourcePath: '', sourcePath: '',
deleteTime: '', deleteTime: '',
reduce: '', reduce: '',
reduceHelper: '', reduceHelper: '',
clearRecycleBin: '', clearRecycleBin: '',
clearRecycleBinHelper: '', clearRecycleBinHelper: '',
favorite: '', favorite: '',
removeFavorite: '', removeFavorite: '',
addFavorite: '', addFavorite: '',
clearList: '', clearList: '',
deleteRecycleHelper: '',
}, },
ssh: { ssh: {
autoStart: '', autoStart: '',

View File

@ -195,7 +195,8 @@
v-if="row.favoriteID > 0" v-if="row.favoriteID > 0"
link link
type="warning" type="warning"
:icon="Star" size="large"
:icon="StarFilled"
@click="removeFavorite(row.favoriteID)" @click="removeFavorite(row.favoriteID)"
></el-button> ></el-button>
<div v-else> <div v-else>
@ -293,7 +294,7 @@ import {
SearchFavorite, SearchFavorite,
} from '@/api/modules/files'; } from '@/api/modules/files';
import { computeSize, dateFormat, downloadFile, getIcon, getRandomStr } from '@/utils/util'; import { computeSize, dateFormat, downloadFile, getIcon, getRandomStr } from '@/utils/util';
import { Delete, Star } from '@element-plus/icons-vue'; import { Delete, StarFilled, Star } from '@element-plus/icons-vue';
import { File } from '@/api/interface/file'; import { File } from '@/api/interface/file';
import { Mimetypes, Languages } from '@/global/mimetype'; import { Mimetypes, Languages } from '@/global/mimetype';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';

View File

@ -0,0 +1,89 @@
<template>
<el-dialog v-model="open" :title="$t('app.delete')" width="30%" :close-on-click-modal="false">
<el-row>
<el-col :span="20" :offset="2">
<el-alert :title="$t('file.deleteRecycleHelper')" show-icon type="error" :closable="false"></el-alert>
<div class="resource">
<table aria-describedby="deleteTable">
<th></th>
<tr v-for="(row, index) in files" :key="index">
<td>
<svg-icon v-if="row.isDir" className="table-icon" iconName="p-file-folder"></svg-icon>
<svg-icon
v-else
className="table-icon"
:iconName="getIconName(row.extension)"
></svg-icon>
<span>{{ row.name }}</span>
</td>
</tr>
</table>
</div>
</el-col>
</el-row>
<template #footer>
<span class="dialog-footer">
<el-button @click="open = false" :disabled="loading">
{{ $t('commons.button.cancel') }}
</el-button>
<el-button type="primary" @click="onConfirm" v-loading="loading">
{{ $t('commons.button.confirm') }}
</el-button>
</span>
</template>
</el-dialog>
</template>
<script lang="ts" setup>
import i18n from '@/lang';
import { ref } from 'vue';
import { File } from '@/api/interface/file';
import { getIcon } from '@/utils/util';
import { DeleteFile } from '@/api/modules/files';
import { MsgSuccess } from '@/utils/message';
const open = ref(false);
const files = ref();
const loading = ref(false);
const em = defineEmits(['close']);
const forceDelete = ref(false);
const acceptParams = (props: File.RecycleBin[]) => {
files.value = props;
open.value = true;
forceDelete.value = false;
};
const onConfirm = () => {
const pros = [];
for (const s of files.value) {
pros.push(DeleteFile({ path: s.from + '/' + s.rName, isDir: s.isDir, forceDelete: true }));
}
loading.value = true;
Promise.all(pros)
.then(() => {
MsgSuccess(i18n.global.t('commons.msg.deleteSuccess'));
open.value = false;
em('close');
})
.finally(() => {
loading.value = false;
});
};
const getIconName = (extension: string) => {
return getIcon(extension);
};
defineExpose({
acceptParams,
});
</script>
<style scoped>
.resource {
margin-top: 10px;
max-height: 400px;
overflow: auto;
}
</style>

View File

@ -6,6 +6,9 @@
<el-button @click="clear" type="primary" :disabled="data == null || data.length == 0"> <el-button @click="clear" type="primary" :disabled="data == null || data.length == 0">
{{ $t('file.clearRecycleBin') }} {{ $t('file.clearRecycleBin') }}
</el-button> </el-button>
<el-button @click="patchDelete" :disabled="data == null || data.length == 0">
{{ $t('commons.button.delete') }}
</el-button>
<ComplexTable <ComplexTable
:pagination-config="paginationConfig" :pagination-config="paginationConfig"
v-model:selects="selects" v-model:selects="selects"
@ -35,15 +38,16 @@
></el-table-column> ></el-table-column>
<fu-table-operations :buttons="buttons" :label="$t('commons.table.operate')" fix /> <fu-table-operations :buttons="buttons" :label="$t('commons.table.operate')" fix />
</ComplexTable> </ComplexTable>
<Delete ref="deleteRef" @close="search" />
</el-drawer> </el-drawer>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { DeleteFile, clearRecycle, getRecycleList, reduceFile } from '@/api/modules/files'; import { clearRecycle, getRecycleList, reduceFile } from '@/api/modules/files';
import { reactive, ref } from 'vue'; import { reactive, ref } from 'vue';
import { dateFormat, computeSize } from '@/utils/util'; import { dateFormat, computeSize } from '@/utils/util';
import i18n from '@/lang'; import i18n from '@/lang';
import { MsgSuccess } from '@/utils/message'; import Delete from './delete/index.vue';
const open = ref(false); const open = ref(false);
const req = reactive({ const req = reactive({
@ -63,6 +67,8 @@ const paginationConfig = reactive({
total: 0, total: 0,
}); });
const deleteRef = ref();
const handleClose = () => { const handleClose = () => {
open.value = false; open.value = false;
em('close', false); em('close', false);
@ -86,30 +92,14 @@ const search = async () => {
}; };
const singleDel = (row: any) => { const singleDel = (row: any) => {
ElMessageBox.confirm(i18n.global.t('commons.msg.delete'), i18n.global.t('commons.button.delete'), { files.value = [];
confirmButtonText: i18n.global.t('commons.button.confirm'), files.value.push(row);
cancelButtonText: i18n.global.t('commons.button.cancel'), deleteRef.value.acceptParams(files.value);
}).then(async () => {
files.value = [];
files.value.push(row);
deleteFile();
});
}; };
const deleteFile = async () => { const patchDelete = () => {
const pros = []; files.value = selects.value;
for (const s of files.value) { deleteRef.value.acceptParams(files.value);
pros.push(DeleteFile({ path: s.from + '/' + s.rName, isDir: s.isDir, forceDelete: true }));
}
loading.value = true;
Promise.all(pros)
.then(() => {
MsgSuccess(i18n.global.t('commons.msg.deleteSuccess'));
search();
})
.finally(() => {
loading.value = false;
});
}; };
const rdFile = async (row: any) => { const rdFile = async (row: any) => {