From 54b5fa2047324b81b6d2ee7f830693267f946c0a Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期三, 10 一月 2024 17:45:54 +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