瀏覽代碼

年月日BUG

seimin 1 年之前
父節點
當前提交
db151ee002

+ 5 - 6
src/app/views/compre-statistics/compre-statistics.component.ts

@@ -1,6 +1,6 @@
1
 import { Component, OnInit } from "@angular/core";
1
 import { Component, OnInit } from "@angular/core";
2
 import { ActivatedRoute, Router } from "@angular/router";
2
 import { ActivatedRoute, Router } from "@angular/router";
3
-import { differenceInCalendarDays, endOfMonth, endOfYear } from "date-fns";
3
+import { differenceInCalendarDays, endOfMonth, endOfYear, format, startOfMonth, startOfYear } from "date-fns";
4
 
4
 
5
 import { MainService } from "../../services/main.service";
5
 import { MainService } from "../../services/main.service";
6
 import { DateService } from "../../services/date.service";
6
 import { DateService } from "../../services/date.service";
@@ -232,8 +232,7 @@ export class CompreStatisticsComponent implements OnInit {
232
       this.startDate = this.endDate = "";
232
       this.startDate = this.endDate = "";
233
       return;
233
       return;
234
     }
234
     }
235
-    this.startDate =
236
-      result.getFullYear() + "-" + (result.getMonth() + 1) + "-01";
235
+    this.startDate = format(startOfMonth(result), 'yyyy-MM-dd');
237
     // this.endDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
236
     // this.endDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
238
   }
237
   }
239
   changeMonthEnd(result?) {
238
   changeMonthEnd(result?) {
@@ -248,7 +247,7 @@ export class CompreStatisticsComponent implements OnInit {
248
       return;
247
       return;
249
     }
248
     }
250
     // this.startDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
249
     // this.startDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
251
-    this.endDate = result.getFullYear() + "-" + (result.getMonth() + 1) + "-31";
250
+    this.endDate = format(endOfMonth(result), 'yyyy-MM-dd');
252
   }
251
   }
253
   // 年份选择
252
   // 年份选择
254
   changeYearStart(result?) {
253
   changeYearStart(result?) {
@@ -262,7 +261,7 @@ export class CompreStatisticsComponent implements OnInit {
262
       this.startDate = this.endDate = "";
261
       this.startDate = this.endDate = "";
263
       return;
262
       return;
264
     }
263
     }
265
-    this.startDate = result.getFullYear() + "-01-01";
264
+    this.startDate = format(startOfYear(result), 'yyyy-MM-dd');
266
     // this.endDate = result.getFullYear() + '-01-01';
265
     // this.endDate = result.getFullYear() + '-01-01';
267
   }
266
   }
268
   changeYearEnd(result?) {
267
   changeYearEnd(result?) {
@@ -276,7 +275,7 @@ export class CompreStatisticsComponent implements OnInit {
276
       this.startDate = this.endDate = "";
275
       this.startDate = this.endDate = "";
277
       return;
276
       return;
278
     }
277
     }
279
-    this.endDate = result.getFullYear() + "-12-31";
278
+    this.endDate = format(endOfYear(result), 'yyyy-MM-dd');
280
   }
279
   }
281
 
280
 
282
   // 日期选择 快速修改时间区间
281
   // 日期选择 快速修改时间区间

+ 5 - 6
src/app/views/dept-order-source-statistics/dept-order-source-statistics.component.ts

@@ -1,6 +1,6 @@
1
 import { Component, OnInit } from "@angular/core";
1
 import { Component, OnInit } from "@angular/core";
2
 import { ActivatedRoute, Router } from "@angular/router";
2
 import { ActivatedRoute, Router } from "@angular/router";
3
-import { differenceInCalendarDays, endOfMonth, endOfYear } from "date-fns";
3
+import { differenceInCalendarDays, endOfMonth, endOfYear, format, startOfMonth, startOfYear } from "date-fns";
4
 
4
 
5
 import { MainService } from "../../services/main.service";
5
 import { MainService } from "../../services/main.service";
6
 import { DateService } from "../../services/date.service";
6
 import { DateService } from "../../services/date.service";
@@ -328,8 +328,7 @@ export class DeptOrderSourceStatisticsComponent implements OnInit {
328
       this.startDate = this.endDate = "";
328
       this.startDate = this.endDate = "";
329
       return;
329
       return;
330
     }
