Sfoglia il codice sorgente

业务信息标本排序

seimin 1 anno fa
parent
commit
f9a97d7ff9

+ 4 - 4
src/app/views/specimen-search/specimen-search.component.html

@@ -123,13 +123,13 @@
123 123
           <span class="label">收取时间:</span>
124 124
           <nz-range-picker [(ngModel)]="searchCriteria.dateRange" (ngModelChange)="changeDate($event)"></nz-range-picker>
125 125
         </div>
126
-        
126
+
127 127
       </div>
128 128
       <div nz-col nzXl="6" class="list-template__btns">
129 129
         <button
130 130
           nz-button
131 131
           class="btn default"
132
-          (click)="showDelModal('您确认要清空标本吗?')"  
132
+          (click)="showDelModal('您确认要清空标本吗?')"
133 133
           *ngIf="currentUserAccount == 'dsadmin'"
134 134
         >
135 135
           清空标本
@@ -155,7 +155,7 @@
155 155
         [nzShowPagination]="false"
156 156
         [nzLoading]="loading1"
157 157
       >
158
-        <thead>
158
+        <thead (nzSortChange)="sort($event)" nzSingleSort>
159 159
           <tr class="thead">
160 160
             <th nzWidth="4%">序号</th>
161 161
             <th nzWidth="8%">申请科室</th>
@@ -164,7 +164,7 @@
164 164
             <th nzWidth="8%">检验项目</th>
165 165
             <th nzWidth="8%">标本类型</th>
166 166
             <th nzWidth="5%">状态</th>
167
-            <th nzWidth="8%">收取时间</th>
167
+            <th nzWidth="8%" nzShowSort nzSortKey="arriveTime" [(nzSort)]="sortCurrent.arriveTime">收取时间</th>
168 168
             <th nzWidth="8%">收取人</th>
169 169
             <th nzWidth="8%">中转时间</th>
170 170
             <th nzWidth="8%">送达时间</th>

+ 3 - 0
src/app/views/specimen-search/specimen-search.component.less

@@ -1,4 +1,7 @@
1 1
 @import "../../../../src/theme.less";
2
+:host ::ng-deep .on {
3
+  color: #fff !important;
4
+}
2 5
 .list-template__checkBoxes{
3 6
   display: flex;
4 7
   justify-content: space-between;

+ 26 - 5
src/app/views/specimen-search/specimen-search.component.ts

@@ -49,7 +49,7 @@ export class SpecimenSearchComponent implements OnInit {
49 49
   // 表格筛选
50 50
   log(value: object[]): void {
51 51
     console.log(value);
52
-    this.getList(1);
52
+    this.getList(1, this.sortCurrentKey, this.sortCurrentValue);
53 53
   }
54 54
   // 搜索类型
55 55
   isLoading1 = false;
@@ -100,7 +100,7 @@ export class SpecimenSearchComponent implements OnInit {
100 100
     setTimeout(() => {
101 101
       this.promptModalShow = true;
102 102
     }, 100);
103
-    this.getList(0);
103
+    this.getList(0, this.sortCurrentKey, this.sortCurrentValue);
104 104
   }
105 105
   // 查看标本历史记录
106 106
   historyPromptModalShow = false; //标本历史记录弹窗开关
@@ -151,7 +151,12 @@ export class SpecimenSearchComponent implements OnInit {
151 151
       dateRange: [],
152 152
       checkDept: null,
153 153
     };
154
-    this.getList(1);
154
+    this.sortCurrentKey = "";
155
+    this.sortCurrentValue = "";
156
+    this.sortCurrent = {
157
+      arriveTime: null,
158
+    };
159
+    this.getList(1, this.sortCurrentKey, this.sortCurrentValue);
155 160
   }
156 161
   // 选择院区
157 162
   changeHospital(id, type) {
@@ -265,13 +270,13 @@ export class SpecimenSearchComponent implements OnInit {
265 270
   getAllHospital() {
266 271
     this.allHospital = [this.tool.getCurrentHospital()];
267 272
     this.searchCriteria.hospital = this.tool.getCurrentHospital().id + "";
268
-    this.getList(1);
273
+    this.getList(1, this.sortCurrentKey, this.sortCurrentValue);
269 274
     this.changeHospital(this.searchCriteria.hospital, "search");
270 275
   }
271 276
 
272 277
   // 表格数据
273 278
   loading1 = false;
274
-  getList(type) {
279
+  getList(type, field?: string, sort?: string) {
275 280
     console.log(this.searchCriteria.dateRange);
276 281
     if (type == 1) {
277 282
       this.pageIndex = 1;
@@ -306,6 +311,9 @@ export class SpecimenSearchComponent implements OnInit {
306 311
           : undefined,
307 312
       },
308 313
     };
314
+    if (field && sort) {
315
+      postData.specimen.orderBy = sort === "ascend" ? field : `${field} desc`;
316
+    }
309 317
     if (this.searchCriteria.dateRange.length) {
310 318
       postData.specimen.startArriveTime =
311 319
         format(this.searchCriteria.dateRange[0], "yyyy-MM-dd ") + "00:00:00";
@@ -323,4 +331,17 @@ export class SpecimenSearchComponent implements OnInit {
323 331
         }
324 332
       });
325 333
   }
334
+
335
+  // 列表排序
336
+  sortCurrent = {
337
+    arriveTime: null,
338
+  };
339
+  sortCurrentKey: string = "";
340
+  sortCurrentValue: string | null = "";
341
+  sort(e) {
342
+    const { key, value } = e;
343
+    this.sortCurrentKey = key;
344
+    this.sortCurrentValue = value;
345
+    this.getList(this.pageIndex, this.sortCurrentKey, this.sortCurrentValue);
346
+  }
326 347
 }