From 9ae715c71e78d4d68b05a91b399b3f6c91ee45e7 Mon Sep 17 00:00:00 2001
From: 86134 <aa>
Date: 星期五, 17 十一月 2023 10:07:36 +0800
Subject: [PATCH] 11

---
 src/views/product/workbench/operation-task-pane.vue     |  163 +++++++++++--------
 src/views/product/workbench/taskinfo-pane.vue           |    1 
 src/views/product/workbench/workstationoperate-form.vue |    1 
 src/views/product/workbench/index.vue                   |  260 +++++++++++++++++--------------
 4 files changed, 239 insertions(+), 186 deletions(-)

diff --git a/src/views/product/workbench/index.vue b/src/views/product/workbench/index.vue
index 026fcfe..fd3b46e 100644
--- a/src/views/product/workbench/index.vue
+++ b/src/views/product/workbench/index.vue
@@ -256,7 +256,7 @@
                             >
                           </div>
                         </div>
-                        <div class="start-end-div">
+                        <div class="start-end-div"  >
                           <div>
                             <span
                               style="margin-left:8px;font-size:12px;line-height:32px;"
@@ -528,35 +528,36 @@
               </el-form-item>
             </el-form>
           </div>
-          <div class="task-div-content">
-            <div v-if="!isShowNormalTracking" class="task-list-div">
-              <operationTaskPane
-                ref="operateTaskDiv"
-                :workstationId="dutyForm.workstationId"
-                :productSn="operateTaskForm.SN"
-                :orderNumber="operateTaskForm.orderNumber"
-                :spec="operateTaskForm.spec"
-                :outBatchNo="operateTaskForm.outBatchNo"
-                :mpsNo="operateTaskForm.mpsNo"
-                @changeCurrOperateTask="changeCurrOperateTask"
-                @refreshReport="refreshWorkReportPageData"
-              />
-            </div>
-            <div v-if="isShowNormalTracking" class="task-list-div">
-              <operationTaskTable
-                ref="operateTaskTableDiv"
-                :workstationId="dutyForm.workstationId"
-                :productSn="operateTaskForm.SN"
-                :orderNumber="operateTaskForm.orderNumber"
-                :spec="operateTaskForm.spec"
-                :mpsNo="operateTaskForm.mpsNo"
-                @changeCurrOperateTask="changeCurrOperateTask"
-              />
-            </div>
-          </div>
+          <div class="task-div-content" >
+    <div v-if="!isShowNormalTracking" class="task-list-div" >
+      <operationTaskPane
+        ref="operateTaskDiv" :style="{ backgroundColor: taskStatusColor() }"
+        :workstationId="dutyForm.workstationId"
+        :productSn="operateTaskForm.SN"
+        :orderNumber="operateTaskForm.orderNumber"
+        :spec="operateTaskForm.spec"
+        :outBatchNo="operateTaskForm.outBatchNo"
+        :mpsNo="operateTaskForm.mpsNo"
+        @changeCurrOperateTask="changeCurrOperateTask"
+        @refreshReport="refreshWorkReportPageData"
+      />
+    </div>
+    <div v-if="isShowNormalTracking" class="task-list-div" >
+      <operationTaskTable
+        ref="operateTaskTableDiv" :style="{ backgroundColor: taskStatusColor() }"
+        :workstationId="dutyForm.workstationId"
+        :productSn="operateTaskForm.SN"
+        :orderNumber="operateTaskForm.orderNumber"
+        :spec="operateTaskForm.spec"
+        :mpsNo="operateTaskForm.mpsNo"
+        @changeCurrOperateTask="changeCurrOperateTask"
+      />
+    </div>
+
+  </div>
         </div>
       </div>
-      <div :style="{ width: mainMiddleWidth }" v-show="mainMiddleShow">
+      <div :style="{ width: mainMiddleWidth } " v-show="mainMiddleShow">
         <div style="height:86px;width:14px;position: absolute;top:50%">
           <el-tooltip effect="dark" content="鏀剁缉" placement="left">
             <img
@@ -1437,6 +1438,7 @@
   box-sizing: border-box;
   overflow-y: auto;
   margin-bottom: 10px;
+
 }
 
 .task-list-div {
@@ -1560,6 +1562,10 @@
   },
   data() {
     return {
+      dutyForm: {},
+      operateTaskForm: {},
+      isShowNormalTracking: false,
+      // taskStatusColor: '',
       showBan: false,
       dutyCanEdit: false,
       saveButton: false,
@@ -1666,96 +1672,9 @@
       currItem: 'task'
     }
   },