330
     }
331
-    this.startDate =
332
-      result.getFullYear() + "-" + (result.getMonth() + 1) + "-01";
331
+    this.startDate = format(startOfMonth(result), 'yyyy-MM-dd');
333
     // this.endDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
332
     // this.endDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
334
   }
333
   }
335
   changeMonthEnd(result?) {
334
   changeMonthEnd(result?) {
@@ -344,7 +343,7 @@ export class DeptOrderSourceStatisticsComponent implements OnInit {
344
       return;
343
       return;
345
     }
344
     }
346
     // this.startDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
345
     // this.startDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
347
-    this.endDate = result.getFullYear() + "-" + (result.getMonth() + 1) + "-31";
346
+    this.endDate = format(endOfMonth(result), 'yyyy-MM-dd');
348
   }
347
   }
349
   // 年份选择
348
   // 年份选择
350
   changeYearStart(result?) {
349
   changeYearStart(result?) {
@@ -358,7 +357,7 @@ export class DeptOrderSourceStatisticsComponent implements OnInit {
358
       this.startDate = this.endDate = "";
357
       this.startDate = this.endDate = "";
359
       return;
358
       return;
360
     }
359
     }
361
-    this.startDate = result.getFullYear() + "-01-01";
360
+    this.startDate = format(startOfYear(result), 'yyyy-MM-dd');
362
     // this.endDate = result.getFullYear() + '-01-01';
361
     // this.endDate = result.getFullYear() + '-01-01';
363
   }
362
   }
364
   changeYearEnd(result?) {
363
   changeYearEnd(result?) {
@@ -372,7 +371,7 @@ export class DeptOrderSourceStatisticsComponent implements OnInit {
372
       this.startDate = this.endDate = "";
371
       this.startDate = this.endDate = "";
373
       return;
372
       return;
374
     }
373
     }
375
-    this.endDate = result.getFullYear() + "-12-31";
374
+    this.endDate = format(endOfYear(result), 'yyyy-MM-dd');
376
   }
375
   }
377
 
376
 
378
   // 日期选择 快速修改时间区间
377
   // 日期选择 快速修改时间区间

+ 5 - 6
src/app/views/order-statistics/order-statistics.component.ts

@@ -1,6 +1,6 @@
1
 import { Component, OnInit } from "@angular/core";
1
 import { Component, OnInit } from "@angular/core";
2
 import { ActivatedRoute, Router } from "@angular/router";
2
 import { ActivatedRoute, Router } from "@angular/router";
3
-import { differenceInCalendarDays, endOfMonth, endOfYear } from "date-fns";
3
+import { differenceInCalendarDays, endOfMonth, endOfYear, startOfDay, format, endOfDay, startOfMonth, startOfYear } from "date-fns";
4
 
4
 
5
 import { MainService } from "../../services/main.service";
5
 import { MainService } from "../../services/main.service";
6
 import { DateService } from "../../services/date.service";
6
 import { DateService } from "../../services/date.service";
@@ -316,8 +316,7 @@ export class OrderStatisticsComponent implements OnInit {
316
       this.startDate = this.endDate = "";
316
       this.startDate = this.endDate = "";
317
       return;
317
       return;
318
     }
318
     }
319
-    this.startDate =
320
-      result.getFullYear() + "-" + (result.getMonth() + 1) + "-01";
319
+    this.startDate = format(startOfMonth(result), 'yyyy-MM-dd');
321
     // this.endDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
320
     // this.endDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
322
   }
321
   }
323
   changeMonthEnd(result?) {
322
   changeMonthEnd(result?) {
@@ -332,7 +331,7 @@ export class OrderStatisticsComponent implements OnInit {
332
       return;
331
       return;
333
     }
332
     }
334
     // this.startDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
333
     // this.startDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
335
-    this.endDate = result.getFullYear() + "-" + (result.getMonth() + 1) + "-31";
334
+    this.endDate = format(endOfMonth(result), 'yyyy-MM-dd');
336
   }
335
   }
337
   // 年份选择
336
   // 年份选择
