From 67da82f0b0c24df5f19bbfcfec63801d9ae902d8 Mon Sep 17 00:00:00 2001
From: 王震 <10952869+daywangzhen@user.noreply.gitee.com>
Date: 星期三, 13 十二月 2023 16:22:05 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/views/product/workbench/operation-task-pane.vue |  286 +++++++++++++++++++++++++++++++-------------------------
 1 files changed, 158 insertions(+), 128 deletions(-)

diff --git a/src/views/product/workbench/operation-task-pane.vue b/src/views/product/workbench/operation-task-pane.vue
index e0a5772..4c9c558 100644
--- a/src/views/product/workbench/operation-task-pane.vue
+++ b/src/views/product/workbench/operation-task-pane.vue
@@ -1,6 +1,6 @@
 <template>
   <div>
-    <el-alert 
+    <el-alert
       v-if="!operationTasks || operationTasks.length == 0"
       title="杩樻病鏈夊伐鍗曚笅鍙戝埌姝ゆ満鍙帮紒"
       type="warning"
@@ -9,76 +9,84 @@
     </el-alert>
     <el-card
   v-for="(item, index) in operationTasks"
-    @click.native="setCheckFlag(item)"
+  @click.native="setCheckFlag(item)"
   shadow="hover"
   :key="index"
   :class="['task-item', item.checkFlag ? 'card-checked' : 'card-unchecked']"
-  :style="{ backgroundColor: getBackgroundColor(item.planFinishDay) }"
->
-  <!-- <img class="selectedImg" /> -->
-  <div class="header" >
-    <div>宸ュ崟鍙凤細{{ item.taskNo }}</div>
-    <!-- <div>璁″垝鍙凤細{{ item.mpsNo }}</div> -->
-    <div  
-      :class="[
-        'status-change-div',
-        item.checkFlag ? 'card-checked-status' : 'card-status'
-      ]"
-    >
-      <el-select
-        v-if="permissions.product_operationTask_state"
-        v-model="item.statusAction"
-        placeholder="鍔熻兘鑿滃崟"
-        @change="
-          changeTaskState(item.statusAction, item.status, item.id, item)
-        "
-      >
-        <el-option
-          v-for="ele in statusActions"
-          :key="ele.value"
-          :label="ele.label"
-          :value="ele.value"
-          :disabled="ele.disabled"
-        >
-        </el-option>
-      </el-select>
-    </div>
-  </div>
-  <div class="body">
-    <div class="row">
-      <div class="l">闆朵欢鍚嶇О锛�</div>
-      <div class="r">{{ item.partName }}</div>
-    </div>
-    <div class="row">
-      <div class="l">闆朵欢鍙凤細</div>
-      <div class="r">{{ item.partNo }}</div>
-    </div>
-    <!-- <div class="row">
-      <div class="l">鎴愬搧锛�</div>
-      <div class="r">{{ item.productName }}</div>
-    </div> -->
-    <div class="row">
-      <div class="l">璁″垝瀹屾垚鏃堕棿锛�</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>
+>
+      <img class="selectedImg" src="/img/workbench/icon_selected.png" />
+      <div class="header">
+        <div>宸ュ崟鍙凤細{{ item.taskNo }}</div>
+        <el-alert
+          center
+          style="width: 80px;height:28px;line-height: 100%;font-size:10px"
+          :title="getTagText(item.planFinishDay)"
+          :type="getTagColor(item.planFinishDay)"
+          effect="dark"
+          :closable="false">
+        </el-alert>
+        <!-- <div>璁″垝鍙凤細{{ item.mpsNo }}</div> -->
+        <div
+          :class="[
+            'status-change-div',
+            item.checkFlag ? 'card-checked-status' : 'card-status'
+          ]"
+        >
+          <el-select
+            v-if="permissions.product_operationTask_state"
+            v-model="item.statusAction"
+            placeholder="鍔熻兘鑿滃崟"
+            @change="
+              changeTaskState(item.statusAction, item.status, item.id, item)
+            "
+          >
+            <el-option
+              v-for="ele in statusActions"
+              :key="ele.value"
+              :label="ele.label"
+              :value="ele.value"
+              :disabled="ele.disabled"
+            >
+            </el-option>
+          </el-select>
+        </div>
+      </div>
+      <div class="body">
+        <div class="row">
+          <div class="l">闆朵欢鍚嶇О锛�</div>
+          <div class="r">{{ item.partName }}</div>
+        </div>
+        <div class="row">
+          <div class="l">闆朵欢鍙凤細</div>
+          <div class="r">{{ item.partNo }}</div>
+        </div>
+        <!-- <div class="row">
+          <div class="l">鎴愬搧锛�</div>
+          <div class="r">{{ item.productName }}</div>
+        </div> -->
+        <div class="row">
+          <div class="l">璁″垝瀹屾垚鏃堕棿锛�</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>
 <style lang="scss" scoped>
@@ -92,42 +100,52 @@
   flex-direction: column;
   align-items: center;
 }
