feat: 添加标签页数量统计功能,适配新的 SearchBar

This commit is contained in:
wkc
2026-02-27 14:11:35 +08:00
parent dfb200f86d
commit 0e95d9d2b1

View File

@@ -9,9 +9,8 @@
<!-- 搜索和操作区 -->
<search-bar
:show-search="showSearch"
:tab-counts="tabCounts"
@query="handleQuery"
@add="handleAdd"
@import="handleImport"
/>
<!-- 项目列表表格 -->
@@ -97,6 +96,13 @@ export default {
projectName: null,
status: null
},
// 标签页数量统计
tabCounts: {
all: 0,
'0': 0,
'1': 0,
'2': 0
},
// 新增/编辑弹窗
addDialogVisible: false,
addDialogTitle: '新建项目',
@@ -120,10 +126,23 @@ export default {
this.projectList = response.rows
this.total = response.total
this.loading = false
// 计算标签页数量
this.calculateTabCounts()
}).catch(() => {
this.loading = false
})
},
/** 计算标签页数量 */
calculateTabCounts() {
// 注意这里需要后端API返回所有状态的数量统计
// 目前暂时使用当前页的数据进行计算
this.tabCounts = {
all: this.total,
'0': this.projectList.filter(p => p.status === '0').length,
'1': this.projectList.filter(p => p.status === '1').length,
'2': this.projectList.filter(p => p.status === '2').length
}
},
/** 搜索按钮操作 */
handleQuery(queryParams) {
if (queryParams) {