feat(FileTable): 添加全选功能和选择状态指示器
在文件表格的批量操作区域添加全选复选框和部分选择状态指示器 更新项目信息统计数据 Fixes Feat: 支持“全选”功能以提升批量操作效率 Fixes #435
This commit is contained in:
parent
3812d61566
commit
c6ddb70909
@ -16,7 +16,7 @@ branding:
|
|||||||
|
|
||||||
features:
|
features:
|
||||||
- label: "GitHub Stars"
|
- label: "GitHub Stars"
|
||||||
value: "3000+"
|
value: "3800+"
|
||||||
description: "开发者社区的认可与支持"
|
description: "开发者社区的认可与支持"
|
||||||
icon: "stars"
|
icon: "stars"
|
||||||
- label: "已解决 Issues"
|
- label: "已解决 Issues"
|
||||||
@ -24,7 +24,7 @@ features:
|
|||||||
description: "持续改进和问题解决能力"
|
description: "持续改进和问题解决能力"
|
||||||
icon: "issues"
|
icon: "issues"
|
||||||
- label: "累计 Commits"
|
- label: "累计 Commits"
|
||||||
value: "1100+"
|
value: "1200+"
|
||||||
description: "活跃的开发迭代和功能更新"
|
description: "活跃的开发迭代和功能更新"
|
||||||
icon: "commits"
|
icon: "commits"
|
||||||
- label: "开源协议"
|
- label: "开源协议"
|
||||||
|
|||||||
@ -104,8 +104,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="batch-actions" v-if="selectedRowKeys.length > 0">
|
<div class="batch-actions" v-if="isSelectionMode">
|
||||||
<div class="batch-info">
|
<div class="batch-info">
|
||||||
|
<a-checkbox
|
||||||
|
:checked="isAllSelected"
|
||||||
|
:indeterminate="isPartiallySelected"
|
||||||
|
@change="onSelectAllChange"
|
||||||
|
style="margin-right: 8px;"
|
||||||
|
/>
|
||||||
<span>{{ selectedRowKeys.length }} 项</span>
|
<span>{{ selectedRowKeys.length }} 项</span>
|
||||||
</div>
|
</div>
|
||||||
<div style="display: flex; gap: 4px;">
|
<div style="display: flex; gap: 4px;">
|
||||||
@ -383,6 +389,46 @@ const selectedRowKeys = computed({
|
|||||||
|
|
||||||
const isSelectionMode = ref(false);
|
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 expandedRowKeys = ref([]);
|
||||||
|
|
||||||
const popoverVisibleMap = ref({});
|
const popoverVisibleMap = ref({});
|
||||||
|
|||||||
@ -27,7 +27,7 @@ export const useInfoStore = defineStore('info', () => {
|
|||||||
// 计算属性 - 功能特性
|
// 计算属性 - 功能特性
|
||||||
const features = computed(() => infoConfig.value.features || [{
|
const features = computed(() => infoConfig.value.features || [{
|
||||||
label: "GitHub Stars",
|
label: "GitHub Stars",
|
||||||
value: "3000+",
|
value: "3200+",
|
||||||
description: "开发者社区的认可与支持",
|
description: "开发者社区的认可与支持",
|
||||||
icon: "stars"
|
icon: "stars"
|
||||||
}, {
|
}, {
|
||||||
@ -37,7 +37,7 @@ export const useInfoStore = defineStore('info', () => {
|
|||||||
icon: "issues"
|
icon: "issues"
|
||||||
}, {
|
}, {
|
||||||
label: "累计 Commits",
|
label: "累计 Commits",
|
||||||
value: "1100+",
|
value: "1200+",
|
||||||
description: "活跃的开发迭代和功能更新",
|
description: "活跃的开发迭代和功能更新",
|
||||||
icon: "commits"
|
icon: "commits"
|
||||||
}, {
|
}, {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user