王震
2023-11-18 14c524858cd0e3c69090bcd1f2436137252a92b9
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 = '工作台——MES'