| | |
| | | }, |
| | | |
| | | async fetchTabCounts() { |
| | | try { |
| | | const response = await getstatusCount(); |
| | | const { statusCount, totalCount, userCount } = response.data.data; |
| | | this.tabs.forEach(tab => { |
| | | if (tab.name === 'all') { |
| | | tab.count = totalCount || 0; // 总工单数 |
| | | } else if (tab.name === 'myTickets') { |
| | | tab.count = userCount || 0; // 我发起的工单数 |
| | | } else { |
| | | tab.count = statusCount[String(tab.value)] || 0; // 根据状态值映射 |
| | | } |
| | | }); |
| | | } catch (error) { |
| | | this.$message.error('获取 tab 数据失败'); |
| | | try { |
| | | // 判断是否有部门筛选 |
| | | let params = {}; |
| | | if (this.filters.department) { |
| | | params.deptId = this.filters.department; |
| | | } |
| | | const response = await getstatusCount(params); |
| | | const { statusCount, totalCount, userCount } = response.data.data; |
| | | this.tabs.forEach(tab => { |
| | | if (tab.name === 'all') { |
| | | tab.count = totalCount || 0; // 总工单数 |
| | | } else if (tab.name === 'myTickets') { |
| | | tab.count = userCount || 0; // 我发起的工单数 |
| | | } else { |
| | | tab.count = statusCount[String(tab.value)] || 0; // 根据状态值映射 |
| | | } |
| | | }, |
| | | }); |
| | | } catch (error) { |
| | | this.$message.error('获取 tab 数据失败'); |
| | | } |
| | | }, |
| | | |
| | | handleTabChange(tab) { |
| | | this.activeTab = tab.props?.name || tab.name; |
| | |
| | | handleSearch() { |
| | | this.page.currentPage = 1; |
| | | this.fetchTableData(); |
| | | this.fetchTabCounts(); |
| | | }, |
| | | |
| | | handleReset() { |