From c8a12052a457e33f5acf6e03d3904d50eee40b42 Mon Sep 17 00:00:00 2001
From: 王震 <10952869+daywangzhen@user.noreply.gitee.com>
Date: 星期六, 18 十一月 2023 15:15:46 +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 |  107 ++++++++++++++++-------------------
 vue.config.js                                       |    4 
 src/views/quality/rawMaterial/index.vue             |    2 
 src/views/quality/rawMaterial/rawMaterial-print.vue |   24 ++++---
 4 files changed, 65 insertions(+), 72 deletions(-)

diff --git a/src/views/product/workbench/operation-task-pane.vue b/src/views/product/workbench/operation-task-pane.vue
index 50c7b63..badea28 100644
--- a/src/views/product/workbench/operation-task-pane.vue
+++ b/src/views/product/workbench/operation-task-pane.vue
@@ -8,11 +8,13 @@
     >
     </el-alert>
     <el-card
+    
   v-for="(item, index) in operationTasks"
     @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" >
@@ -58,25 +60,10 @@
     </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>
@@ -105,28 +92,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;
@@ -347,28 +334,32 @@
     }
   },
   methods: {
+    getBackgroundColor(planFinishDay) {
+    const currentDate = new Date();
+    currentDate.setHours(0, 0, 0, 0); // 璁剧疆鏃堕棿涓哄綋澶╃殑寮�濮嬶紝蹇界暐鏃跺垎绉掓绉�
+    const planFinishDayObj = new Date(planFinishDay);
+    planFinishDayObj.setHours(0, 0, 0, 0); // 鍚屾牱璁剧疆鏃堕棿涓鸿鍒掑畬鎴愭棩鐨勫紑濮�
 
-    // 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);
+    if (planFinishDayObj < currentDate) {
+      // 濡傛灉璁″垝瀹屾垚鏃ュ湪褰撳墠鏃ヤ箣鍓嶏紝杩斿洖'blue'琛ㄧず杩囨湡
+      return 'red';
+    } else {
+      const timeDifference = currentDate - planFinishDayObj;
+      const daysDifference = Math.ceil(timeDifference / (1000 * 60 * 60 * 24));
 
-    //   if (date <= threeDaysAgo) {
-    //     document.body.style.backgroundColor = "blue";
-    //   } else if (date <= oneDayAgo) {
-    //     document.body.style.backgroundColor = "yellow";
-    //   } else {
-    //     document.body.style.backgroundColor = "red";
-    //   }
-    // },
-
+      if (daysDifference < 0) {
+        // 濡傛灉璁″垝瀹屾垚鏃ュ湪鏈潵锛岃绠楀畠鏄惁鍦�10澶╁唴
+        const daysUntilDue = Math.abs(daysDifference);
+        if (daysUntilDue <= 10) {
+          // 濡傛灉鍦�10澶╁唴锛岃繑鍥�'yellow'琛ㄧず鍗冲皢鍒版湡
+          return 'yellow';
+        }
+      }
+    }
+    // 濡傛灉涓嶆槸鍗冲皢鍒版湡鎴栧凡杩囨湡锛岃繑鍥�'red'琛ㄧず宸插埌鏈�
+    return 'blue';
+},
+    
     // 鐐瑰嚮宸ュ崟锛岄�変腑宸ュ崟
     setCheckFlag(item) {
       if (item.checkFlag) {
diff --git a/src/views/quality/rawMaterial/index.vue b/src/views/quality/rawMaterial/index.vue
index 57528ab..b5ba1b6 100644
--- a/src/views/quality/rawMaterial/index.vue
+++ b/src/views/quality/rawMaterial/index.vue
@@ -276,7 +276,7 @@
                 type: "html",
                 maxWidth: 880,
                 // header: "鍘熸潗鏂欐娴嬫姤鍛�",
-                style: '@page {margin: 0 5mm;}',
+                style: '@page {margin: 10mm 5mm;}',
                 targetStyles: ["*"],
                 ignoreElements: ["no-ignore"],
                 orientation: 'portrait'
diff --git a/src/views/quality/rawMaterial/rawMaterial-print.vue b/src/views/quality/rawMaterial/rawMaterial-print.vue
index e246703..a13a09a 100644
--- a/src/views/quality/rawMaterial/rawMaterial-print.vue
+++ b/src/views/quality/rawMaterial/rawMaterial-print.vue
@@ -1,6 +1,6 @@
 <template>
 <div style="word-wrap:break-word;text-justify-trim:punctuation">
-    <div class="WordSection1" style="layout-grid:15.6pt;margin-top: 20pt;">
+    <div class="WordSection1" style="layout-grid:15.6pt;">
         <div align="center">
             <table class="MsoTableGrid" border="1" cellspacing="0" cellpadding="0" width="629"
                 style="width:620pt;border-collapse:collapse;border:1pt solid windowtext">
@@ -184,17 +184,17 @@
                 </tbody>
                 <tbody v-for="(item,index) in projectList" :key="index">
                     <tr style="height:19.85pt">
-                        <td width="85" :rowspan="item.children.length" style="width:63.95pt;border:solid windowtext 1.0pt;border-top:1pt solid windowtext;padding:0.2cm 5.4pt 0.2cm 5.4pt;height:19.85pt">
+                        <td width="85" :rowspan="item.children.length" style="width:63.95pt;border:solid windowtext 1.0pt;padding:0.2cm 5.4pt 0.2cm 5.4pt;height:19.85pt">
                             <p class="MsoNormal" align="center" style="text-align:center"><span
                                     style="font-family:瀹嬩綋" v-text="item.rpFather"></span></p>
                             <p class="MsoNormal" align="center" style="text-align:center"><span lang="EN-US"
                                     style="font-family:&quot;Arial&quot;,sans-serif"></span></p>
                         </td>
-                        <td width="60" colspan="2" style="width:65.15pt;border-top:1pt solid windowtext;border-left:1pt solid windowtext;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0.2cm 5.4pt 0.2cm 5.4pt;height:19.85pt">
+                        <td width="60" colspan="2" style="width:65.15pt;border:1pt solid windowtext;padding:0.2cm 5.4pt 0.2cm 5.4pt;height:19.85pt">
                             <p class="MsoNormal" align="center" style="text-align:center"><span lang="EN-US"
                                     style="font-family:&quot;Arial&quot;,sans-serif" v-text="item.children[0].rpName"></span></p>
                         </td>
-                        <td width="59" colspan="3" style="width:44.4pt;border-top:1pt solid windowtext;border-left:1pt solid windowtext;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0.2cm 5.4pt 0.2cm 5.4pt;height:19.85pt">
+                        <td width="59" colspan="3" style="width:44.4pt;border:1pt solid windowtext;padding:0.2cm 5.4pt 0.2cm 5.4pt;height:19.85pt">
                             <p class="MsoNormal" align="center" style="text-align:center"><span lang="EN-US"
                                     style="font-family:&quot;Arial&quot;,sans-serif"  v-text="item.children[0].required"></span></p>
                         </td>
@@ -211,21 +211,20 @@
                                     style="font-family:&quot;Arial&quot;,sans-serif"></span></p>
                         </td>
                     </tr>
-                    <tr style="height:19.85pt" v-for="(j,index) in (item.children.slice(1))" :key="index">
-                        <td width="60" colspan="2" style="width:45.15pt;border-top:1pt solid windowtext;border-left:1pt solid windowtext;
-                        border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0.2cm 5.4pt 0.2cm 5.4pt;height:19.85pt">
+                    <tr class="pageTr" style="height:19.85pt" v-for="(j,index) in (item.children.slice(1))" :key="index">
+                        <td width="60" colspan="2" style="width:45.15pt;border:1pt solid windowtext;padding:0.2cm 5.4pt 0.2cm 5.4pt;height:19.85pt">
                             <p class="MsoNormal" align="center" style="text-align:center"><span lang="EN-US"
                                     style="font-family:&quot;Arial&quot;,sans-serif">{{j.rpName}}</span></p>
                         </td>
-                        <td width="59" colspan="3" style="width:44.4pt;border-top:1pt solid windowtext;border-left:1pt solid windowtext;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0.2cm 5.4pt 0.2cm 5.4pt;height:19.85pt">
+                        <td width="59" colspan="3" style="width:44.4pt;border:1pt solid windowtext;padding:0.2cm 5.4pt 0.2cm 5.4pt;height:19.85pt">
                             <p class="MsoNormal" align="center" style="text-align:center"><span lang="EN-US"
                                     style="font-family:&quot;Arial&quot;,sans-serif">{{j.required}}</span></p>
                         </td>
-                        <td width="59" v-for="(testValue,index) in j.testValueList" :key="index" style="width:44.4pt;border-top:1pt solid windowtext;border-left:1pt solid windowtext;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0.2cm 5.4pt 0.2cm 5.4pt;height:19.85pt">
+                        <td width="59" v-for="(testValue,index) in j.testValueList" :key="index" style="width:44.4pt;border:1pt solid windowtext;padding:0.2cm 5.4pt 0.2cm 5.4pt;height:19.85pt">
                             <p class="MsoNormal" align="center" style="text-align:center"><span lang="EN-US"
                                     style="font-family:&quot;Arial&quot;,sans-serif">{{testValue}}</span></p>
                         </td>
-                        <td width="43" colspan="1" style="width:70pt;border-top:1pt solid windowtext;border-left:1pt solid windowtext;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0.1cm 2.4pt 0.1cm 2.4pt;height:19.85pt">
+                        <td width="43" colspan="1" style="width:70pt;border:1pt solid windowtext;padding:0.1cm 2.4pt 0.1cm 2.4pt;height:19.85pt">
                             <p class="MsoNormal" align="center" style="text-align:center">
                                 <span lang="EN-US" style="font-family:&quot;Arial&quot;,sans-serif">
                                     {{ j.testState | formatState}}
@@ -235,7 +234,7 @@
                     </tr>
                 </tbody>
                     <!-- bottom -->
-                <tr style="height:40.95pt">
+                <tr style="height:40.95pt" class="pageTr">
                     <td width="145" colspan="3" style="width:109.1pt;border:solid windowtext 1.0pt;
   border-top:1pt solid windowtext;padding:0cm 5.4pt 0cm 5.4pt;height:40.95pt">
                         <p class="MsoNormal" align="center" style="text-align:center"><span
@@ -491,6 +490,9 @@
 	margin:72.0pt 2.0cm 2.0cm 2.0cm;
 	layout-grid:15.6pt;
 }
+.pageTr{
+    page-break-inside: avoid;
+}
 div.WordSection1{
     page : WordSection1;
 }
diff --git a/vue.config.js b/vue.config.js
index d12b323..94a4809 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -2,10 +2,10 @@
  * 閰嶇疆鍙傝��:
  * https://cli.vuejs.org/zh/config/
  */
-const url = 'http://192.168.0.23:9999'
+// const url = 'http://192.168.0.23:9999'
 
   // const url = 'http://192.168.0.60:9999'
-  // const url = 'http://localhost:9999'
+  const url = 'http://localhost:9999'
 
 // const url = 'http://ztt-gateway:9999'
 const localUrl = 'http://localhost:8089'

--
Gitblit v1.9.3