无人机管理后台前端(已迁走)
shuishen
2025-05-08 453f99625fee2116d3ef732710395248edae307b
工单复核功能处理
2 files modified
149 ■■■■ changed files
src/api/tickets/ticket.js 72 ●●●●● patch | view | raw | blame | history
src/views/tickets/ticket.vue 77 ●●●●● patch | view | raw | blame | history
src/api/tickets/ticket.js
@@ -1,30 +1,30 @@
import request from '@/axios';
import request from '@/axios'
export const getList = (data) => {
  return request({
    url: '/drone-device-core/jobEvent/eventPage',
    method: 'post',
    data,
  });
};
  })
}
// 修改创建工单的方法
export const createTicket = (data, file) => {
  const formData = new FormData();
  const formData = new FormData()
  // 创建 eventDto 对象,不显式设置 file 字段
  const eventDto = {
    ...data  // 直接使用传入的 data,不添加 file: null
  };
  }
  // 添加所有字段到 FormData
  Object.entries(eventDto).forEach(([key, value]) => {
    formData.append(key, value);
  });
    formData.append(key, value)
  })
  // 只有当 file 存在时才添加文件
  if (file) {
    formData.append("file", file);
    formData.append("file", file)
  }
  return request({
@@ -34,8 +34,8 @@
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  });
};
  })
}
// 新增接口:获取工单详细信息
export const getTicketInfo = (id) => {
@@ -43,23 +43,23 @@
    url: '/drone-device-core/jobEvent/getTicketInfo',
    method: 'get',
    params: { id }, // 使用工单 ID 查询
  });
};
  })
}
// 修改接口:处理待审核状态,动态构建 FormData 提交
export const flowEvent = (data, file) => {
  const formData = new FormData();
  const formData = new FormData()
  // 动态添加非空字段到 FormData
  Object.entries(data).forEach(([key, value]) => {
    if (value !== undefined && value !== null) {
      formData.append(key, value);
      formData.append(key, value)
    }
  });
  })
  // 如果 file 存在,则添加到 FormData
  if (file) {
    formData.append('file', file);
    formData.append('file', file)
  }
  return request({
@@ -69,8 +69,8 @@
    headers: {
      'Content-Type': 'multipart/form-data', // 设置为表单数据格式
    },
  });
};
  })
}
// 新增接口:获取状态统计数据
export const getstatusCount = (params) => {
@@ -78,13 +78,37 @@
    url: '/drone-device-core/jobEvent/getstatusCount',
    method: 'get',
    params,
  });
};
  })
}
export const getStepInfo = (eventNum) => {
  return request({
    url: '/drone-device-core/jobEvent/getStepInfo',
    method: 'get',
    params: { eventNum }
  });
};
  })
}
// 人工复核接口
export const getReviewById = (id) => {
  return request({
    url: `/drone-device-core/jobEvent/reviewById/${id}`,
    method: 'get',
  })
}
// 获取机器复核可执行时间
export const getReCheckTime = (id) => {
  return request({
    url: `/`,
    method: 'get',
  })
}
// 下发任务
export const getCreateEventJob = (id) => {
  return request({
    url: `/drone-device-core/wayline/waylineJobInfo/createEventJob/${id}`,
    method: 'post',
  })
}
src/views/tickets/ticket.vue
@@ -48,9 +48,12 @@
                <el-button type="text" icon="el-icon-delete" class="danger-button"
                  @click="handleDelete(row)">删除</el-button>
              </template>
              <template v-else>
                <el-button type="text" icon="el-icon-view" @click="handleViewDetail(row)">详情</el-button>
              </template>
              <el-button v-if="row.status === 4" type="text" icon="el-icon-check" @click="reCheck(row)">复核</el-button>
            </template>
            <template #status="{ row }">
              <span :style="getStatusTagType(row.status) ? 'color:' + getStatusTagType(row.status) : ''">
@@ -466,13 +469,34 @@
        </div>
      </template>
    </el-dialog>
    <!-- 复核弹出层 -->
    <el-dialog v-model="reCheckDialog" title="工单复核" width="30%" append-to-body custom-class="re-check-dialog"
      @close="reCheckDialog = false">
      <div class="dialog-footer">
        <el-button type="primary" @click="reCheckConfirm(1)">人工复核</el-button>
        <el-button type="primary" @click="reCheckConfirm(2)">机器复核</el-button>
      </div>
    </el-dialog>
  </basic-container>
</template>
<script>
import { ElMessageBox } from 'element-plus'
import { calculateDefaultRange } from '@/utils/util'
import { gcj02ToWgs84, wgs84ToGcj02 } from '@/utils/coordinateTransformation'
import { getList, createTicket, getTicketInfo, flowEvent, getstatusCount, getStepInfo } from '@/api/tickets/ticket'
import {
  getList,
  createTicket,
  getTicketInfo,
  flowEvent,
  getstatusCount,
  getStepInfo,
  getReviewById,
  getReCheckTime,
  getCreateEventJob
} from '@/api/tickets/ticket'
import { export_json_to_excel } from '@/utils/exportExcel'
import geoJson from '@/assets/geoJson.json'
@@ -653,6 +677,9 @@
      // 配置时间选择器默认配置
      datePickerDefaultVal: calculateDefaultRange(),
      // 复核弹窗
      reCheckDialog: false,
    }
  },
  created () {
@@ -828,8 +855,6 @@
    showIsReviewText () {
      return (row) => {
        console.log(row, 111111)
        if (['4', '5'].includes(String(row.status))) return row.isReview === 1 ? '是' : '否'
        return '/'
@@ -2271,6 +2296,45 @@
      }
      return [String(lng), String(lat)]
    },
    // 复核按钮
    reCheck (row) {
      this.reCheckData = row
      this.reCheckDialog = true
    },
    // 复核确认框按钮事件
    reCheckConfirm (key) {
      const that = this
      if (key == 1) {
        getReviewById(this.reCheckData.id).then(res => {
          this.reCheckDialog = false
          this.page.currentPage = 1
          this.fetchTableData()
          this.fetchTabCounts()
        })
      } else {
        // 获取时间的接口
        getReCheckTime(that.reCheckData.id).then(res => {
          ElMessageBox.confirm(`确认在该${res.data.data}时间进行复核?`)
            .then(() => {
              // 生成任务的接口
              getCreateEventJob(that.reCheckData.id).then(() => {
                that.page.currentPage = 1
                that.fetchTableData()
                that.fetchTabCounts()
              })
            })
            .catch(() => {
              // catch error
            })
        })
      }
    }
  },
}
@@ -2799,6 +2863,13 @@
  }
}
.re-check-dialog {
  :deep(.el-dialog__body) {
    padding: 0;
    background-color: #f5f7fa;
  }
}
.review-container {
  position: relative;