seimin лет назад: 3
Родитель
Сommit
81d7a38bf6

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

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

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

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

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

@@ -51,6 +51,10 @@ export class PharmacyComponent implements OnInit {
51 51
     ? JSON.parse(localStorage.getItem("user")).user
52 52
     : null; //登录人信息
53 53
 
54
+  logTimer = null; //定时器
55
+  logTime = 0; //自动刷新秒数
56
+  logTimeConst = 60; //自动刷新秒数
57
+
54 58
   ngOnInit() {
55 59
     this.changeKs();
56 60
     // 待配药列表
@@ -60,6 +64,26 @@ export class PharmacyComponent implements OnInit {
60 64
     // 核对中列表
61 65
     this.getPharmacyList(this.pharmacyIdx, 3, this.pharmacySearchKey);
62 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 89
   // 1为pc待打印状态、2为pc配药中、3为pc核对中