From c40f4c1267dae4fcf27dbbd75ea83014fba87783 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期二, 15 七月 2025 15:28:21 +0800 Subject: [PATCH] 新增联合执法清单 --- src/views/fysp/check/components/CompProRecent.vue | 149 +++++++++++++++++++++++++------------------------ 1 files changed, 77 insertions(+), 72 deletions(-) diff --git a/src/views/fysp/check/components/CompProRecent.vue b/src/views/fysp/check/components/CompProRecent.vue index 3dff972..6305479 100644 --- a/src/views/fysp/check/components/CompProRecent.vue +++ b/src/views/fysp/check/components/CompProRecent.vue @@ -1,15 +1,24 @@ <template> - <div> - <el-tabs v-model="activeName" type="card"> - <el-tab-pane v-for="item in ranges" :label="item" :name="item"> </el-tab-pane> - </el-tabs> - <div class="proList"> - <el-card class="card-style" shadow="hover"> - <el-descriptions v-loading="loading"> - <el-descriptions-item label="鎬诲嚭鐜版鏁�">{{ curProList.length }}</el-descriptions-item> - <!-- <el-descriptions-item label="澶嶇幇鐜�">{{ repeteRate }}%</el-descriptions-item> --> - </el-descriptions> - <!-- <el-descriptions v-loading="loading" column="3"> + <CompGenericWrapper type="dialog" draggable :modal="false"> + <template #content> + <el-tabs v-model="activeName" type="card"> + <el-tab-pane + v-for="(item, i) in ranges" + :key="i" + :label="item" + :name="item" + > + </el-tab-pane> + </el-tabs> + <div class="proList"> + <el-card class="card-style" shadow="hover" v-loading="loading"> + <el-descriptions> + <el-descriptions-item label="鎬诲嚭鐜版鏁�">{{ + curProList.length + }}</el-descriptions-item> + <!-- <el-descriptions-item label="澶嶇幇鐜�">{{ repeteRate }}%</el-descriptions-item> --> + </el-descriptions> + <!-- <el-descriptions v-loading="loading" column="3"> <div v-for="pro in curProList"> <el-descriptions-item>{{ pro.problemname }}</el-descriptions-item> <el-descriptions-item label="浠诲姟鍚嶇О">{{ pro._stName }}</el-descriptions-item> @@ -18,43 +27,43 @@ </el-descriptions-item> </div> </el-descriptions> --> - <el-table :data="curProList" style="width: 100%"> - <el-table-column type="index" width="50" /> - <el-table-column prop="problemname" label="闂"/> - <el-table-column prop="_time" label="鏃堕棿" width="250" /> - <el-table-column prop="鎿嶄綔" label="鎿嶄綔" width="180"> - <template v-slot="scope"> - <el-button link type="primary" @click="info(scope.row)">璇︽儏</el-button> - </template> - </el-table-column> - </el-table> - </el-card> - <el-dialog + <el-table :data="curProList" style="width: 100%"> + <el-table-column type="index" width="50" /> + <el-table-column prop="problemname" label="闂" /> + <el-table-column prop="_time" label="鏃堕棿" width="250" /> + <el-table-column label="鎿嶄綔" width="180"> + <template v-slot="scope"> + <el-button link type="primary" @click="info(scope.row)" + >璇︽儏</el-button + > + </template> + </el-table-column> + </el-table> + </el-card> + </div> + <CompProblemAddOrUpd + v-model:visible="proAddOrUpdDialogVisible" title="棰勮" - v-model="proAddOrUpdDialogVisible" - :before-close="proAddOrUpdDialogClose" - width="80%" - > - <CompProblemAddOrUpd - v-if="proAddOrUpdDialogVisible" - :subtask="subtask" - :topTask="topTask" - :problem="previewPro" - :readonly="true" - ref="compProblemAddOrUpdRef" - /> - </el-dialog> - </div> - </div> + :subtask="subtask" + :topTask="topTask" + :problem="previewPro" + :readonly="true" + ref="compProblemAddOrUpdRef" + /> + <el-dialog destroy-on-close> </el-dialog> + </template> + </CompGenericWrapper> </template> <script> import CompProblemAddOrUpd from './CompProblemAddOrUpd.vue'; import taskApi from '@/api/fysp/taskApi'; +import problemApi from '@/api/fysp/problemApi'; import { useCloned } from '@vueuse/core'; +import dayjs from 'dayjs'; export default { computed: { // repeteRate() { - // return this.curProList.length !== 0 ? (this.curProList.length - 1) / this.subtaskCount * 1.0 : 0 + // return this.curProList.length !== 0 ? (this.curProList.length - 1) / this.subtaskCount * 1.0 : 0 // }, }, props: { @@ -80,17 +89,19 @@ handler(newObj, oldObj) { this.handleClick(); } + }, + problem: { + handler(nv, ov) { + this.deepCopyPro = useCloned(this.problem).cloned.value; + this.getRecentPros(); + }, + immediate: true } }, components: { CompProblemAddOrUpd }, - mounted() { - console.log('subtask', this.subtask); - - this.deepCopyPro = useCloned(this.problem).cloned.value; - this.getRecentPros(); - }, + mounted() {}, data() { return { proAddOrUpdDialogVisible: false, @@ -116,10 +127,6 @@ this.previewPro = pro; this.proAddOrUpdDialogVisible = true; }, - // 鍏抽棴璇︽儏寮圭獥 - proAddOrUpdDialogClose() { - this.proAddOrUpdDialogVisible = false; - }, // 鍒囨崲鏃堕棿鑼冨洿 handleClick() { this.getRecentPros(); @@ -127,20 +134,14 @@ 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); - console.log('today', this.$fm.formatYMDH(today)); - console.log('threeMonthsAgo', this.$fm.formatYMDH(threeMonthsAgo)); - console.log('sixMonthsAgo', this.$fm.formatYMDH(sixMonthsAgo)); - console.log('oneYearAgo', this.$fm.formatYMDH(oneYearAgo)); + const oneYearAgo = today.subtract(1, 'year'); + return { startTime: this.activeName === '杩戜笁涓湀' @@ -155,33 +156,37 @@ /** * 鑾峰彇杩戞湡鎯呭喌 * */ - async getRecentPros() { + getRecentPros() { this.loading = true; - this.subtaskCount = 0 + this.subtaskCount = 0; // 鑾峰彇瀛愪换鍔″垪琛� - await taskApi.getSubtaskByScene(this.generateQueryParam()).then((subtasks) => { + taskApi.getSubtaskByScene(this.generateQueryParam()).then((subtasks) => { this.curProList = []; if (subtasks) { + const promiseList = []; subtasks.forEach((subtask) => { // 鑾峰彇闂鍒楄〃 - this.getProBySubtask(subtask); + promiseList.push(this.getProBySubtask(subtask)); }); + Promise.all(promiseList) + .then(() => { + // 棰濆澶勭悊 + this.curProList.sort((o1, o2) => { + return o2._time > o1._time; + }); + }) + .finally(() => (this.loading = false)); } - }); - // 棰濆澶勭悊 - console.log('curr', this.curProList); - this.curProList.sort((o1, o2) => o2.getTime() - o1.getTime()); - this.loading = false; }, // 鏍规嵁瀛愪换鍔¤幏鍙栭噷闈㈢殑闂鍒楄〃 - async getProBySubtask(subtask) { - taskApi.getProBySubtask(subtask.stGuid).then((pros) => { + getProBySubtask(subtask) { + return problemApi.getProBySubtask(subtask.stGuid).then((pros) => { if (pros) { pros.forEach((pro) => { if (pro.ptguid == this.deepCopyPro.ptguid) { pro._stName = subtask.stName; - pro._time = this.$fm.formatYM(subtask.stPlanTime) + pro._time = this.$fm.formatYMD(subtask.stPlanTime); this.curProList.push(pro); } }); -- Gitblit v1.9.3