Browse Source

药房端列表自动刷新

seimin 3 years ago
parent
commit
81d7a38bf6

+ 3 - 0
src/app/views/pharmacy/pharmacy.component.html

@@ -34,6 +34,7 @@
34
         <strong>待配药</strong>
34
         <strong>待配药</strong>
35
         <!-- <button nz-button class="pharmacy-main__printAll" (click)="print()"
35
         <!-- <button nz-button class="pharmacy-main__printAll" (click)="print()"
36
           [disabled]="printPharmacyList.length===0">批量打印</button> -->
36
           [disabled]="printPharmacyList.length===0">批量打印</button> -->
37
+        <span class="autoUpdate">{{ logTime }}秒后自动刷新</span>
37
       </div>
38
       </div>
38
       <!-- 标题 end -->
39
       <!-- 标题 end -->
39
       <!-- 搜索框 start -->
40
       <!-- 搜索框 start -->
@@ -93,6 +94,7 @@
93
       <!-- 标题 start -->
94
       <!-- 标题 start -->
94
       <div class="pharmacy-main__title">
95
       <div class="pharmacy-main__title">
95
         <strong>配药中</strong>
96
         <strong>配药中</strong>
97
+        <span class="autoUpdate">{{ logTime }}秒后自动刷新</span>
96
       </div>
98
       </div>
97
       <!-- 标题 end -->
99
       <!-- 标题 end -->
98
       <!-- 搜索框 start -->
100
       <!-- 搜索框 start -->
@@ -152,6 +154,7 @@
152
       <!-- 标题 start -->
154
       <!-- 标题 start -->
153
       <div class="pharmacy-main__title">
155
       <div class="pharmacy-main__title">
154
         <strong>核对中</strong>
156
         <strong>核对中</strong>
157
+        <span class="autoUpdate">{{ logTime }}秒后自动刷新</span>
155
       </div>
158
       </div>
156
       <!-- 标题 end -->
159
       <!-- 标题 end -->
157
       <!-- 搜索框 start -->
160
       <!-- 搜索框 start -->

+ 5 - 0
src/app/views/pharmacy/pharmacy.component.less

@@ -171,6 +171,11 @@
171
 				justify-content: space-between;
171
 				justify-content: space-between;
172
 				align-items: center;
172
 				align-items: center;
173
 				border-bottom: 1px solid #e5e9ed;
173
 				border-bottom: 1px solid #e5e9ed;
174
+        .autoUpdate{
175
+          font-size: 14px;
176
+          color: #49b856;
177
+          margin-right: 8px;
178
+        }
174
 				.pharmacy-main__printAll {
179
 				.pharmacy-main__printAll {
175
 					// width: 80px;
180
 					// width: 80px;
176
 					height: 28px;
181
 					height: 28px;

+ 24 - 0
src/app/views/pharmacy/pharmacy.component.ts

@@ -51,6 +51,10 @@ export class PharmacyComponent implements OnInit {
51
     ? JSON.parse(localStorage.getItem("user")).user
51
     ? JSON.parse(localStorage.getItem("user")).user
52
     : null; //登录人信息
52
     : null; //登录人信息
53
 
53
 
54
+  logTimer = null; //定时器
55
+  logTime = 0; //自动刷新秒数
56
+  logTimeConst = 60; //自动刷新秒数
57
+
54
   ngOnInit() {
58
   ngOnInit() {
55
     this.changeKs();
59
     this.changeKs();
56
     // 待配药列表
60
     // 待配药列表
@@ -60,6 +64,26 @@ export class PharmacyComponent implements OnInit {
60
     // 核对中列表
64
     // 核对中列表
61
     this.getPharmacyList(this.pharmacyIdx, 3, this.pharmacySearchKey);
65
     this.getPharmacyList(this.pharmacyIdx, 3, this.pharmacySearchKey);
62
     this.initRole();
66
     this.initRole();
67
+    // 自动刷新倒计时 start
68
+    this.autoUpdate();
69
+    // 自动刷新倒计时 end
70
+  }
71
+  // 自动刷新倒计时
72
+  autoUpdate(){
73
+    this.logTime = this.logTimeConst;
74
+    clearInterval(this.logTimer);
75
+    this.logTimer = setInterval(() => {
76
+      this.logTime--;
77
+      if (this.logTime === 0) {
78
+        this.logTime = this.logTimeConst;
79
+        // 待配药列表
80
+        this.getPharmacyList(0, 1, this.printPharmacySearchKey);
81
+        // 配药中列表
82
+        this.getPharmacyList(0, 2, this.waitPharmacySearchKey);
83
+        // 核对中列表
84
+        this.getPharmacyList(0, 3, this.pharmacySearchKey);
85
+      }
86
+    }, 1000);
63
   }
87
   }
64
   // 药房端药房列表查询、搜索
88
   // 药房端药房列表查询、搜索
65
   // 1为pc待打印状态、2为pc配药中、3为pc核对中
89
   // 1为pc待打印状态、2为pc配药中、3为pc核对中