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',
deleteHelper:
'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)',
recycleBin: 'Recycle bin',
sourcePath: 'Original path',
deleteTime: 'Delete time',
reduce: 'Reduction',
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',
clearRecycleBinHelper: 'Do you want to clear the recycle bin?',
favorite: 'favorites',
removeFavorite: 'Remove from favorites?',
addFavorite: 'Add to favorites',
clearList: 'Clear list',
deleteRecycleHelper: 'Are you sure you want to permanently delete the following files?',
},
ssh: {
autoStart: 'Auto Start',

View File

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

View File

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

View File

@ -195,7 +195,8 @@
v-if="row.favoriteID > 0"
link
type="warning"
:icon="Star"
size="large"
:icon="StarFilled"
@click="removeFavorite(row.favoriteID)"
></el-button>
<div v-else>
@ -293,7 +294,7 @@ import {
SearchFavorite,
} from '@/api/modules/files';
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 { Mimetypes, Languages } from '@/global/mimetype';
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">
{{ $t('file.clearRecycleBin') }}
</el-button>
<el-button @click="patchDelete" :disabled="data == null || data.length == 0">
{{ $t('commons.button.delete') }}
</el-button>
<ComplexTable
:pagination-config="paginationConfig"
v-model:selects="selects"
@ -35,15 +38,16 @@
></el-table-column>
<fu-table-operations :buttons="buttons" :label="$t('commons.table.operate')" fix />
</ComplexTable>
<Delete ref="deleteRef" @close="search" />
</el-drawer>
</template>
<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 { dateFormat, computeSize } from '@/utils/util';
import i18n from '@/lang';
import { MsgSuccess } from '@/utils/message';
import Delete from './delete/index.vue';
const open = ref(false);
const req = reactive({
@ -63,6 +67,8 @@ const paginationConfig = reactive({
total: 0,
});
const deleteRef = ref();
const handleClose = () => {
open.value = false;
em('close', false);
@ -86,30 +92,14 @@ const search = async () => {
};
const singleDel = (row: any) => {
ElMessageBox.confirm(i18n.global.t('commons.msg.delete'), i18n.global.t('commons.button.delete'), {
confirmButtonText: i18n.global.t('commons.button.confirm'),
cancelButtonText: i18n.global.t('commons.button.cancel'),
}).then(async () => {
files.value = [];
files.value.push(row);
deleteFile();
});
files.value = [];
files.value.push(row);
deleteRef.value.acceptParams(files.value);
};
const deleteFile = async () => {
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'));
search();
})
.finally(() => {
loading.value = false;
});
const patchDelete = () => {
files.value = selects.value;
deleteRef.value.acceptParams(files.value);
};
const rdFile = async (row: any) => {