src/views/fysp/check/components/CompProRecent.vue
@@ -1,5 +1,5 @@
<template>
  <CompGenericWrapper type="dialog">
  <CompGenericWrapper type="dialog" draggable :modal="false">
    <template #content>
      <el-tabs v-model="activeName" type="card">
        <el-tab-pane
@@ -58,6 +58,7 @@
import CompProblemAddOrUpd from './CompProblemAddOrUpd.vue';
import taskApi from '@/api/fysp/taskApi';
import { useCloned } from '@vueuse/core';
import dayjs from 'dayjs';
export default {
  computed: {
    // repeteRate() {
@@ -97,7 +98,7 @@
    }
  },
  components: {
    CompProblemAddOrUpd,
    CompProblemAddOrUpd
  },
  mounted() {},
  data() {
@@ -132,16 +133,13 @@
    updateSubtask() {},
    generateQueryParam() {
      // 今天的日期
      const today = new Date();
      const today = dayjs(this.subtask.stPlanTime);
      // 三个月前
      const threeMonthsAgo = new Date(today);
      threeMonthsAgo.setMonth(today.getMonth() - 3);
      const threeMonthsAgo = today.subtract(3, 'month');
      // 计算半年前的日期
      const sixMonthsAgo = new Date(today);
      sixMonthsAgo.setMonth(today.getMonth() - 6);
      const sixMonthsAgo = today.subtract(6, 'month');
      // 计算一年前的日期
      const oneYearAgo = new Date(today);
      oneYearAgo.setFullYear(today.getFullYear() - 1);
      const oneYearAgo = today.subtract(1, 'year');
      return {
        startTime:
@@ -157,28 +155,32 @@
    /**
     * 获取近期情况
     * */
    async getRecentPros() {
    getRecentPros() {
      this.loading = true;
      this.subtaskCount = 0;
      // 获取子任务列表
      await taskApi
        .getSubtaskByScene(this.generateQueryParam())
        .then((subtasks) => {
          this.curProList = [];
          if (subtasks) {
            subtasks.forEach((subtask) => {
              // 获取问题列表
              this.getProBySubtask(subtask);
            });
          }
        });
      // 额外处理
      this.curProList.sort((o1, o2) => o2.getDate() - o1.getDate());
      this.loading = false;
      taskApi.getSubtaskByScene(this.generateQueryParam()).then((subtasks) => {
        this.curProList = [];
        if (subtasks) {
          const promiseList = [];
          subtasks.forEach((subtask) => {
            // 获取问题列表
            promiseList.push(this.getProBySubtask(subtask));
          });
          Promise.all(promiseList)
            .then(() => {
              // 额外处理
              this.curProList.sort((o1, o2) => {
                return o2._time > o1._time;
              });
            })
            .finally(() => (this.loading = false));
        }
      });
    },
    // 根据子任务获取里面的问题列表
    async getProBySubtask(subtask) {
      taskApi.getProBySubtask(subtask.stGuid).then((pros) => {
    getProBySubtask(subtask) {
      return taskApi.getProBySubtask(subtask.stGuid).then((pros) => {
        if (pros) {
          pros.forEach((pro) => {
            if (pro.ptguid == this.deepCopyPro.ptguid) {