feat: 添加标签页数量统计功能,适配新的 SearchBar
This commit is contained in:
@@ -9,9 +9,8 @@
|
|||||||
<!-- 搜索和操作区 -->
|
<!-- 搜索和操作区 -->
|
||||||
<search-bar
|
<search-bar
|
||||||
:show-search="showSearch"
|
:show-search="showSearch"
|
||||||
|
:tab-counts="tabCounts"
|
||||||
@query="handleQuery"
|
@query="handleQuery"
|
||||||
@add="handleAdd"
|
|
||||||
@import="handleImport"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 项目列表表格 -->
|
<!-- 项目列表表格 -->
|
||||||
@@ -97,6 +96,13 @@ export default {
|
|||||||
projectName: null,
|
projectName: null,
|
||||||
status: null
|
status: null
|
||||||
},
|
},
|
||||||
|
// 标签页数量统计
|
||||||
|
tabCounts: {
|
||||||
|
all: 0,
|
||||||
|
'0': 0,
|
||||||
|
'1': 0,
|
||||||
|
'2': 0
|
||||||
|
},
|
||||||
// 新增/编辑弹窗
|
// 新增/编辑弹窗
|
||||||
addDialogVisible: false,
|
addDialogVisible: false,
|
||||||
addDialogTitle: '新建项目',
|
addDialogTitle: '新建项目',
|
||||||
@@ -120,10 +126,23 @@ export default {
|
|||||||
this.projectList = response.rows
|
this.projectList = response.rows
|
||||||
this.total = response.total
|
this.total = response.total
|
||||||
this.loading = false
|
this.loading = false
|
||||||
|
// 计算标签页数量
|
||||||
|
this.calculateTabCounts()
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.loading = false
|
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) {
|
handleQuery(queryParams) {
|
||||||
if (queryParams) {
|
if (queryParams) {
|
||||||
|
|||||||
Reference in New Issue
Block a user