From 14c524858cd0e3c69090bcd1f2436137252a92b9 Mon Sep 17 00:00:00 2001
From: 王震 <10952869+daywangzhen@user.noreply.gitee.com>
Date: 星期六, 18 十一月 2023 17:19:00 +0800
Subject: [PATCH] Merge branch 'master' of http://114.132.189.42:9002/r/mes-ocea-before

---
 src/views/product/workbench/operation-task-pane.vue |   94 ++++++++++++++++++++++++++--------------------
 1 files changed, 53 insertions(+), 41 deletions(-)

diff --git a/src/views/product/workbench/operation-task-pane.vue b/src/views/product/workbench/operation-task-pane.vue
index 50c7b63..e0a5772 100644
--- a/src/views/product/workbench/operation-task-pane.vue
+++ b/src/views/product/workbench/operation-task-pane.vue
@@ -13,6 +13,7 @@
   shadow="hover"
   :key="index"
   :class="['task-item', item.checkFlag ? 'card-checked' : 'card-unchecked']"
+  :style="{ backgroundColor: getBackgroundColor(item.planFinishDay) }"
 >
   <!-- <img class="selectedImg" /> -->
   <div class="header" >
@@ -105,28 +106,28 @@
   
   &.card-checked {
     // color: white;
-    background-image: -webkit-linear-gradient(
-        90deg,
-        rgba(12, 149, 255, 0.7) 0%,
-        rgba(38, 176, 254, 0.8) 34%,
-        rgba(12, 149, 255, 0.8) 100%
-      ),
-      -webkit-linear-gradient(#5a97fa, #5a97fa);
-    background-image: -moz-linear-gradient(
-        90deg,
-        rgba(12, 149, 255, 0.7) 0%,
-        rgba(38, 176, 254, 0.8) 34%,
-        rgba(12, 149, 255, 0.8) 100%
-      ),
-      -moz-linear-gradient(#5a97fa, #5a97fa);
-    background-image: linear-gradient(
-        90deg,
-        rgba(12, 149, 255, 0.7) 0%,
-        rgba(38, 176, 254, 0.8) 34%,
-        rgba(12, 149, 255, 0.8) 100%
-      ),
-      linear-gradient(#5a97fa, #5a97fa);
-    background-blend-mode: normal, normal;
+    // background-image: -webkit-linear-gradient(
+    //     90deg,
+    //     rgba(12, 149, 255, 0.7) 0%,
+    //     rgba(38, 176, 254, 0.8) 34%,
+    //     rgba(12, 149, 255, 0.8) 100%
+    //   ),
+    //   -webkit-linear-gradient(#5a97fa, #5a97fa);
+    // background-image: -moz-linear-gradient(
+    //     90deg,
+    //     rgba(12, 149, 255, 0.7) 0%,
+    //     rgba(38, 176, 254, 0.8) 34%,
+    //     rgba(12, 149, 255, 0.8) 100%
+    //   ),
+    //   -moz-linear-gradient(#5a97fa, #5a97fa);
+    // background-image: linear-gradient(
+    //     90deg,
+    //     rgba(12, 149, 255, 0.7) 0%,
+    //     rgba(38, 176, 254, 0.8) 34%,
+    //     rgba(12, 149, 255, 0.8) 100%
+    //   ),
+    //   linear-gradient(#5a97fa, #5a97fa);
+    // background-blend-mode: normal, normal;
   }
   .selectedImg {
     position: absolute;
@@ -348,26 +349,37 @@
   },
   methods: {
 
-    // setCheckFlag(item) {
-    //   this.$nextTick(() => {
-    //     this.changeBackgroundColor(item.planFinishDay);
-    //   });
-    // },
-    // changeBackgroundColor(dateString) {
-    //   const date = new Date(dateString);
-    //   const threeDaysAgo = new Date();
-    //   threeDaysAgo.setDate(threeDaysAgo.getDate() - 3);
-    //   const oneDayAgo = new Date();
-    //   oneDayAgo.setDate(oneDayAgo.getDate() - 1);
+    setCheckFlag(item) {
+      this.$nextTick(() => {
+        this.changeBackgroundColor(item.planFinishDay);
+      });
+    },
+    getBackgroundColor(planFinishDay) {
+    const currentDate = new Date();
+    currentDate.setHours(0, 0, 0, 0); // 璁剧疆鏃堕棿涓哄綋澶╃殑寮�濮嬶紝蹇界暐鏃跺垎绉掓绉�
+    const planFinishDayObj = new Date(planFinishDay);
+    planFinishDayObj.setHours(0, 0, 0, 0); // 鍚屾牱璁剧疆鏃堕棿涓鸿鍒掑畬鎴愭棩鐨勫紑濮�
 
-    //   if (date <= threeDaysAgo) {
-    //     document.body.style.backgroundColor = "blue";
-    //   } else if (date <= oneDayAgo) {
-    //     document.body.style.backgroundColor = "yellow";
-    //   } else {
-    //     document.body.style.backgroundColor = "red";
-    //   }
-    // },
+    if (planFinishDayObj < currentDate) {
+        // 濡傛灉璁″垝瀹屾垚鏃ュ湪褰撳墠鏃ヤ箣鍓嶏紝杩斿洖'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));
+
+        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)';
+        }
+    }
+    // 濡傛灉涓嶆槸鍗冲皢鍒版湡鎴栧凡杩囨湡锛岃繑鍥�'rgba(255, 0, 0, 0.3)'琛ㄧず宸插埌鏈燂紝杩欓噷鐨� 0.3 鎺у埗浜嗛�忔槑搴�
+    return 'rgba(255, 0, 0, 0.5)';
+},
 
     // 鐐瑰嚮宸ュ崟锛岄�変腑宸ュ崟
     setCheckFlag(item) {

--
Gitblit v1.9.3