|
@@ -0,0 +1,181 @@
|
|
1
|
+import { Component, OnInit, ViewChild } 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
|
+import { format } from 'date-fns';
|
|
7
|
+import { ActivatedRoute } from '@angular/router';
|
|
8
|
+import { FormGroup, Validators, FormBuilder } from '@angular/forms';
|
|
9
|
+import { OverlayScrollbarsComponent } from 'overlayscrollbars-ngx';
|
|
10
|
+
|
|
11
|
+@Component({
|
|
12
|
+ selector: "app-medical-waste-storage-record",
|
|
13
|
+ templateUrl: "./medical-waste-storage-record.component.html",
|
|
14
|
+ styleUrls: ["./medical-waste-storage-record.component.less"],
|
|
15
|
+})
|
|
16
|
+export class MedicalWasteStorageRecordComponent implements OnInit {
|
|
17
|
+ @ViewChild("osComponentRef1", {
|
|
18
|
+ read: OverlayScrollbarsComponent,
|
|
19
|
+ static: false,
|
|
20
|
+ })
|
|
21
|
+ osComponentRef1: OverlayScrollbarsComponent;
|
|
22
|
+ constructor(
|
|
23
|
+ private mainService: MainService,
|
|
24
|
+ private tool: ToolService,
|
|
25
|
+ private route: ActivatedRoute,
|
|
26
|
+ private fb: FormBuilder,
|
|
27
|
+ ) {}
|
|
28
|
+
|
|
29
|
+ searchCriteria = {
|
|
30
|
+ //搜索条件
|
|
31
|
+ name: "",
|
|
32
|
+ dateRange: [],
|
|
33
|
+ };
|
|
34
|
+ hosId;
|
|
35
|
+ listOfData: any[] = []; //表格数据
|
|
36
|
+ pageIndex: number = 1; //表格当前页码
|
|
37
|
+ pageSize: number = 10; //表格每页展示条数
|
|
38
|
+ listLength: number = 10; //表格总数据量
|
|
39
|
+
|
|
40
|
+ // 初始化增删改按钮
|
|
41
|
+ coopBtns: any = {};
|
|
42
|
+ ngOnInit() {
|
|
43
|
+ this.coopBtns = this.tool.initCoopBtns(this.route);
|
|
44
|
+ this.getHospital();
|
|
45
|
+ }
|
|
46
|
+
|
|
47
|
+ // 删除
|
|
48
|
+ delModal: boolean = false; //删除模态框
|
|
49
|
+ del() {
|
|
50
|
+ this.content = `原重量为<strong class="red">${this.coopData.weight}kg</strong>,矫正后重量为<strong class="red">${this.validateForm.value.weight}kg</strong>,您确认修改吗?`;
|
|
51
|
+ this.delModal = true;
|
|
52
|
+ }
|
|
53
|
+ // 确认删除
|
|
54
|
+ confirmDel() {
|
|
55
|
+ this.btnLoading = true;
|
|
56
|
+
|
|
57
|
+ let coopData = {...this.coopData, ...{weight: this.validateForm.value.weight}};
|
|
58
|
+ this.mainService.simplePost("addData", "clinicalWaste", coopData)
|
|
59
|
+ .subscribe((data) => {
|
|
60
|
+ this.btnLoading = false;
|
|
61
|
+ this.hideModal();
|
|
62
|
+ this.hideDelModal();
|
|
63
|
+ if (data.status == 200) {
|
|
64
|
+ this.showPromptModal("修改", true, "");
|
|
65
|
+ } else {
|
|
66
|
+ this.showPromptModal("修改", false, data.msg);
|
|
67
|
+ }
|
|
68
|
+ });
|
|
69
|
+ }
|
|
70
|
+
|
|
71
|
+ // 关闭删除模态框
|
|
72
|
+ hideDelModal() {
|
|
73
|
+ this.delModal = false;
|
|
74
|
+ }
|
|
75
|
+ // 修改重量弹框
|
|
76
|
+ modal: boolean = false;
|
|
77
|
+ coopData:any = {};
|
|
78
|
+ content:string = '';
|
|
79
|
+ showModal(data) {
|
|
80
|
+ this.coopData = data;
|
|
81
|
+ this.modal = true;
|
|
82
|
+ this.initForm();
|
|
83
|
+ }
|
|
84
|
+ hideModal() {
|
|
85
|
+ this.modal = false;
|
|
86
|
+ this.initForm();
|
|
87
|
+ }
|
|
88
|
+ // 初始化form表单
|
|
89
|
+ validateForm: FormGroup; //编辑表单
|
|
90
|
+ initForm() {
|
|
91
|
+ this.validateForm = this.fb.group({
|
|
92
|
+ weight: [0, [Validators.required]],
|
|
93
|
+ });
|
|
94
|
+ }
|
|
95
|
+ // 表单提交
|
|
96
|
+ btnLoading:boolean = false;
|
|
97
|
+ submitForm(): void {
|
|
98
|
+ for (const i in this.validateForm.controls) {
|
|
99
|
+ this.validateForm.controls[i].markAsDirty({ onlySelf: true });
|
|
100
|
+ this.validateForm.controls[i].updateValueAndValidity();
|
|
101
|
+ }
|
|
102
|
+ if (this.validateForm.invalid) return;
|
|
103
|
+ this.del();
|
|
104
|
+ }
|
|
105
|
+ // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
|
|
106
|
+ promptContent: string; //操作提示框提示信息
|
|
107
|
+ ifSuccess: boolean; //操作成功/失败
|
|
108
|
+ promptInfo: string; //操作结果提示信息
|
|
109
|
+ promptModalShow: boolean; //操作提示框是否展示
|
|
110
|
+ showPromptModal(con, success, promptInfo?) {
|
|
111
|
+ this.promptModalShow = false;
|
|
112
|
+ this.promptContent = con;
|
|
113
|
+ this.ifSuccess = success;
|
|
114
|
+ this.promptInfo = promptInfo;
|
|
115
|
+ setTimeout(() => {
|
|
116
|
+ this.promptModalShow = true;
|
|
117
|
+ }, 100);
|
|
118
|
+ this.getList(1);
|
|
119
|
+ }
|
|
120
|
+ // 重置
|
|
121
|
+ reset() {
|
|
122
|
+ this.searchCriteria = {
|
|
123
|
+ //搜索条件
|
|
124
|
+ name: "",
|
|
125
|
+ dateRange: [],
|
|
126
|
+ };
|
|
127
|
+ this.getList(1);
|
|
128
|
+ }
|
|
129
|
+
|
|
130
|
+ // 获取所有院区
|
|
131
|
+ getHospital() {
|
|
132
|
+ this.hosId = this.tool.getCurrentHospital().id;
|
|
133
|
+ this.getList(1);
|
|
134
|
+ }
|
|
135
|
+ // 查看弹窗
|
|
136
|
+ historyPromptModalShow = false; //标本历史记录弹窗开关
|
|
137
|
+ id = ""; //查看
|
|
138
|
+ viewHistory(data) {
|
|
139
|
+ this.id = data.id;
|
|
140
|
+ this.historyPromptModalShow = true;
|
|
141
|
+ }
|
|
142
|
+ // 关闭弹窗
|
|
143
|
+ closeModelHistory(e) {
|
|
144
|
+ this.historyPromptModalShow = JSON.parse(e).show;
|
|
145
|
+ }
|
|
146
|
+
|
|
147
|
+ // 表格数据
|
|
148
|
+ loading1 = false;
|
|
149
|
+ getList(type) {
|
|
150
|
+ if (type == 1) {
|
|
151
|
+ this.pageIndex = 1;
|
|
152
|
+ }
|
|
153
|
+ let postData: any = {
|
|
154
|
+ idx: this.pageIndex - 1,
|
|
155
|
+ sum: this.pageSize,
|
|
156
|
+ clinicalWasteInto: {
|
|
157
|
+ hosId: this.hosId,
|
|
158
|
+ },
|
|
159
|
+ };
|
|
160
|
+ if (this.searchCriteria.dateRange.length) {
|
|
161
|
+ postData.clinicalWasteInto.startTime =
|
|
162
|
+ format(this.searchCriteria.dateRange[0], "yyyy-MM-dd HH:mm:ss");
|
|
163
|
+ postData.clinicalWasteInto.endTime =
|
|
164
|
+ format(this.searchCriteria.dateRange[1], "yyyy-MM-dd HH:mm:ss");
|
|
165
|
+ }
|
|
166
|
+ if (this.searchCriteria.name) {
|
|
167
|
+ postData.clinicalWasteInto.name = this.searchCriteria.name;
|
|
168
|
+ }
|
|
169
|
+ this.loading1 = true;
|
|
170
|
+ this.mainService
|
|
171
|
+ .getFetchDataList("simple/data", "clinicalWasteInto", postData)
|
|
172
|
+ .subscribe((data) => {
|
|
173
|
+ this.loading1 = false;
|
|
174
|
+ if (data["status"] == 200) {
|
|
175
|
+ this.listOfData = data["list"];
|
|
176
|
+ this.listLength = data["totalNum"];
|
|
177
|
+ }
|
|
178
|
+ });
|
|
179
|
+ }
|
|
180
|
+}
|
|
181
|
+
|