feat(project): 列表模式分组选择下拉显示各分组任务数

- 分组下拉每项右侧显示任务数,与分组标题旁数量一致,未勾选显示的分组同样计算
- 数量仅在下拉打开时计算,避免已逾期分组随每秒时间刷新持续重算
- 同步 ai-kb 列表视图说明
This commit is contained in:
kuaifan 2026-10-01 01:31:51 +00:00
parent d4c7cdba6f
commit 2ace89fce8
4 changed files with 40 additions and 3 deletions

View File

@ -34,7 +34,7 @@ last_verified: v1.9.36
- 视图切换记忆在 `cacheParameter.menuType='table'`,下次进入同一项目仍是列表视图
## 列表分段
先切换到表格模式,鼠标悬停视图切换组前的设置齿轮图标,下拉菜单中可复选分组。菜单为无箭头、无标题栏的弹层。触屏先切换表格,再点击齿轮打开选择。表格图标仅切换视图,悬停或点击都不会打开分组菜单。看板和甘特图模式不显示设置齿轮;切走表格时菜单关闭。
先切换到表格模式,鼠标悬停视图切换组前的设置齿轮图标,下拉菜单中可复选分组,每个分组右侧显示其任务数(与分组标题旁的数量一致,同样受顶部筛选和搜索影响)。菜单为无箭头、无标题栏的弹层。触屏先切换表格,再点击齿轮打开选择。表格图标仅切换视图,悬停或点击都不会打开分组菜单。看板和甘特图模式不显示设置齿轮;切走表格时菜单关闭。
| 分组 | 默认显示 | 范围 |
|---|---|---|

View File

@ -121,6 +121,7 @@
class="project-table-settings"
:touch="$isEEUIApp || windowTouch"
:selected="visibleTableGroups"
:counts="tableGroupsOpen ? tableGroupCounts : null"
@change="setTableGroupVisible">
<button type="button" class="project-table-settings-icon">
<Icon type="md-funnel"/>
@ -864,6 +865,23 @@ export default {
}));
},
// 各分组任务数,与分组标题旁的数量一致(未显示的分组也计算)
tableGroupCounts() {
const counts = {
my: this.myList.length,
help: this.helpList.length,
undone: this.unList.length,
completed: this.completedList.length,
};
const groups = this.tableGroupOptions.filter(group => group.kind);
const tasks = this.panelTask(this.parentTask);
const now = $A.daytz(this.nowTime).valueOf();
groups.forEach(group => {
counts[group.key] = tasks.filter(task => taskMatchesProjectGroup(task, group, this.tableWeekRanges, now, $A.dayjs)).length;
});
return counts;
},
tabTypeStyle() {
const style = {}
switch (this.tabTypeActive) {

View File

@ -22,7 +22,8 @@
:disabled="selected.length === 1 && selected.includes(group.key)"
:title="selected.length === 1 && selected.includes(group.key) ? $L('至少保留一项') : ''"
@on-change="$emit('change', group, $event)">
{{$L(group.title)}}
<span class="project-table-group-name">{{$L(group.title)}}</span>
<span v-if="counts" class="project-table-group-num">{{counts[group.key] || 0}}</span>
</Checkbox>
</div>
</Dropdown>
@ -37,6 +38,7 @@ export default {
value: {type: Boolean, default: false},
touch: {type: Boolean, default: false},
selected: {type: Array, required: true},
counts: {type: Object, default: null},
placement: {type: String, default: 'bottom-start'},
},
computed: {

View File

@ -1016,11 +1016,28 @@
flex-direction: column;
align-items: stretch;
overflow-y: auto;
.ivu-checkbox {
display: flex;
align-items: center;
}
.ivu-checkbox-wrapper {
display: flex;
align-items: center;
margin-right: 0;
white-space: normal;
overflow-wrap: anywhere;
padding-right: 28px;
padding-right: 16px;
}
.project-table-group-name {
flex: 1;
min-width: 0;
margin-left: 8px;
}
.project-table-group-num {
flex-shrink: 0;
margin-left: 16px;
font-size: 12px;
color: #b0b3b8;
}
}
}