| | |
| | | </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() }" |
| | | ref="operateTaskDiv" |
| | | :workstationId="dutyForm.workstationId" |
| | | :productSn="operateTaskForm.SN" |
| | | :orderNumber="operateTaskForm.orderNumber" |
| | |
| | | </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" |
| | |
| | | box-sizing: border-box; |
| | | overflow-y: auto; |
| | | margin-bottom: 10px; |
| | | |
| | | } |
| | | |
| | | .task-list-div { |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | changeCurrOperateTask() {}, |
| | | refreshWorkReportPageData() {}, |
| | | // changeCurrOperateTask() {}, |
| | | // refreshWorkReportPageData() {}, |
| | | refreshOperateTasksByConditions() { |
| | | this.$nextTick(() => { |
| | | this.refreshOperateTasks() |
| | |
| | | }, |
| | | 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' |
| | |
| | | > |
| | | </el-alert> |
| | | <el-card |
| | | |
| | | v-for="(item, index) in operationTasks" |
| | | @click.native="setCheckFlag(item)" |
| | | shadow="hover" |
| | |
| | | </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> |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | |
| | | setCheckFlag(item) { |
| | | this.$nextTick(() => { |
| | | this.changeBackgroundColor(item.planFinishDay); |
| | | }); |
| | | }, |
| | | getBackgroundColor(planFinishDay) { |
| | | const currentDate = new Date(); |
| | | currentDate.setHours(0, 0, 0, 0); // 设置时间为当天的开始,忽略时分秒毫秒 |
| | |
| | | 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)); |
| | |
| | | // 如果计划完成日在未来,计算它是否在10天内 |
| | | const daysUntilDue = Math.abs(daysDifference); |
| | | if (daysUntilDue <= 10) { |
| | | // 如果在10天内,返回'yellow'表示即将到期 |
| | | return 'yellow'; |
| | | // 如果在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)'; |
| | | }, |
| | | |
| | | // 点击工单,选中工单 |