1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-03-14 01:34:47 +08:00

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

This commit is contained in:
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) => {