-  computed: {
-    ...mapGetters(['userInfo', 'tagWel', 'permissions'])
-  },
-  created() {
-    document.title = '宸ヤ綔鍙扳�斺�擬ES'
-    if (!this.dutyForm.workstationId) {
-      const k = localStorage.getItem(storage_key)
-      if (k) {
-        this.dutyForm.workstationId = parseInt(k)
-      }
-    }
-    this.initOptions()
-    this.getSysParam(sysParam.SHOW_STEP_BUSINESS)
-    this.getTrackingParam(sysParam.SHOW_TRACKING_TYPE)
-    this.timer = setInterval(this.clockTimer, 1000)
-  },
-  watch: {
-    'dutyForm.workstationId'(val) {
-      if (val) {
-        localStorage.setItem(storage_key, val)
-      }
-      // 宸ヤ綔绔欐敼鍙樻椂锛屾暣涓〉闈㈢殑鍔ㄦ�佹暟鎹渶瀹炴椂鍔犺浇銆侀〉闈㈢紦瀛樻暟鎹渶 鍒濆鍖�
-      this.initPageVariable()
-      this.loadInfoByWorkstation()
-    },
-    'dutyForm.startTime'(val, oldval) {
-      if (val) {
-        this.checkTime()
-      } else {
-        this.warningShow = false
-      }
-    },
-    'dutyForm.endTime'(val, oldval) {
-      if (val) {
-        this.checkTime()
-      } else {
-        this.warningShow = false
-      }
-    },
-    'operateTaskForm.orderNumber'(val) {
-      /* this.$nextTick(() => {
-        this.queryInfoForOrderNumber()
-      }) */
-    },
-    'operateTaskForm.spec'(val) {
-      if (val == '' || val == null) {
-        this.SNs = []
-        this.operateTaskForm.SN = ''
-      } else {
-        const that = this
-        that.SNs = []
-        getProductSnByCustomerNoAndPartName({
-          customerOrderNo: this.operateTaskForm.orderNumber,
-          partName: val
-        }).then((res) => {
-          const result = res.data.data
-          result.forEach(function(item) {
-            const obj = {
-              key: item,
-              value: item
-            }
-            that.SNs.push(obj)
-          })
-        })
-      }
-      this.$nextTick(() => {
-        if (this.partNames.length !== 0) {
-          this.refreshOperateTasks()
-        }
-      })
-    },
-    'operateTaskForm.SN'(val) {
-      this.$nextTick(() => {
-        if (this.SNs.length !== 0) {
-          this.refreshOperateTasks()
-        }
-      })
-    },
-    'operateTaskForm.outBatchNo'(val) {
-      /* this.$nextTick(() => {
-        this.refreshOperateTasks()
-      }) */
-    },
-    'operateTaskForm.mpsNo'(val) {
-      /* this.$nextTick(() => {
-        this.refreshOperateTasks()
-      }) */
-    }
-  },
   methods: {
+    changeCurrOperateTask() {},
+    refreshWorkReportPageData() {},
     refreshOperateTasksByConditions() {
       this.$nextTick(() => {
         this.refreshOperateTasks()
@@ -2597,6 +2516,113 @@
     beforeDestroy() {
       clearInterval(this.timer)
     }
+  },
+  computed: {
+    ...mapGetters(['userInfo', 'tagWel', 'permissions']),
+
+    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 (threeDaysAgo <= today && today <= oneDayAgo) {
+        return 'yellow';
+      } else if (today <= threeDaysAgo) {
+        return 'blue';
+      } else {
+        return 'red';
+      }
+    };
   }
+  },
+  created() {
+    document.title = '宸ヤ綔鍙扳�斺�擬ES'
+    if (!this.dutyForm.workstationId) {
+      const k = localStorage.getItem(storage_key)
+      if (k) {
+        this.dutyForm.workstationId = parseInt(k)
+      }
+    }
+    this.initOptions()
+    this.getSysParam(sysParam.SHOW_STEP_BUSINESS)
+    this.getTrackingParam(sysParam.SHOW_TRACKING_TYPE)
+    this.timer = setInterval(this.clockTimer, 1000)
+  },
+  watch: {
+    'dutyForm.workstationId'(val) {
+      if (val) {
+        localStorage.setItem(storage_key, val)
+      }
+      // 宸ヤ綔绔欐敼鍙樻椂锛屾暣涓〉闈㈢殑鍔ㄦ�佹暟鎹渶瀹炴椂鍔犺浇銆侀〉闈㈢紦瀛樻暟鎹渶 鍒濆鍖�
+      this.initPageVariable()
+      this.loadInfoByWorkstation()
+    },
+    'dutyForm.startTime'(val, oldval) {
+      if (val) {
+        this.checkTime()
+      } else {
+        this.warningShow = false
+      }
+    },
+    'dutyForm.endTime'(val, oldval) {
+      if (val) {
+        this.checkTime()
+      } else {
+        this.warningShow = false
+      }
+    },
+    'operateTaskForm.orderNumber'(val) {
+      /* this.$nextTick(() => {
+        this.queryInfoForOrderNumber()
+      }) */
+    },
+    'operateTaskForm.spec'(val) {
+      if (val == '' || val == null) {
+        this.SNs = []
+        this.operateTaskForm.SN = ''
+      } else {
+        const that = this
+        that.SNs = []
+        getProductSnByCustomerNoAndPartName({
+          customerOrderNo: this.operateTaskForm.orderNumber,
+          partName: val
+        }).then((res) => {
+          const result = res.data.data
+          result.forEach(function(item) {
+            const obj = {
+              key: item,
+              value: item
+            }
+            that.SNs.push(obj)
+          })
+        })
+      }
+      this.$nextTick(() => {
+        if (this.partNames.length !== 0) {
+          this.refreshOperateTasks()
+        }
+      })
+    },
+    'operateTaskForm.SN'(val) {
+      this.$nextTick(() => {
+        if (this.SNs.length !== 0) {
+          this.refreshOperateTasks()
+        }
+      })
+    },
+    'operateTaskForm.outBatchNo'(val) {
+      /* this.$nextTick(() => {
+        this.refreshOperateTasks()
+      }) */
+    },
+    'operateTaskForm.mpsNo'(val) {
+      /* this.$nextTick(() => {
+        this.refreshOperateTasks()
+      }) */
+    }
+  },
+
 }
 </script>