338
   changeYearStart(result?) {
337
   changeYearStart(result?) {
@@ -346,7 +345,7 @@ export class OrderStatisticsComponent implements OnInit {
346
       this.startDate = this.endDate = "";
345
       this.startDate = this.endDate = "";
347
       return;
346
       return;
348
     }
347
     }
349
-    this.startDate = result.getFullYear() + "-01-01";
348
+    this.startDate = format(startOfYear(result), 'yyyy-MM-dd');
350
     // this.endDate = result.getFullYear() + '-01-01';
349
     // this.endDate = result.getFullYear() + '-01-01';
351
   }
350
   }
352
   changeYearEnd(result?) {
351
   changeYearEnd(result?) {
@@ -360,7 +359,7 @@ export class OrderStatisticsComponent implements OnInit {
360
       this.startDate = this.endDate = "";
359
       this.startDate = this.endDate = "";
361
       return;
360
       return;
362
     }
361
     }
363
-    this.endDate = result.getFullYear() + "-12-31";
362
+    this.endDate = format(endOfYear(result), 'yyyy-MM-dd');
364
   }
363
   }
365
 
364
 
366
   // 日期选择 快速修改时间区间
365
   // 日期选择 快速修改时间区间

+ 5 - 6
src/app/views/tasktype-order-source-statistics/tasktype-order-source-statistics.component.ts

@@ -1,6 +1,6 @@
1
 import { Component, OnInit } from "@angular/core";
1
 import { Component, OnInit } from "@angular/core";
2
 import { ActivatedRoute, Router } from "@angular/router";
2
 import { ActivatedRoute, Router } from "@angular/router";
3
-import { differenceInCalendarDays, endOfMonth, endOfYear } from "date-fns";
3
+import { differenceInCalendarDays, endOfMonth, endOfYear, format, startOfMonth, startOfYear } from "date-fns";
4
 
4
 
5
 import { MainService } from "../../services/main.service";
5
 import { MainService } from "../../services/main.service";
6
 import { DateService } from "../../services/date.service";
6
 import { DateService } from "../../services/date.service";
@@ -328,8 +328,7 @@ export class TasktypeOrderSourceStatisticsComponent implements OnInit {
328
       this.startDate = this.endDate = "";
328
       this.startDate = this.endDate = "";
329
       return;
329
       return;
330
     }
330
     }
331
-    this.startDate =
332
-      result.getFullYear() + "-" + (result.getMonth() + 1) + "-01";
331
+    this.startDate = format(startOfMonth(result), 'yyyy-MM-dd');
333
     // this.endDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
332
     // this.endDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
334
   }
333
   }
335
   changeMonthEnd(result?) {
334
   changeMonthEnd(result?) {
@@ -344,7 +343,7 @@ export class TasktypeOrderSourceStatisticsComponent implements OnInit {
344
       return;
343
       return;
345
     }
344
     }
346
     // this.startDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
345
     // this.startDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
347
-    this.endDate = result.getFullYear() + "-" + (result.getMonth() + 1) + "-31";
346
+    this.endDate = format(endOfMonth(result), 'yyyy-MM-dd');
348
   }
347
   }
349
   // 年份选择
348
   // 年份选择
350
   changeYearStart(result?) {
349
   changeYearStart(result?) {
@@ -358,7 +357,7 @@ export class TasktypeOrderSourceStatisticsComponent implements OnInit {
358
       this.startDate = this.endDate = "";
357
       this.startDate = this.endDate = "";
359
       return;
358
       return;
360
     }
359
     }
361
-    this.startDate = result.getFullYear() + "-01-01";
360
+    this.startDate = format(startOfYear(result), 'yyyy-MM-dd');
362
     // this.endDate = result.getFullYear() + '-01-01';
361
     // this.endDate = result.getFullYear() + '-01-01';
363
   }
362
   }
364
   changeYearEnd(result?) {
363
   changeYearEnd(result?) {
@@ -372,7 +371,7 @@ export class TasktypeOrderSourceStatisticsComponent implements OnInit {
372
       this.startDate = this.endDate = "";
371
       this.startDate = this.endDate = "";
373
       return;
372
       return;
374
     }
373
     }
375
-    this.endDate = result.getFullYear() + "-12-31";
374
+    this.endDate = format(endOfYear(result), 'yyyy-MM-dd');
376
   }
375
   }
377
 
376
 
378
   // 日期选择 快速修改时间区间
377
   // 日期选择 快速修改时间区间