feat(FileTable): 添加全选功能和选择状态指示器

在文件表格的批量操作区域添加全选复选框和部分选择状态指示器
更新项目信息统计数据 Fixes Feat: 支持“全选”功能以提升批量操作效率
Fixes #435
This commit is contained in:
Wenjie Zhang 2026-01-06 19:32:27 +08:00
parent 3812d61566
commit c6ddb70909
3 changed files with 51 additions and 5 deletions

View File

@ -16,7 +16,7 @@ branding:
features:
- label: "GitHub Stars"
value: "3000+"
value: "3800+"
description: "开发者社区的认可与支持"
icon: "stars"
- label: "已解决 Issues"
@ -24,7 +24,7 @@ features:
description: "持续改进和问题解决能力"
icon: "issues"
- label: "累计 Commits"
value: "1100+"
value: "1200+"
description: "活跃的开发迭代和功能更新"
icon: "commits"
- label: "开源协议"

View File

@ -104,8 +104,14 @@
</div>
</div>
<div class="batch-actions" v-if="selectedRowKeys.length > 0">
<div class="batch-actions" v-if="isSelectionMode">
<div class="batch-info">
<a-checkbox
:checked="isAllSelected"
:indeterminate="isPartiallySelected"
@change="onSelectAllChange"
style="margin-right: 8px;"
/>
<span>{{ selectedRowKeys.length }} </span>
</div>
<div style="display: flex; gap: 4px;">
@ -383,6 +389,46 @@ const selectedRowKeys = computed({
const isSelectionMode = ref(false);
const allSelectableFiles = computed(() => {
const nameFilter = filenameFilter.value.trim().toLowerCase();
const status = statusFilter.value;
return files.value.filter(file => {
if (file.is_folder) return false;
// Follow getCheckboxProps logic
if (lock.value || file.status === 'processing' || file.status === 'waiting') return false;
if (nameFilter || status) {
const nameMatch = !nameFilter || (file.filename && file.filename.toLowerCase().includes(nameFilter));
const statusMatch = !status || file.status === status ||
(status === 'indexed' && file.status === 'done') ||
(status === 'error_indexing' && file.status === 'failed');
return nameMatch && statusMatch;
}
return true;
});
});
const isAllSelected = computed(() => {
const selectableIds = allSelectableFiles.value.map(f => f.file_id);
if (selectableIds.length === 0) return false;
return selectableIds.every(id => selectedRowKeys.value.includes(id));
});
const isPartiallySelected = computed(() => {
const selectableIds = allSelectableFiles.value.map(f => f.file_id);
const selectedCount = selectableIds.filter(id => selectedRowKeys.value.includes(id)).length;
return selectedCount > 0 && selectedCount < selectableIds.length;
});
const onSelectAllChange = (e) => {
if (e.target.checked) {
selectedRowKeys.value = allSelectableFiles.value.map(f => f.file_id);
} else {
selectedRowKeys.value = [];
}
};
const expandedRowKeys = ref([]);
const popoverVisibleMap = ref({});

View File

@ -27,7 +27,7 @@ export const useInfoStore = defineStore('info', () => {
// 计算属性 - 功能特性
const features = computed(() => infoConfig.value.features || [{
label: "GitHub Stars",
value: "3000+",
value: "3200+",
description: "开发者社区的认可与支持",
icon: "stars"
}, {
@ -37,7 +37,7 @@ export const useInfoStore = defineStore('info', () => {
icon: "issues"
}, {
label: "累计 Commits",
value: "1100+",
value: "1200+",
description: "活跃的开发迭代和功能更新",
icon: "commits"
}, {