Browse Source

修改bug

695593266@qq.com 3 months ago
parent
commit
387b325e47
1 changed files with 5 additions and 2 deletions
  1. 5 2
      pages/pda/feeding/components/workOrderBom.vue

+ 5 - 2
pages/pda/feeding/components/workOrderBom.vue

@@ -423,10 +423,13 @@ export default {
         this.isReportTime = res.value == "1" ? true : false;
 
         if (this.isReportTime) {
-          // 第二个时间不能为空,否则组件会显示 NAN-NAN-NAN,先用开始时间占位
+          // 第二个时间不能为空,否则组件会显示 NAN-NAN-NAN,默认用当前时间
           const start = this.item.feedLastTime || "";
           if (start) {
-            this.datetimerange = [start, start];
+            const now = new Date();
+            const pad2 = (n) => String(n).padStart(2, "0");
+            const nowStr = `${now.getFullYear()}-${pad2(now.getMonth() + 1)}-${pad2(now.getDate())} ${pad2(now.getHours())}:${pad2(now.getMinutes())}:${pad2(now.getSeconds())}`;
+            this.datetimerange = [start, nowStr];
             // 赋值后计算两个时间段的时间差并写入工时
             this.applyDateTimeRange(this.datetimerange);
           } else {