+
+.tag{
+width: 80px;
+height: 30px;
+line-height: 30px;
+border-radius:15% ;
+text-align: center;
+font-size:8px;
+color:white;
+align-content: 30px;
+}
+
+
 .task-item {
   width: 100%;
   border-radius: 12px;
   cursor: pointer;
   position: relative;
-background:none;
   box-shadow: 1px 2px 24px 1px rgba(4, 0, 0, 0.14);
-   
   & + .task-item {
     margin-top: 10px;
   }
-  
   &.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;
@@ -218,7 +236,7 @@
 }
 .status-change-div {
   width: 20%;
-  max-width: 100px;
+  max-width: 160px;
 }
 .status-change-div >>> .el-select {
   width: 100%;
@@ -328,7 +346,7 @@
     }
   },
   computed: {
-    ...mapGetters(['permissions'])
+    ...mapGetters(['permissions']),
   },
   created() {
     if (!this.defaultOperationId) {
@@ -349,38 +367,56 @@
   },
   methods: {
 
-    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); // 鍚屾牱璁剧疆鏃堕棿涓鸿鍒掑畬鎴愭棩鐨勫紑濮�
+//     getBackgroundColor(planFinishDay) {
+//   const today = new Date();
+//   const planDate = new Date(planFinishDay);
+//   if (planDate < today) {
+//     return 'rgba( 255,0,0,1)'; // 瓒呮湡涓虹孩鑹�
+//   } else {
+//     const timeDiff = planDate.getTime() - today.getTime();
+//     const daysDiff = Math.ceil(timeDiff / (1000 * 3600 * 24));
+//     if (daysDiff <= 3) {
+//       return 'rgba(255,204,62, 1)';  // 涓存湡涓洪粍鑹� 
+//     } else {
+//       return 'rgba(86,219, 25,1)';  // 姝e父涓虹豢鑹�
+//     }
+//   }
+// },
 
-    if (planFinishDayObj < currentDate) {
-        // 濡傛灉璁″垝瀹屾垚鏃ュ湪褰撳墠鏃ヤ箣鍓嶏紝杩斿洖'rgba(0, 0, 255, 0.3)'琛ㄧず杩囨湡锛岃繖閲岀殑 0.3 鎺у埗浜嗛�忔槑搴�
-        return 'rgba(255, 0, 0, 0.5)';
+getTagColor(planFinishDay) {
+  const today = new Date();
+  const planDate = new Date(planFinishDay);
+  if (planDate < today) {
+    //return 'rgba( 255,0,0,1)'; // 瓒呮湡涓虹孩鑹�
+    return 'error'; // 瓒呮湡涓虹孩鑹�
+  } else {
+    const timeDiff = planDate.getTime() - today.getTime();
+    const daysDiff = Math.ceil(timeDiff / (1000 * 3600 * 24));
+    if (daysDiff <= 3) {
+      //return 'rgba(255,204,62, 1)';  // 涓存湡涓洪粍鑹� 
+      return 'warning';  // 涓存湡涓洪粍鑹� 
     } 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)';
-        }
+      //return 'rgba(86,219, 25,1)';  // 姝e父涓虹豢鑹�
+      return 'success';  // 姝e父涓虹豢鑹�
     }
-    // 濡傛灉涓嶆槸鍗冲皢鍒版湡鎴栧凡杩囨湡锛岃繑鍥�'rgba(255, 0, 0, 0.3)'琛ㄧず宸插埌鏈燂紝杩欓噷鐨� 0.3 鎺у埗浜嗛�忔槑搴�
-    return 'rgba(255, 0, 0, 0.5)';
+  }
 },
 
+getTagText(planFinishDay) {
+  const today = new Date();
+  const planDate = new Date(planFinishDay);
+  if (planDate < today) {
+    return '瓒呮湡'; 
+  } else {
+    const timeDiff = planDate.getTime() - today.getTime();
+    const daysDiff = Math.ceil(timeDiff / (1000 * 3600 * 24));
+    if (daysDiff <= 3) {
+      return '涓存湡';
+    } else {
+      return '姝e父';
+    }
+  }
+},
     // 鐐瑰嚮宸ュ崟锛岄�変腑宸ュ崟
     setCheckFlag(item) {
       if (item.checkFlag) {
@@ -514,16 +550,13 @@
           .then((res) => {
             if (!res.data.data) {
               changeSubmitState(taskId, true).then((res) => {
-                console.log(res)
               })
               getDraftProductOut(taskId).then((response) => {
-                console.log(response)
                 const list = response.data.data || []
                 if (list.length > 0) {
                   this.batchChangeSubmit(list, 0, currItem)
                 } else {
                   changeSubmitState(taskId, false).then((res) => {
-                    console.log(res)
                   })
                   currItem.statusAction = null
                   this.$message.warning('娌℃湁鍙彁浜ょ殑鏁版嵁')
@@ -553,7 +586,6 @@
           .catch((error) => {
             console.log(error)
             changeSubmitState(taskId, false).then((res) => {
-              console.log(res)
             })
           })
       }
@@ -576,7 +608,6 @@
             this.batchChangeSubmit(list, i, currItem)
           } else {
             changeSubmitState(this.taskID, false).then((res) => {
-              console.log(res)
             })
             // 鎵归噺鎻愪氦瀹屾垚锛屽埛鏂版姤宸ラ〉闈㈡暟鎹�
             this.$emit('refreshReport')
@@ -586,7 +617,6 @@
           console.log(error)
           loading.close()
           changeSubmitState(this.taskID, false).then((res) => {
-            console.log(res)
           })
           const errorMsg = '鎶ュ伐鍗曞彿' + list[i].productNo + '锛�'
           this.$message.error(errorMsg + '澶勭悊澶辫触')
@@ -689,7 +719,7 @@
                       break
                     }
                   }
-                  console.log(this.operationTasks)
+                  // console.log(this.operationTasks)
                   // 鑻ュ綋鍓嶅伐鍗曞湪宸ュ崟鍒楄〃鏈鎵惧埌涓斿綋鍓嶅伐鍗曠姸鎬佷负宸插畬鎴愭垨宸插彇娑堟椂锛屽垯灏嗗綋鍓嶅伐鍗曢噸缃负绌哄苟鎶涘嚭浜嬩欢锛屽惁鍒欎笉绠�
                   if (isResetCurrOpertionTaskFlag) {
                     getOperationTaskById(taskId).then((res) => {

--
Gitblit v1.9.3