From 900525f6f881b0ae70a6e07f8b78a5e36f4911e5 Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Thu, 20 Nov 2025 19:03:56 +0800
Subject: [PATCH] feat:11
---
src/views/tickets/ticket.vue | 104 ++++++++++++++++++++++++---------------------------
src/api/tickets/ticket.js | 10 ++++-
2 files changed, 57 insertions(+), 57 deletions(-)
diff --git a/src/api/tickets/ticket.js b/src/api/tickets/ticket.js
index a8cf0cb..139345a 100644
--- a/src/api/tickets/ticket.js
+++ b/src/api/tickets/ticket.js
@@ -73,14 +73,20 @@
}
// 新增接口:获取状态统计数据
-export const getstatusCount = (params) => {
+export const getstatusCount1 = (params) => {
return request({
url: '/drone-device-core/jobEvent/getstatusCount',
method: 'get',
params,
})
}
-
+export const getstatusCount = (data) => {
+ return request({
+ url: '/drone-device-core/jobEvent/getstatusCount',
+ method: 'post',
+ data,
+ })
+}
export const getStepInfo = (eventNum) => {
return request({
url: '/drone-device-core/jobEvent/getStepInfo',
diff --git a/src/views/tickets/ticket.vue b/src/views/tickets/ticket.vue
index fcd979b..8ccbec0 100644
--- a/src/views/tickets/ticket.vue
+++ b/src/views/tickets/ticket.vue
@@ -858,8 +858,8 @@
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 => ({
@@ -1045,40 +1045,55 @@
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');
@@ -2535,26 +2550,5 @@
}
}
-/* 必填项样式 */
-.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>
--
Gitblit v1.9.3