From 89ab2ec7f8790c5cc184de98682af032c69c2afc Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期三, 11 九月 2024 15:13:27 +0800
Subject: [PATCH] 2024.9.11

---
 src/components/inspection/TaskItem.vue |   50 ++++++++++++++++++++++++++++++++------------------
 1 files changed, 32 insertions(+), 18 deletions(-)

diff --git a/src/components/inspection/TaskItem.vue b/src/components/inspection/TaskItem.vue
index ca54f28..f508784 100644
--- a/src/components/inspection/TaskItem.vue
+++ b/src/components/inspection/TaskItem.vue
@@ -1,5 +1,8 @@
 <template>
   <!-- <div class="demo-progress border-r-small"> -->
+  <el-row justify="end">
+    <el-text type="info">{{ name }}</el-text>
+  </el-row>
   <el-row justify="space-evenly">
     <el-col span="12">
       <div class="v-center">
@@ -8,14 +11,14 @@
           :width="100"
           type="circle"
           status="warning"
-          :percentage="(finish / total) * 100"
+          :percentage="percentFormat(completetask, totaltask)"
         >
           <template #default="{ percentage }">
             <span class="percentage-value">{{ percentage }}%</span>
             <!-- <span class="percentage-label">{{ finish + '/' + total }}</span> -->
           </template>
         </el-progress>
-        <el-text size="small">{{ finish + '/' + total }}</el-text>
+        <el-text size="small">{{ completetask + '/' + totaltask }}</el-text>
       </div>
     </el-col>
     <el-col span="12" class="flex-bottom">
@@ -30,7 +33,7 @@
             :stroke-width="3"
             type="circle"
             status="warning"
-            :percentage="(item.finish / item.total) * 100"
+            :percentage="percentFormat(item.finish, item.total)"
           >
             <template #default="{ percentage }">
               <span class="percentage-value-small">{{ percentage }}%</span>
@@ -53,12 +56,15 @@
 export default {
   props: {
     name: String,
+    province: String,
     district: String,
     planTime: String,
     startTime: String,
     endTime: String,
     userName: String,
     status: String,
+    totaltask: Number,
+    completetask: Number,
 
     count: Array
   },
@@ -67,22 +73,30 @@
   },
   watch: {},
   computed: {
-    total() {
-      let t = 0
-      this.count.forEach((c) => {
-        t += c.total
-      })
-      return t
-    },
-    finish() {
-      let t = 0
-      this.count.forEach((c) => {
-        t += c.finish
-      })
-      return t
-    }
+    // total() {
+    //   let t = 0
+    //   this.count.forEach((c) => {
+    //     t += c.total
+    //   })
+    //   return t
+    // },
+    // finish() {
+    //   let t = 0
+    //   this.count.forEach((c) => {
+    //     t += c.finish
+    //   })
+    //   return t
+    // }
   },
-  methods: {}
+  methods: {
+    percentFormat(finish, total) {
+      if (total == 0) {
+        return 0
+      } else {
+        return Math.round((finish / total) * 100)
+      }
+    }
+  }
 }
 </script>
 

--
Gitblit v1.9.3