From 281971fb8056d8c244d48fa0db383e48db541f06 Mon Sep 17 00:00:00 2001
From: 86134 <aa>
Date: 星期六, 18 十一月 2023 16:16:09 +0800
Subject: [PATCH] 11

---
 src/views/product/workbench/operation-task-pane.vue |   53 ++++++++++++++++++--------
 src/views/plan/manufacturingorder/index.vue         |    4 +-
 src/views/product/workbench/index.vue               |   44 +++++++++++----------
 3 files changed, 62 insertions(+), 39 deletions(-)

diff --git a/src/views/plan/manufacturingorder/index.vue b/src/views/plan/manufacturingorder/index.vue
index d1e2b8b..99db548 100644
--- a/src/views/plan/manufacturingorder/index.vue
+++ b/src/views/plan/manufacturingorder/index.vue
@@ -110,7 +110,7 @@
             @click="updateOrderNo"
             type="primary"
             style="margin-left:10px;"
-            >鏇存柊璁㈠崟鍙� 
+            >鏇存柊璁㈠崟鍙�
           </el-button>-->
         </template>
       </ttable>
@@ -1662,4 +1662,4 @@
 .gantt-info {
   display: none !important;
 }
-</style>
\ No newline at end of file
+</style>
diff --git a/src/views/product/workbench/index.vue b/src/views/product/workbench/index.vue
index fd3b46e..cbb0fa3 100644
--- a/src/views/product/workbench/index.vue
+++ b/src/views/product/workbench/index.vue
@@ -528,10 +528,11 @@
               </el-form-item>
             </el-form>
           </div>
+          <!--  :style="{ backgroundColor: taskStatusColor() }" -->
           <div class="task-div-content" >
     <div v-if="!isShowNormalTracking" class="task-list-div" >
-      <operationTaskPane
-        ref="operateTaskDiv" :style="{ backgroundColor: taskStatusColor() }"
+      <operationTaskPane 
+        ref="operateTaskDiv"
         :workstationId="dutyForm.workstationId"
         :productSn="operateTaskForm.SN"
         :orderNumber="operateTaskForm.orderNumber"
@@ -544,7 +545,7 @@
     </div>
     <div v-if="isShowNormalTracking" class="task-list-div" >
       <operationTaskTable
-        ref="operateTaskTableDiv" :style="{ backgroundColor: taskStatusColor() }"
+        ref="operateTaskTableDiv"
         :workstationId="dutyForm.workstationId"
         :productSn="operateTaskForm.SN"
         :orderNumber="operateTaskForm.orderNumber"
@@ -1438,7 +1439,6 @@
   box-sizing: border-box;
   overflow-y: auto;
   margin-bottom: 10px;
