11
86134
2023-11-18 281971fb8056d8c244d48fa0db383e48db541f06
11
已修改3个文件
101 ■■■■■ 文件已修改
src/views/plan/manufacturingorder/index.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/product/workbench/index.vue 44 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/product/workbench/operation-task-pane.vue 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/plan/manufacturingorder/index.vue
@@ -110,7 +110,7 @@
            @click="updateOrderNo"
            type="primary"
            style="margin-left:10px;"
            >更新订单号
            >更新订单号
          </el-button>-->
        </template>
      </ttable>
@@ -1662,4 +1662,4 @@
.gantt-info {
  display: none !important;
}
</style>
</style>
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'
src/views/product/workbench/operation-task-pane.vue
@@ -8,7 +8,6 @@
    >
    </el-alert>
    <el-card
  v-for="(item, index) in operationTasks"
    @click.native="setCheckFlag(item)"
  shadow="hover"
@@ -60,10 +59,25 @@
    </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>
@@ -334,6 +348,12 @@
    }
  },
  methods: {
    setCheckFlag(item) {
      this.$nextTick(() => {
        this.changeBackgroundColor(item.planFinishDay);
      });
    },
    getBackgroundColor(planFinishDay) {
    const currentDate = new Date();
    currentDate.setHours(0, 0, 0, 0); // 设置时间为当天的开始,忽略时分秒毫秒
@@ -341,25 +361,26 @@
    planFinishDayObj.setHours(0, 0, 0, 0); // 同样设置时间为计划完成日的开始
    if (planFinishDayObj < currentDate) {
      // 如果计划完成日在当前日之前,返回'blue'表示过期
      return 'red';
        // 如果计划完成日在当前日之前,返回'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));
        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天内,返回'yellow'表示即将到期
          return 'yellow';
        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)';
        }
      }
    }
    // 如果不是即将到期或已过期,返回'red'表示已到期
    return 'blue';
    // 如果不是即将到期或已过期,返回'rgba(255, 0, 0, 0.3)'表示已到期,这里的 0.3 控制了透明度
    return 'rgba(255, 0, 0, 0.5)';
},
    // 点击工单,选中工单
    setCheckFlag(item) {
      if (item.checkFlag) {