Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 65 additions & 20 deletions frontend/src/views/host/file-management/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -424,23 +424,32 @@
<el-button plain class="close" icon="Close" @click="closeMove"></el-button>
</el-tooltip>
</el-button-group>
<div class="w-80">
<el-input
v-model="req.search"
clearable
@clear="search()"
@keydown.enter="search()"
:placeholder="$t('file.search')"
>
<template #prepend>
<el-checkbox v-model="req.containSub">
{{ $t('file.sub') }}
</el-checkbox>
</template>
<template #append>
<el-button icon="Search" @click="search" round />
</template>
</el-input>
<div class="flex items-center gap-2">
<fu-table-column-select
:columns="columns"
trigger="hover"
:title="$t('commons.table.selectColumn')"
popper-class="popper-class"
:only-icon="true"
/>
<div class="w-80">
<el-input
v-model="req.search"
clearable
@clear="search()"
@keydown.enter="search()"
:placeholder="$t('file.search')"
>
<template #prepend>
<el-checkbox v-model="req.containSub">
{{ $t('file.sub') }}
</el-checkbox>
</template>
<template #append>
<el-button icon="Search" @click="search" round />
</template>
</el-input>
</div>
</div>
</div>
</template>
Expand All @@ -456,6 +465,8 @@
@cell-mouse-leave="hideFavorite"
:heightDiff="heightDiff"
:right-buttons="rightButtons"
:columns="columns"
localKey="fileManagementColumn"
>
<el-table-column type="selection" width="30" />
<el-table-column
Expand Down Expand Up @@ -520,7 +531,12 @@
</div>
</template>
</el-table-column>
<el-table-column :label="$t('file.mode')" prop="mode" width="80">
<el-table-column
v-if="isColumnVisible('mode')"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个判断是多余的吧

:label="$t('file.mode')"
prop="mode"
width="80"
>
<template #default="{ row }">
<el-link underline="never" @click="openMode(row)">{{ row.mode }}</el-link>
</template>
Expand All @@ -538,7 +554,13 @@
</el-link>
</template>
</el-table-column>
<el-table-column :label="$t('file.size')" prop="size" width="80" :sortable="'custom'">
<el-table-column
v-if="isColumnVisible('size')"
:label="$t('file.size')"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

多余判断

prop="size"
width="80"
:sortable="'custom'"
>
<template #default="{ row }">
<el-button
type="primary"
Expand All @@ -560,14 +582,21 @@
</template>
</el-table-column>
<el-table-column
v-if="isColumnVisible('modTime')"
:label="$t('file.updateTime')"
prop="modTime"
width="180"
:formatter="dateFormat"
show-overflow-tooltip
:sortable="'custom'"
></el-table-column>
<el-table-column :label="$t('file.remark')" prop="remark" width="180" show-overflow-tooltip>
<el-table-column
v-if="isColumnVisible('remark')"
:label="$t('file.remark')"
prop="remark"
width="180"
show-overflow-tooltip
>
<template #default="{ row }">
<span>{{ row.remark ? row.remark : '-' }}</span>
</template>
Expand Down Expand Up @@ -709,6 +738,15 @@ interface FilePaths {
name: string;
}

type FileColumnKey = 'mode' | 'size' | 'modTime' | 'remark';

interface FileColumnConfig {
label: string;
show: boolean;
fix?: boolean;
value: FileColumnKey;
}

const router = useRouter();
const data = ref();
const tableRefs = ref<Record<string, any>>({});
Expand Down Expand Up @@ -827,13 +865,20 @@ const setRenameRef = (key: string, el: any) => {
const getCurrentRename = () => renameRefs.value[editableTabsKey.value];

const pathRefs = ref<Record<string, any>>({});
const columns = ref<FileColumnConfig[]>([
{ label: i18n.global.t('file.mode'), value: 'mode', show: true },
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以不用赋值

{ label: i18n.global.t('file.size'), value: 'size', show: true },
{ label: i18n.global.t('file.updateTime'), value: 'modTime', show: true },
{ label: i18n.global.t('file.remark'), value: 'remark', show: true },
]);

const setPathRef = (key: string, el: any) => {
if (el) {
pathRefs.value[key] = el;
}
};
const getCurrentPath = () => pathRefs.value[editableTabsKey.value];
const isColumnVisible = (key: FileColumnKey) => columns.value.find((column) => column.value === key)?.show !== false;

const { searchableStatus, searchablePath, setSearchableInputRef, searchableInputBlur } = useMultipleSearchable(paths);

Expand Down
Loading