From 023ea35893ed047887a43555509335eec7a8b161 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期二, 09 一月 2024 17:28:49 +0800 Subject: [PATCH] 1. 编写评估任务模块中 --- src/components/bg-task/FYBgTaskCard.vue | 33 +++++++++++++++++++++++++++++---- 1 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/components/bg-task/FYBgTaskCard.vue b/src/components/bg-task/FYBgTaskCard.vue index 0c50ec5..591aca6 100644 --- a/src/components/bg-task/FYBgTaskCard.vue +++ b/src/components/bg-task/FYBgTaskCard.vue @@ -21,7 +21,7 @@ </el-col> <el-col :span="20" class="p-l-8"> <el-row justify="space-between"> - <el-text class="m-l-4px w-150px" tag="b" size="large" truncated>{{ model.name }}</el-text> + <el-text class="m-l-4px w-300px" tag="b" size="large" truncated>{{ model.name }}</el-text> <el-tag>{{ nameToLabel(model.type) }}</el-tag> </el-row> <el-row class="p-v-8" align="bottom"> @@ -91,12 +91,13 @@ </template> <script> import { nTlBgTask, BG_TASK_STATUS } from '@/enum/bgTask'; -import { useTimer } from '../../composables/timer'; +import { useTimer } from '@/composables/timer'; +// import { useTimer } from '@/composables/timer2'; export default { setup() { - const { time, startTimer, pauseTimer, stopTimer } = useTimer(); - return { time, startTimer, pauseTimer, stopTimer }; + const { time, startTimer, pauseTimer, stopTimer, count } = useTimer(); + return { time, startTimer, pauseTimer, stopTimer, count }; }, props: { model: Object, @@ -110,6 +111,30 @@ removeConfirm: false }; }, + watch: { + 'model.status': { + handler(nV) { + switch (nV) { + case BG_TASK_STATUS.WAITING.name: + this.stopTimer(); + break; + case BG_TASK_STATUS.RUNNING.name: + this.startTimer(); + break; + case BG_TASK_STATUS.SUCCESS.name: + case BG_TASK_STATUS.FAIL.name: + case BG_TASK_STATUS.SHUTDOWN.name: + this.pauseTimer(); + break; + default: + this.stopTimer(); + break; + } + this.count = this.model.runTime + }, + immediate: true + } + }, computed: { waiting() { return this.model.status == BG_TASK_STATUS.WAITING.name; -- Gitblit v1.9.3