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

style: 增加可解压判断

This commit is contained in:
zhengkunwang223 2022-09-09 18:39:56 +08:00 committed by zhengkunwang223
parent 9f814077ad
commit 8a0aa168d2
3 changed files with 11 additions and 0 deletions

View File

@ -243,5 +243,6 @@ export default {
move: 'Move', move: 'Move',
copy: 'Cpoy', copy: 'Cpoy',
calculate: 'Calculate', calculate: 'Calculate',
canNotDeCompress: 'Can not DeCompress this File',
}, },
}; };

View File

@ -243,5 +243,6 @@ export default {
move: '移动', move: '移动',
copy: '复制', copy: '复制',
calculate: '计算', calculate: '计算',
canNotDeCompress: '无法解压此文件',
}, },
}; };

View File

@ -205,6 +205,7 @@ import CodeEditor from './code-editor/index.vue';
import Wget from './wget/index.vue'; import Wget from './wget/index.vue';
import Move from './move/index.vue'; import Move from './move/index.vue';
import Download from './download/index.vue'; import Download from './download/index.vue';
import { Mimetypes } from '@/global/mimetype';
const data = ref(); const data = ref();
let selects = ref<any>([]); let selects = ref<any>([]);
@ -399,6 +400,11 @@ const closeCompress = () => {
}; };
const openDeCompress = (item: File.File) => { const openDeCompress = (item: File.File) => {
if (Mimetypes.get(item.mimeType) == undefined) {
ElMessage.warning(i18n.global.t('file.canNotDeCompress'));
return;
}
deCompressPage.open = true; deCompressPage.open = true;
deCompressPage.name = item.name; deCompressPage.name = item.name;
deCompressPage.path = item.path; deCompressPage.path = item.path;
@ -526,6 +532,9 @@ const buttons = [
{ {
label: i18n.global.t('file.deCompress'), label: i18n.global.t('file.deCompress'),
click: openDeCompress, click: openDeCompress,
disabled: (row: File.File) => {
return row.isDir;
},
}, },
{ {
label: i18n.global.t('file.rename'), label: i18n.global.t('file.rename'),