From ad208889ad6ca2283a06d7bc440ecd289c535d83 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期四, 03 四月 2025 17:26:29 +0800 Subject: [PATCH] 1. 添加显示问题整改的时间; 2. 新增巡查场景数、巡查点次、复查点次的统计; 3. 添加扬尘监测数据统计结果管理(待完成) --- src/views/fysp/check/components/CompProRecent.vue | 52 +++++++++++++++++++++++++++------------------------- 1 files changed, 27 insertions(+), 25 deletions(-) diff --git a/src/views/fysp/check/components/CompProRecent.vue b/src/views/fysp/check/components/CompProRecent.vue index 930bbbb..66fc00c 100644 --- a/src/views/fysp/check/components/CompProRecent.vue +++ b/src/views/fysp/check/components/CompProRecent.vue @@ -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) { -- Gitblit v1.9.3