|
@@ -3,7 +3,7 @@ import { MainService } from "../../services/main.service";
|
3
|
3
|
import { ToolService } from "../../services/tool.service";
|
4
|
4
|
import { Subject } from "rxjs";
|
5
|
5
|
import { debounceTime } from "rxjs/operators";
|
6
|
|
-import { format } from "date-fns";
|
|
6
|
+import { format, subDays, endOfDay } from "date-fns";
|
7
|
7
|
@Component({
|
8
|
8
|
selector: "app-specimen-search",
|
9
|
9
|
templateUrl: "./specimen-search.component.html",
|
|
@@ -38,6 +38,12 @@ export class SpecimenSearchComponent implements OnInit {
|
38
|
38
|
changeInpSubject = new Subject();
|
39
|
39
|
changeInp2Subject = new Subject();
|
40
|
40
|
ngOnInit() {
|
|
41
|
+ this.searchCriteria.dateRange = [
|
|
42
|
+ format(subDays(new Date(), 7), "yyyy-MM-dd") + ' ' +'00:00:00',
|
|
43
|
+ format(endOfDay(new Date()), "yyyy-MM-dd HH:mm:ss")
|
|
44
|
+ ]
|
|
45
|
+ this.startDate = format(subDays(new Date(), 7), "yyyy-MM-dd") + ' ' +'00:00:00';
|
|
46
|
+ this.endDate = format(endOfDay(new Date()), "yyyy-MM-dd HH:mm:ss");
|
41
|
47
|
this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
|
42
|
48
|
this.searchDepartment(v[0], v[1]);
|
43
|
49
|
});
|
|
@@ -116,28 +122,24 @@ export class SpecimenSearchComponent implements OnInit {
|
116
|
122
|
// 日期选择
|
117
|
123
|
startDate: string; //发起时间开始
|
118
|
124
|
endDate: string; //发起时间结束
|
119
|
|
- changeDate(result?): void {
|
120
|
|
- if (!result) {
|
121
|
|
- this.startDate = this.endDate = "";
|
122
|
|
- return;
|
123
|
|
- }
|
124
|
|
- this.startDate =
|
125
|
|
- result[0].getFullYear() +
|
126
|
|
- "-" +
|
127
|
|
- (result[0].getMonth() + 1) +
|
128
|
|
- "-" +
|
129
|
|
- result[0].getDate() +
|
130
|
|
- " " +
|
131
|
|
- "00:00:00";
|
132
|
|
- this.endDate =
|
133
|
|
- result[1].getFullYear() +
|
134
|
|
- "-" +
|
135
|
|
- (result[1].getMonth() + 1) +
|
136
|
|
- "-" +
|
137
|
|
- result[1].getDate() +
|
138
|
|
- " " +
|
139
|
|
- "23:59:59";
|
140
|
|
- }
|
|
125
|
+ changeDate(result?): void {
|
|
126
|
+ if (!result) {
|
|
127
|
+ this.startDate = this.endDate = "";
|
|
128
|
+ return;
|
|
129
|
+ }
|
|
130
|
+ this.startDate = format(result[0], 'yyyy-MM-dd HH:mm:ss');
|
|
131
|
+ this.endDate = format(result[1], 'yyyy-MM-dd HH:mm:ss');
|
|
132
|
+ }
|
|
133
|
+ onCalendarChangeDate(dateArr){
|
|
134
|
+ console.log(dateArr)
|
|
135
|
+ if(dateArr.length == 2){
|
|
136
|
+ let dateStart = new Date(dateArr[0]);
|
|
137
|
+ let dateEnd = new Date(dateArr[1]);
|
|
138
|
+ dateStart.setHours(0,0,0);
|
|
139
|
+ dateEnd.setHours(23,59,59);
|
|
140
|
+ this.searchCriteria.dateRange = [dateStart,dateEnd];
|
|
141
|
+ }
|
|
142
|
+ }
|
141
|
143
|
// 重置
|
142
|
144
|
reset() {
|
143
|
145
|
this.searchCriteria = {
|
|
@@ -151,6 +153,8 @@ export class SpecimenSearchComponent implements OnInit {
|
151
|
153
|
dateRange: [],
|
152
|
154
|
checkDept: null,
|
153
|
155
|
};
|
|
156
|
+ this.startDate = null;
|
|
157
|
+ this.endDate = null;
|
154
|
158
|
this.sortCurrentKey = "";
|
155
|
159
|
this.sortCurrentValue = "";
|
156
|
160
|
this.sortCurrent = {
|
|
@@ -314,11 +318,9 @@ export class SpecimenSearchComponent implements OnInit {
|
314
|
318
|
if (field && sort) {
|
315
|
319
|
postData.specimen.orderBy = sort === "ascend" ? field : `${field} desc`;
|
316
|
320
|
}
|
317
|
|
- if (this.searchCriteria.dateRange.length) {
|
318
|
|
- postData.specimen.startArriveTime =
|
319
|
|
- format(this.searchCriteria.dateRange[0], "yyyy-MM-dd ") + "00:00:00";
|
320
|
|
- postData.specimen.endArriveTime =
|
321
|
|
- format(this.searchCriteria.dateRange[1], "yyyy-MM-dd ") + "23:59:59";
|
|
321
|
+ if (this.startDate && this.endDate) {
|
|
322
|
+ postData.specimen.startArriveTime = this.startDate;
|
|
323
|
+ postData.specimen.endArriveTime = this.endDate;
|
322
|
324
|
}
|
323
|
325
|
this.loading1 = true;
|
324
|
326
|
this.mainService
|