|
@@ -0,0 +1,134 @@
|
|
1
|
+import { Component, OnInit } from "@angular/core";
|
|
2
|
+import { Subject } from "rxjs";
|
|
3
|
+import { debounceTime } from "rxjs/operators";
|
|
4
|
+import { MainService } from "src/app/services/main.service";
|
|
5
|
+import { ToolService } from "src/app/services/tool.service";
|
|
6
|
+
|
|
7
|
+@Component({
|
|
8
|
+ selector: "app-quilt-washing-search",
|
|
9
|
+ templateUrl: "./quilt-washing-search.component.html",
|
|
10
|
+ styleUrls: ["./quilt-washing-search.component.less"],
|
|
11
|
+})
|
|
12
|
+
|
|
13
|
+export class QuiltWashingSearchComponent implements OnInit {
|
|
14
|
+ constructor(private mainService: MainService, private tool: ToolService) {}
|
|
15
|
+
|
|
16
|
+ searchCriteria = {
|
|
17
|
+ //搜索条件
|
|
18
|
+ batchCode: "", //请领单号
|
|
19
|
+ relatedDept: null, //发药科室
|
|
20
|
+ };
|
|
21
|
+ deptList = []; // 院区下的配送人员列表(搜索框)
|
|
22
|
+ hosId;
|
|
23
|
+ listOfData: any[] = []; //表格数据
|
|
24
|
+ pageIndex: number = 1; //表格当前页码
|
|
25
|
+ pageSize: number = 10; //表格每页展示条数
|
|
26
|
+ listLength: number = 10; //表格总数据量
|
|
27
|
+ changeInpSubject = new Subject();
|
|
28
|
+ ngOnInit() {
|
|
29
|
+ this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
|
|
30
|
+ this.searchDept(v);
|
|
31
|
+ });
|
|
32
|
+ this.getHospital();
|
|
33
|
+ }
|
|
34
|
+
|
|
35
|
+ // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
|
|
36
|
+ promptContent: string; //操作提示框提示信息
|
|
37
|
+ ifSuccess: boolean; //操作成功/失败
|
|
38
|
+ promptInfo: string; //操作结果提示信息
|
|
39
|
+ promptModalShow: boolean; //操作提示框是否展示
|
|
40
|
+ showPromptModal(con, success, promptInfo?) {
|
|
41
|
+ this.promptModalShow = false;
|
|
42
|
+ this.promptContent = con;
|
|
43
|
+ this.ifSuccess = success;
|
|
44
|
+ this.promptInfo = promptInfo;
|
|
45
|
+ setTimeout(() => {
|
|
46
|
+ this.promptModalShow = true;
|
|
47
|
+ }, 100);
|
|
48
|
+ this.getList(0);
|
|
49
|
+ }
|
|
50
|
+ // 重置
|
|
51
|
+ reset() {
|
|
52
|
+ this.searchCriteria = {
|
|
53
|
+ //搜索条件
|
|
54
|
+ batchCode: "",
|
|
55
|
+ relatedDept: null,
|
|
56
|
+ };
|
|
57
|
+ this.getList(1);
|
|
58
|
+ }
|
|
59
|
+
|
|
60
|
+ // 获取所有院区
|
|
61
|
+ getHospital() {
|
|
62
|
+ this.hosId = this.tool.getCurrentHospital().id;
|
|
63
|
+ this.getList(1);
|
|
64
|
+ }
|
|
65
|
+
|
|
66
|
+ // 打开搜索框
|
|
67
|
+ changeSearch(flag) {
|
|
68
|
+ if (flag) {
|
|
69
|
+ this.changeInp("no");
|
|
70
|
+ }
|
|
71
|
+ }
|
|
72
|
+ // 边输边搜节流阀
|
|
73
|
+ isLoading = false;
|
|
74
|
+ changeInp(dept) {
|
|
75
|
+ if (!dept) {
|
|
76
|
+ return;
|
|
77
|
+ }
|
|
78
|
+ if (dept === "no") {
|
|
79
|
+ dept = "";
|
|
80
|
+ }
|
|
81
|
+ this.isLoading = true;
|
|
82
|
+ this.changeInpSubject.next(dept);
|
|
83
|
+ }
|
|
84
|
+ // 搜索科室
|
|
85
|
+ searchDept(dept) {
|
|
86
|
+ let postData = {
|
|
87
|
+ department: {
|
|
88
|
+ searchType: 1,// 简单查询
|
|
89
|
+ cascadeHosId: this.hosId,
|
|
90
|
+ dept,
|
|
91
|
+ },
|
|
92
|
+ idx: 0,
|
|
93
|
+ sum: 10,
|
|
94
|
+ };
|
|
95
|
+ this.mainService
|
|
96
|
+ .getFetchDataList("data", "department", postData)
|
|
97
|
+ .subscribe((result) => {
|
|
98
|
+ if (result.status == 200) {
|
|
99
|
+ this.isLoading = false;
|
|
100
|
+ this.deptList = result.list;
|
|
101
|
+ }
|
|
102
|
+ });
|
|
103
|
+ }
|
|
104
|
+
|
|
105
|
+ // 表格数据
|
|
106
|
+ loading1 = false;
|
|
107
|
+ getList(type) {
|
|
108
|
+ if (type == 1) {
|
|
109
|
+ this.pageIndex = 1;
|
|
110
|
+ }
|
|
111
|
+ let postData: any = {
|
|
112
|
+ idx: this.pageIndex - 1,
|
|
113
|
+ sum: this.pageSize,
|
|
114
|
+ clothesWashing: {
|
|
115
|
+ hosId: this.hosId,
|
|
116
|
+ batchCode: this.searchCriteria.batchCode || undefined,
|
|
117
|
+ },
|
|
118
|
+ };
|
|
119
|
+ if (this.searchCriteria.relatedDept) {
|
|
120
|
+ postData.clothesWashing.relatedDept = { id: this.searchCriteria.relatedDept };
|
|
121
|
+ }
|
|
122
|
+ this.loading1 = true;
|
|
123
|
+ this.mainService
|
|
124
|
+ .getFetchDataList("simple/data", "clothesWashing", postData)
|
|
125
|
+ .subscribe((data) => {
|
|
126
|
+ this.loading1 = false;
|
|
127
|
+ if (data["status"] == 200) {
|
|
128
|
+ this.listOfData = data["list"];
|
|
129
|
+ this.listLength = data["totalNum"];
|
|
130
|
+ }
|
|
131
|
+ });
|
|
132
|
+ }
|
|
133
|
+}
|
|
134
|
+
|