|
@@ -2,6 +2,7 @@ import { Component, OnInit } from "@angular/core";
|
2
|
2
|
import { MainService } from "src/app/services/main.service";
|
3
|
3
|
import { ToolService } from "src/app/services/tool.service";
|
4
|
4
|
import { NzModalService, NzMessageService } from "ng-zorro-antd";
|
|
5
|
+import { startOfDay, endOfDay, format } from 'date-fns';
|
5
|
6
|
|
6
|
7
|
@Component({
|
7
|
8
|
selector: "app-info-search",
|
|
@@ -16,10 +17,13 @@ export class InfoSearchComponent implements OnInit {
|
16
|
17
|
private message: NzMessageService,
|
17
|
18
|
) {}
|
18
|
19
|
|
|
20
|
+ dateRange: any = []; //时间范围
|
|
21
|
+
|
19
|
22
|
searchCriteria = {
|
20
|
23
|
//搜索条件
|
21
|
24
|
id: "", //编码
|
22
|
25
|
target: "order", //类型
|
|
26
|
+ busiType: "", //业务标识
|
23
|
27
|
};
|
24
|
28
|
typeList = [
|
25
|
29
|
{
|
|
@@ -57,12 +61,20 @@ export class InfoSearchComponent implements OnInit {
|
57
|
61
|
panel.active = !panel.active;
|
58
|
62
|
}
|
59
|
63
|
}
|
|
64
|
+ // 日期选择
|
|
65
|
+ onCalendarChangeDate(dateArr){
|
|
66
|
+ if(dateArr.length == 2){
|
|
67
|
+ this.dateRange = [startOfDay(dateArr[0]), endOfDay(dateArr[1])];
|
|
68
|
+ }
|
|
69
|
+ }
|
60
|
70
|
// 重置
|
61
|
71
|
reset() {
|
|
72
|
+ this.dateRange = [];
|
62
|
73
|
this.searchCriteria = {
|
63
|
74
|
//搜索条件
|
64
|
75
|
id: "",
|
65
|
76
|
target: "order",
|
|
77
|
+ busiType: "",
|
66
|
78
|
};
|
67
|
79
|
this.getList();
|
68
|
80
|
}
|
|
@@ -167,21 +179,48 @@ export class InfoSearchComponent implements OnInit {
|
167
|
179
|
list: [],
|
168
|
180
|
},
|
169
|
181
|
];
|
|
182
|
+ // 修改类型
|
|
183
|
+ changeTarget(e){
|
|
184
|
+ this.searchCriteria.id = '';
|
|
185
|
+ this.searchCriteria.busiType = '';
|
|
186
|
+ this.dateRange = [];
|
|
187
|
+ }
|
170
|
188
|
// 获取数据
|
171
|
189
|
getList() {
|
172
|
190
|
this.loading1 = true;
|
173
|
|
- let id = this.searchCriteria.id || "dsadmin";
|
174
|
|
- console.log(id);
|
175
|
|
- this.mainService
|
176
|
|
- .infoSearch(this.searchCriteria.target, id)
|
177
|
|
- .subscribe((result) => {
|
178
|
|
- this.panels = this.panelsClone;
|
179
|
|
- this.loading1 = false;
|
180
|
|
- this.panels.forEach((item) => {
|
181
|
|
- item.list = result[item.extra] || [];
|
|
191
|
+ console.log(this.dateRange)
|
|
192
|
+ if(this.searchCriteria.target == 'dataSource'){
|
|
193
|
+ // 原始数据
|
|
194
|
+ let postData = {
|
|
195
|
+ content: this.searchCriteria.id,
|
|
196
|
+ busiType: this.searchCriteria.busiType,
|
|
197
|
+ startTime: this.dateRange.length ? format(this.dateRange[0], 'yyyy-MM-dd HH:mm:ss') : undefined,
|
|
198
|
+ endTime: this.dateRange.length ? format(this.dateRange[1], 'yyyy-MM-dd HH:mm:ss') : undefined,
|
|
199
|
+ }
|
|
200
|
+ this.mainService
|
|
201
|
+ .queryDataSource(postData)
|
|
202
|
+ .subscribe((result) => {
|
|
203
|
+ this.panels = this.panelsClone;
|
|
204
|
+ this.loading1 = false;
|
|
205
|
+ this.panels.forEach((item) => {
|
|
206
|
+ item.list = result[item.extra] || [];
|
|
207
|
+ });
|
|
208
|
+ this.panels = this.panels.filter((item) => item.list.length > 0);
|
|
209
|
+ });
|
|
210
|
+ }else{
|
|
211
|
+ let id = this.searchCriteria.id || "dsadmin";
|
|
212
|
+ console.log(id);
|
|
213
|
+ this.mainService
|
|
214
|
+ .infoSearch(this.searchCriteria.target, id)
|
|
215
|
+ .subscribe((result) => {
|
|
216
|
+ this.panels = this.panelsClone;
|
|
217
|
+ this.loading1 = false;
|
|
218
|
+ this.panels.forEach((item) => {
|
|
219
|
+ item.list = result[item.extra] || [];
|
|
220
|
+ });
|
|
221
|
+ this.panels = this.panels.filter((item) => item.list.length > 0);
|
182
|
222
|
});
|
183
|
|
- this.panels = this.panels.filter((item) => item.list.length > 0);
|
184
|
|
- });
|
|
223
|
+ }
|
185
|
224
|
}
|
186
|
225
|
// json弹窗
|
187
|
226
|
toJson(json) {
|