-
 }
 
 .task-list-div {
@@ -1673,8 +1673,8 @@
     }
   },
   methods: {
-    changeCurrOperateTask() {},
-    refreshWorkReportPageData() {},
+    // changeCurrOperateTask() {},
+    // refreshWorkReportPageData() {},
     refreshOperateTasksByConditions() {
       this.$nextTick(() => {
         this.refreshOperateTasks()
@@ -2519,23 +2519,25 @@
   },
   computed: {
     ...mapGetters(['userInfo', 'tagWel', 'permissions']),
+// 鍗婁釜鏈堜箣鍓嶆槸榛勮壊 褰撳ぉ鍜屼笁澶╀箣鍐呭氨鏄孩鑹� 涓夊ぉ涔嬪悗灏辨槸钃濊壊
+// taskStatusColor() {
+//     return function(date) {
+//         const now = new Date();
+//         const halfMonthAgo = new Date(now - 15 * 24 * 60 * 60 * 1000);
+//         const threeDaysAgo = new Date(now - 3 * 24 * 60 * 60 * 1000);
+//         const oneDayAgo = new Date(now - 24 * 60 * 60 * 1000);
+//         const today = new Date(now);
 
-    taskStatusColor() {
-    return function() {
-      const now = new Date();
-      const threeDaysAgo = new Date(now - 3 * 24 * 60 * 60 * 1000);
-      const oneDayAgo = new Date(now - 24 * 60 * 60 * 1000);
-      const today = new Date(now);
+//         if (halfMonthAgo <= date && date <= threeDaysAgo) {
+//             return 'yellow';
+//         } else if (today <= date && date <= threeDaysAgo) {
+//             return 'red';
+//         } else  {
+//             return 'blue';
+//         }
+//     };
+// }
 
-      if (threeDaysAgo <= today && today <= oneDayAgo) {
-        return 'yellow';
-      } else if (today <= threeDaysAgo) {
-        return 'blue';
-      } else {
-        return 'red';
-      }
-    };
-  }
   },
   created() {
     document.title = '宸ヤ綔鍙扳�斺�擬ES'
diff --git a/src/views/product/workbench/operation-task-pane.vue b/src/views/product/workbench/operation-task-pane.vue
index badea28..e0a5772 100644
--- a/src/views/product/workbench/operation-task-pane.vue
+++ b/src/views/product/workbench/operation-task-pane.vue
@@ -8,7 +8,6 @@
     >
     </el-alert>
     <el-card
-    
   v-for="(item, index) in operationTasks"
     @click.native="setCheckFlag(item)"
   shadow="hover"
@@ -60,10 +59,25 @@
     </div> -->
     <div class="row">
       <div class="l">璁″垝瀹屾垚鏃堕棿锛�</div>
-      <div class="r" >{{ item.planFinishDay }}</div>
+      <div class="r">{{ item.planFinishDay }}</div>
     </div>
   </div>
 
+  <el-progress
+    class="task-progress"
+    :text-inside="true"
+    :stroke-width="20"
+    :percentage="
+      Number((item.completedQuantity / item.plannedQuantity).toFixed(2)) *
+        100 >
+      100
+        ? 100
+        : Number(
+            (item.completedQuantity / item.plannedQuantity).toFixed(2)
+          ) * 100
+    "
+    :format="formatPercentage(item.completedQuantity, item.plannedQuantity)"
+  ></el-progress>
 </el-card>
   </div>
 </template>
@@ -334,6 +348,12 @@
     }
   },
   methods: {
+
+    setCheckFlag(item) {
+      this.$nextTick(() => {
+        this.changeBackgroundColor(item.planFinishDay);
+      });
+    },
     getBackgroundColor(planFinishDay) {
     const currentDate = new Date();
     currentDate.setHours(0, 0, 0, 0); // 璁剧疆鏃堕棿涓哄綋澶╃殑寮�濮嬶紝蹇界暐鏃跺垎绉掓绉�
@@ -341,25 +361,26 @@
     planFinishDayObj.setHours(0, 0, 0, 0); // 鍚屾牱璁剧疆鏃堕棿涓鸿鍒掑畬鎴愭棩鐨勫紑濮�
 
     if (planFinishDayObj < currentDate) {
-      // 濡傛灉璁″垝瀹屾垚鏃ュ湪褰撳墠鏃ヤ箣鍓嶏紝杩斿洖'blue'琛ㄧず杩囨湡
-      return 'red';
+        // 濡傛灉璁″垝瀹屾垚鏃ュ湪褰撳墠鏃ヤ箣鍓嶏紝杩斿洖'rgba(0, 0, 255, 0.3)'琛ㄧず杩囨湡锛岃繖閲岀殑 0.3 鎺у埗浜嗛�忔槑搴�
+        return 'rgba(255, 0, 0, 0.5)';
     } else {
-      const timeDifference = currentDate - planFinishDayObj;
-      const daysDifference = Math.ceil(timeDifference / (1000 * 60 * 60 * 24));
+        const timeDifference = currentDate - planFinishDayObj;
+        const daysDifference = Math.ceil(timeDifference / (1000 * 60 * 60 * 24));
 
-      if (daysDifference < 0) {
-        // 濡傛灉璁″垝瀹屾垚鏃ュ湪鏈潵锛岃绠楀畠鏄惁鍦�10澶╁唴
-        const daysUntilDue = Math.abs(daysDifference);
-        if (daysUntilDue <= 10) {
-          // 濡傛灉鍦�10澶╁唴锛岃繑鍥�'yellow'琛ㄧず鍗冲皢鍒版湡
-          return 'yellow';
+        if (daysDifference < 0) {
+            // 濡傛灉璁″垝瀹屾垚鏃ュ湪鏈潵锛岃绠楀畠鏄惁鍦�10澶╁唴
+            const daysUntilDue = Math.abs(daysDifference);
+            if (daysUntilDue <= 10) {
+                // 濡傛灉鍦�10澶╁唴锛岃繑鍥�'rgba(255, 255, 0, 0.3)'琛ㄧず鍗冲皢鍒版湡锛岃繖閲岀殑 0.3 鎺у埗浜嗛�忔槑搴�
+                return 'rgba(219, 219, 54, 0.7)';
+            }
+            return 'rgba(28, 62, 222, 0.8)';
         }
-      }
     }
-    // 濡傛灉涓嶆槸鍗冲皢鍒版湡鎴栧凡杩囨湡锛岃繑鍥�'red'琛ㄧず宸插埌鏈�
-    return 'blue';
+    // 濡傛灉涓嶆槸鍗冲皢鍒版湡鎴栧凡杩囨湡锛岃繑鍥�'rgba(255, 0, 0, 0.3)'琛ㄧず宸插埌鏈燂紝杩欓噷鐨� 0.3 鎺у埗浜嗛�忔槑搴�
+    return 'rgba(255, 0, 0, 0.5)';
 },
-    
+
     // 鐐瑰嚮宸ュ崟锛岄�変腑宸ュ崟
     setCheckFlag(item) {
       if (item.checkFlag) {

--
Gitblit v1.9.3