seimin před 1 rokem
rodič
revize
db151ee002

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

@@ -1,6 +1,6 @@
1 1
 import { Component, OnInit } from "@angular/core";
2 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 5
 import { MainService } from "../../services/main.service";
6 6
 import { DateService } from "../../services/date.service";
@@ -232,8 +232,7 @@ export class CompreStatisticsComponent implements OnInit {
232 232
       this.startDate = this.endDate = "";
233 233
       return;
234 234
     }
235
-    this.startDate =
236
-      result.getFullYear() + "-" + (result.getMonth() + 1) + "-01";
235
+    this.startDate = format(startOfMonth(result), 'yyyy-MM-dd');
237 236
     // this.endDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
238 237
   }
239 238
   changeMonthEnd(result?) {
@@ -248,7 +247,7 @@ export class CompreStatisticsComponent implements OnInit {
248 247
       return;
249 248
     }
250 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 253
   changeYearStart(result?) {
@@ -262,7 +261,7 @@ export class CompreStatisticsComponent implements OnInit {
262 261
       this.startDate = this.endDate = "";
263 262
       return;
264 263
     }
265
-    this.startDate = result.getFullYear() + "-01-01";
264
+    this.startDate = format(startOfYear(result), 'yyyy-MM-dd');
266 265
     // this.endDate = result.getFullYear() + '-01-01';
267 266
   }
268 267
   changeYearEnd(result?) {
@@ -276,7 +275,7 @@ export class CompreStatisticsComponent implements OnInit {
276 275
       this.startDate = this.endDate = "";
277 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 1
 import { Component, OnInit } from "@angular/core";
2 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 5
 import { MainService } from "../../services/main.service";
6 6
 import { DateService } from "../../services/date.service";
@@ -328,8 +328,7 @@ export class DeptOrderSourceStatisticsComponent implements OnInit {
328 328
       this.startDate = this.endDate = "";
329 329
       return;
330 330
     }
331
-    this.startDate =
332
-      result.getFullYear() + "-" + (result.getMonth() + 1) + "-01";
331
+    this.startDate = format(startOfMonth(result), 'yyyy-MM-dd');
333 332
     // this.endDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
334 333
   }
335 334
   changeMonthEnd(result?) {
@@ -344,7 +343,7 @@ export class DeptOrderSourceStatisticsComponent implements OnInit {
344 343
       return;
345 344
     }
346 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 349
   changeYearStart(result?) {
@@ -358,7 +357,7 @@ export class DeptOrderSourceStatisticsComponent implements OnInit {
358 357
       this.startDate = this.endDate = "";
359 358
       return;
360 359
     }
361
-    this.startDate = result.getFullYear() + "-01-01";
360
+    this.startDate = format(startOfYear(result), 'yyyy-MM-dd');
362 361
     // this.endDate = result.getFullYear() + '-01-01';
363 362
   }
364 363
   changeYearEnd(result?) {
@@ -372,7 +371,7 @@ export class DeptOrderSourceStatisticsComponent implements OnInit {
372 371
       this.startDate = this.endDate = "";
373 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 1
 import { Component, OnInit } from "@angular/core";
2 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 5
 import { MainService } from "../../services/main.service";
6 6
 import { DateService } from "../../services/date.service";
@@ -316,8 +316,7 @@ export class OrderStatisticsComponent implements OnInit {
316 316
       this.startDate = this.endDate = "";
317 317
       return;
318 318
     }
319
-    this.startDate =
320
-      result.getFullYear() + "-" + (result.getMonth() + 1) + "-01";
319
+    this.startDate = format(startOfMonth(result), 'yyyy-MM-dd');
321 320
     // this.endDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
322 321
   }
323 322
   changeMonthEnd(result?) {
@@ -332,7 +331,7 @@ export class OrderStatisticsComponent implements OnInit {
332 331
       return;
333 332
     }
334 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 337
   changeYearStart(result?) {
@@ -346,7 +345,7 @@ export class OrderStatisticsComponent implements OnInit {
346 345
       this.startDate = this.endDate = "";
347 346
       return;
348 347
     }
349
-    this.startDate = result.getFullYear() + "-01-01";
348
+    this.startDate = format(startOfYear(result), 'yyyy-MM-dd');
350 349
     // this.endDate = result.getFullYear() + '-01-01';
351 350
   }
352 351
   changeYearEnd(result?) {
@@ -360,7 +359,7 @@ export class OrderStatisticsComponent implements OnInit {
360 359
       this.startDate = this.endDate = "";
361 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 1
 import { Component, OnInit } from "@angular/core";
2 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 5
 import { MainService } from "../../services/main.service";
6 6
 import { DateService } from "../../services/date.service";
@@ -328,8 +328,7 @@ export class TasktypeOrderSourceStatisticsComponent implements OnInit {
328 328
       this.startDate = this.endDate = "";
329 329
       return;
330 330
     }
331
-    this.startDate =
332
-      result.getFullYear() + "-" + (result.getMonth() + 1) + "-01";
331
+    this.startDate = format(startOfMonth(result), 'yyyy-MM-dd');
333 332
     // this.endDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
334 333
   }
335 334
   changeMonthEnd(result?) {
@@ -344,7 +343,7 @@ export class TasktypeOrderSourceStatisticsComponent implements OnInit {
344 343
       return;
345 344
     }
346 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 349
   changeYearStart(result?) {
@@ -358,7 +357,7 @@ export class TasktypeOrderSourceStatisticsComponent implements OnInit {
358 357
       this.startDate = this.endDate = "";
359 358
       return;
360 359
     }
361
-    this.startDate = result.getFullYear() + "-01-01";
360
+    this.startDate = format(startOfYear(result), 'yyyy-MM-dd');
362 361
     // this.endDate = result.getFullYear() + '-01-01';
363 362
   }
364 363
   changeYearEnd(result?) {
@@ -372,7 +371,7 @@ export class TasktypeOrderSourceStatisticsComponent implements OnInit {
372 371
       this.startDate = this.endDate = "";
373 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
   // 日期选择 快速修改时间区间