| | |
| | | columnType.dicData = this.types; |
| | | this.allAlgorithms = info; |
| | | |
| | | console.log('工单类型', this.types); |
| | | console.log('关联算法', this.allAlgorithms); |
| | | // console.log('工单类型', this.types); |
| | | // console.log('关联算法', this.allAlgorithms); |
| | | // 确保算法数据的映射一致 |
| | | this.algorithms = |
| | | ai_type?.map(item => ({ |
| | |
| | | return colorMap[String(status)] || ''; |
| | | }, |
| | | |
| | | async fetchTabCounts() { |
| | | 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 数据失败'); |
| | | async fetchTabCounts(val) { |
| | | console.log('1111', val); |
| | | const params = { |
| | | "status_list": val |
| | | } |
| | | try { |
| | | const response = await getstatusCount(params); |
| | | console.log('response', response.data.data); |
| | | |
| | | const statusCount = response.data.data || {}; // 确保statusCount是对象 |
| | | |
| | | // 先计算总工单数(所有状态之和) |
| | | const totalCount = Object.values(statusCount).reduce((sum, count) => sum + (count || 0), 0); |
| | | |
| | | this.tabs.forEach(tab => { |
| | | if (tab.name === 'all') { |
| | | tab.count = totalCount; // 总工单数 = 所有状态数量之和 |
| | | } else if (tab.name === 'myTickets') { |
| | | // 我的工单数量需要单独处理,如果接口返回了userCount则用,否则可以留空或根据实际逻辑处理 |
| | | // 这里假设接口没有返回userCount,暂时保持0或根据实际需求调整 |
| | | tab.count = 0; // 或从其他接口获取我的工单数量 |
| | | } else { |
| | | // 根据tab的value匹配statusCount中的key |
| | | tab.count = statusCount[String(tab.value)] || 0; |
| | | } |
| | | }, |
| | | }); |
| | | } catch (error) { |
| | | console.error('获取 tab 数据失败:', error); |
| | | // 异常时重置count为0 |
| | | this.tabs.forEach(tab => { |
| | | tab.count = 0; |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | handleTabChange(tab) { |
| | | this.activeTab = tab.props?.name || tab.name; |
| | | const isReview = this.findObject(this.option.column, 'isReview'); |
| | | // 根据条件切换显隐 |
| | | isReview.hide = !['all', 'completed', 'myTickets'].includes(this.activeTab); |
| | | |
| | | this.handleReset(); |
| | | this.page.currentPage = 1; |
| | | this.fetchTableData(); |
| | | this.fetchTabCounts(); // 切换 tab 时重新获取数据 |
| | | }, |
| | | handleTabChange(tab) { |
| | | console.log('tab', tab); |
| | | |
| | | this.activeTab = tab.props?.name || tab.name; |
| | | console.log('this.activeTab', this.activeTab); |
| | | |
| | | // 传递所有需要统计的状态列表 |
| | | const statusList = ['0', '2', '3', '4']; |
| | | this.fetchTabCounts(statusList); |
| | | |
| | | this.handleReset(); |
| | | this.page.currentPage = 1; |
| | | this.fetchTableData(); |
| | | }, |
| | | //新增 跳转后触发的Tab切换 |
| | | handleTabChangeAfterJump() { |
| | | const isReview = this.findObject(this.option.column, 'isReview'); |
| | |
| | | } |
| | | } |
| | | |
| | | /* 必填项样式 */ |
| | | .required-label { |
| | | position: relative; |
| | | display: inline-block; |
| | | |
| | | .required-star { |
| | | color: #f56c6c; |
| | | margin-right: 4px; |
| | | } |
| | | } |
| | | |
| | | /* 必填输入框样式 */ |
| | | .required-input { |
| | | width: 100%; |
| | | |
| | | :deep(.el-input__inner), |
| | | :deep(.el-textarea__inner) { |
| | | &:focus { |
| | | border-color: #409eff; |
| | | } |
| | | } |
| | | } |
| | | </style> |