From ad6c295c6999c9f365a918c7171e92a31f199cb6 Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期一, 21 八月 2023 16:31:19 +0800
Subject: [PATCH] 修改報錯

---
 src/views/visualization.vue |   39 +++++++++++++++++----------------------
 1 files changed, 17 insertions(+), 22 deletions(-)

diff --git a/src/views/visualization.vue b/src/views/visualization.vue
index 2a269d9..1ed1c74 100644
--- a/src/views/visualization.vue
+++ b/src/views/visualization.vue
@@ -35,7 +35,11 @@
           <span class="title-item"
             >宸ヤ綔浜烘暟:
             <span class="color_4efefa"
-              >{{ taskData.Procedure.procedure.workers.length || 0 }}浜�</span
+              >
+              <span v-if="taskData.Procedure.procedure&&taskData.Procedure.procedure.workers">{{ taskData.Procedure.procedure.workers.length }}</span>
+                <span v-else>0</span>
+                浜�
+                </span
             >
           </span>
         </div>
@@ -103,9 +107,7 @@
                   :text-inside="true"
                   :stroke-width="30"
                   :percentage="
-                    finishNumber && taskData.Order.amount
-                      ? parseInt(finishNumber / taskData.Order.amount)
-                      : 0
+                    finishPercent
                   "
                 ></el-progress>
               </el-descriptions-item>
@@ -195,7 +197,7 @@
                     <div class="card_top-3">
                       <span class="card-top-r-t"
                         >瀹屾垚杩涘害锛歿{
-                          parseInt(finishNumber / taskData.Order.amount) || 0
+                         finishPercent || 0
                         }}</span
                       >
                       <span class="card-top-r-b">
@@ -205,7 +207,7 @@
                           :text-inside="true"
                           :stroke-width="10"
                           :percentage="
-                            parseInt(finishNumber / taskData.Order.amount)
+                            finishPercent
                           "
                           :show-text="false"
                         ></el-progress>
@@ -367,7 +369,7 @@
         </div>
         <div class="right_dutyLst">
           <div class="right-small-title">褰撳墠鍊肩彮</div>
-          <div class="right-person-box">
+          <div class="right-person-box" v-if="taskData.Procedure.procedure.workers">
             <dl
               class="right-small-person"
               v-for="(item, index) in taskData.Procedure.procedure.workers"
@@ -466,26 +468,15 @@
       passrate: 30, //鍚堟牸鐜�
       production: 25, //鐢熶骇涓�
       finishNumber: 0,
+      finishPercent:0,
       // 鍙充晶瀹屾垚
       finishShow: false,
       inputMaterials: [
-        {
-          amount: 1,
-          materialId: 1,
-          materialName: 1,
-        },
+        
       ],
       outputMaterials: [],
       procedureList: [
-        [
-          {
-            number: 10,
-            name: "宸ュ簭",
-          },
-          {
-            number: 10,
-          },
-        ],
+       
       ],
       taskData: {
         Order: {
@@ -546,6 +537,8 @@
     getProgressInfo() {
       getProgress().then((res) => {
         if (res.code == 200) {
+          this.finishNumber=res.data.finishNumber;
+          this.finishPercent=res.data.finishPercent;
         }
       });
     },
@@ -603,7 +596,8 @@
     getTaskInfo() {
       this.taskData = {
         Order: {},
-        Procedure: { procedure: { inputMaterials: [], outputMaterials: [] } },
+        Procedure: { procedure: { inputMaterials: [], outputMaterials: [],workers:[] } },
+        
       };
       getTaskInfo().then((res) => {
         if (res.code == 200) {
@@ -615,6 +609,7 @@
                   procedure: { inputMaterials: [], outputMaterials: [] },
                 },
               };
+          this.taskData.Procedure.procedure.workers=this.taskData.Procedure.procedure.workers?this.taskData.Procedure.procedure.workers:[]
           this.procedureList.push([
             {
               name: "宸ュ簭",

--
Gitblit v1.8.0