diff --git a/src/views/product/workbench/operation-task-pane.vue b/src/views/product/workbench/operation-task-pane.vue
index b62149e..50c7b63 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"
@@ -8,76 +8,76 @@
     >
     </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']"
+  v-for="(item, index) in operationTasks"
+    @click.native="setCheckFlag(item)"
+  shadow="hover"
+  :key="index"
+  :class="['task-item', item.checkFlag ? 'card-checked' : 'card-unchecked']"
+>
+  <!-- <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'
+      ]"
     >
-      <img class="selectedImg" src="/img/workbench/icon_selected.png" />
-      <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
+      <el-select
+        v-if="permissions.product_operationTask_state"
+        v-model="item.statusAction"
+        placeholder="鍔熻兘鑿滃崟"
+        @change="
+          changeTaskState(item.statusAction, item.status, item.id, item)
         "
-        :format="formatPercentage(item.completedQuantity, item.plannedQuantity)"
-      ></el-progress>
-    </el-card>
+      >
+        <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>
@@ -96,10 +96,13 @@
   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(
@@ -344,6 +347,28 @@
     }
   },
   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);
+
+    //   if (date <= threeDaysAgo) {
+    //     document.body.style.backgroundColor = "blue";
+    //   } else if (date <= oneDayAgo) {
+    //     document.body.style.backgroundColor = "yellow";
+    //   } else {
+    //     document.body.style.backgroundColor = "red";
+    //   }
+    // },
+
     // 鐐瑰嚮宸ュ崟锛岄�変腑宸ュ崟
     setCheckFlag(item) {
       if (item.checkFlag) {
diff --git a/src/views/product/workbench/taskinfo-pane.vue b/src/views/product/workbench/taskinfo-pane.vue
index d5b1dd8..5752299 100644
--- a/src/views/product/workbench/taskinfo-pane.vue
+++ b/src/views/product/workbench/taskinfo-pane.vue
@@ -891,6 +891,7 @@
   getGenerateSN,
   getShiftProductOutByOpIdAndWsId
 } from '@/api/product/personboard'
+
 import {
   getTemplate,
   getDocumentJgt,
diff --git a/src/views/product/workbench/workstationoperate-form.vue b/src/views/product/workbench/workstationoperate-form.vue
index 2ded8dd..3c6345d 100644
--- a/src/views/product/workbench/workstationoperate-form.vue
+++ b/src/views/product/workbench/workstationoperate-form.vue
@@ -1,5 +1,6 @@
 <template>
   <div style="width: 100%;height: 100%"></div>
+
 </template>
 <style lang="scss" scoped>
 .ws-header {

--
Gitblit v1.9.3