Browse Source

选择预约建单时间控件BUG修复

seimin 3 years ago
parent
commit
40147e8fff

+ 4 - 4
src/app/views/hushijiandan/hushijiandan.component.html

@@ -786,8 +786,8 @@
786
               <nz-time-picker nzFormat="HH:mm" [nzMinuteStep]="30" [nzSecondStep]="60" [(ngModel)]="yyTimeZy"
786
               <nz-time-picker nzFormat="HH:mm" [nzMinuteStep]="30" [nzSecondStep]="60" [(ngModel)]="yyTimeZy"
787
                 (ngModelChange)="yyTimeZyChange($event)" [ngModelOptions]="{standalone: true}"
787
                 (ngModelChange)="yyTimeZyChange($event)" [ngModelOptions]="{standalone: true}"
788
                 [nzDisabledHours]="disabledHours" [nzDisabledMinutes]="disabledMinutes"></nz-time-picker>
788
                 [nzDisabledHours]="disabledHours" [nzDisabledMinutes]="disabledMinutes"></nz-time-picker>
789
-              <label nz-checkbox [(ngModel)]="nextDayZy" (ngModelChange)="nextDayZyChange($event)" class="ml8"
790
-                [ngModelOptions]="{standalone: true}">次日</label>
789
+              <label *ngIf="yyTimeZy" nz-checkbox [(ngModel)]="nextDayZy" (ngModelChange)="nextDayZyChange($event)"
790
+                class="ml8" [ngModelOptions]="{standalone: true}">次日</label>
791
             </nz-form-control>
791
             </nz-form-control>
792
             <div class="red w100" *ngIf="!yyTimeZy&&clickYYZyFlag">请填写预约建单时间!</div>
792
             <div class="red w100" *ngIf="!yyTimeZy&&clickYYZyFlag">请填写预约建单时间!</div>
793
             <div class="red">请您在预约建单时至少在预约检查时间的基础上提前30分钟,以免错过检查!</div>
793
             <div class="red">请您在预约建单时至少在预约检查时间的基础上提前30分钟,以免错过检查!</div>
@@ -800,8 +800,8 @@
800
               <nz-time-picker nzFormat="HH:mm" [nzMinuteStep]="30" [nzSecondStep]="60" [(ngModel)]="yyTime"
800
               <nz-time-picker nzFormat="HH:mm" [nzMinuteStep]="30" [nzSecondStep]="60" [(ngModel)]="yyTime"
801
                 (ngModelChange)="yyTimeChange($event)" [ngModelOptions]="{standalone: true}"
801
                 (ngModelChange)="yyTimeChange($event)" [ngModelOptions]="{standalone: true}"
802
                 [nzDisabledHours]="disabledHours" [nzDisabledMinutes]="disabledMinutes"></nz-time-picker>
802
                 [nzDisabledHours]="disabledHours" [nzDisabledMinutes]="disabledMinutes"></nz-time-picker>
803
-              <label nz-checkbox [(ngModel)]="nextDay" (ngModelChange)="nextDayChange($event)" class="ml8"
804
-                [ngModelOptions]="{standalone: true}">次日</label>
803
+              <label *ngIf="yyTime" nz-checkbox [(ngModel)]="nextDay" (ngModelChange)="nextDayChange($event)"
804
+                class="ml8" [ngModelOptions]="{standalone: true}">次日</label>
805
             </nz-form-control>
805
             </nz-form-control>
806
             <div class="red w100" *ngIf="!yyTime&&clickYYFlag">请填写预约建单时间!</div>
806
             <div class="red w100" *ngIf="!yyTime&&clickYYFlag">请填写预约建单时间!</div>
807
             <div class="red">请您在预约建单时至少在预约检查时间的基础上提前30分钟,以免错过检查!</div>
807
             <div class="red">请您在预约建单时至少在预约检查时间的基础上提前30分钟,以免错过检查!</div>

+ 76 - 10
src/app/views/hushijiandan/hushijiandan.component.ts

@@ -547,7 +547,10 @@ export class HushijiandanComponent implements OnInit {
547
             // 标本权限
547
             // 标本权限
548
             that.getSpecimenWorkOrderMsg();
548
             that.getSpecimenWorkOrderMsg();
549
           }
549
           }
550
-          if (that.deptTaskTypeRules.openStaticDistribution||that.deptTaskTypeRules.openDrugsBag) {
550
+          if (
551
+            that.deptTaskTypeRules.openStaticDistribution ||
552
+            that.deptTaskTypeRules.openDrugsBag
553
+          ) {
551
             // 药品静配权限
554
             // 药品静配权限
552
             that.getJpDrugsWKOMsg();
555
             that.getJpDrugsWKOMsg();
553
           }
556
           }
@@ -850,6 +853,8 @@ export class HushijiandanComponent implements OnInit {
850
       if (getMinutes(this.yyTime) != 30) {
853
       if (getMinutes(this.yyTime) != 30) {
851
         this.yyTime = setMinutes(this.yyTime, 0);
854
         this.yyTime = setMinutes(this.yyTime, 0);
852
       }
855
       }
856
+    }else{
857
+      this.nextDay = false;
853
     }
858
     }
854
     this.clickYYFlag = false;
859
     this.clickYYFlag = false;
855
   }
860
   }
@@ -858,6 +863,8 @@ export class HushijiandanComponent implements OnInit {
858
       if (getMinutes(this.yyTimeZy) != 30) {
863
       if (getMinutes(this.yyTimeZy) != 30) {
859
         this.yyTimeZy = setMinutes(this.yyTimeZy, 0);
864
         this.yyTimeZy = setMinutes(this.yyTimeZy, 0);
860
       }
865
       }
866
+    }else{
867
+      this.nextDayZy = false;
861
     }
868
     }
862
     this.clickYYZyFlag = false;
869
     this.clickYYZyFlag = false;
863
   }
870
   }
@@ -869,19 +876,79 @@ export class HushijiandanComponent implements OnInit {
869
   // 次日-陪检
876
   // 次日-陪检
870
   nextDay = false;
877
   nextDay = false;
871
   nextDayChange(e) {
878
   nextDayChange(e) {
872
-    if (e) {
873
-      this.yyTime = addDays(this.yyTime, 1);
874
-    } else {
875
-      this.yyTime = addDays(this.yyTime, -1);
879
+    if (this.yyTime) {
880
+      if (e) {
881
+        this.yyTime = addDays(this.yyTime, 1);
882
+        this.disabledHours = () => [];
883
+        this.disabledMinutes = (hour) => [];
884
+      } else {
885
+        this.yyTime = addDays(this.yyTime, -1);
886
+        this.disabledHours = () => {
887
+          let now = new Date();
888
+          let nHour = now.getHours();
889
+          let nMinute = now.getMinutes();
890
+          if (nMinute > 30) {
891
+            return range(0, nHour + 1);
892
+          } else {
893
+            return range(0, nHour);
894
+          }
895
+        };
896
+        this.disabledMinutes = (hour) => {
897
+          let now = new Date();
898
+          let nHour = now.getHours();
899
+          let nMinute = now.getMinutes();
900
+          if (hour === nHour || hour === undefined) {
901
+            if (nMinute == 0) {
902
+              return [];
903
+            } else if (nMinute <= 30 && nMinute > 0) {
904
+              return [0];
905
+            } else {
906
+              return [0, 30];
907
+            }
908
+          } else {
909
+            return [];
910
+          }
911
+        };
912
+      }
876
     }
913
     }
877
   }
914
   }
878
   // 次日-陪检
915
   // 次日-陪检
879
   nextDayZy = false;
916
   nextDayZy = false;
880
   nextDayZyChange(e) {
917
   nextDayZyChange(e) {
881
-    if (e) {
882
-      this.yyTimeZy = addDays(this.yyTimeZy, 1);
883
-    } else {
884
-      this.yyTimeZy = addDays(this.yyTimeZy, -1);
918
+    if (this.yyTimeZy) {
919
+      if (e) {
920
+        this.yyTimeZy = addDays(this.yyTimeZy, 1);
921
+        this.disabledHours = () => [];
922
+        this.disabledMinutes = (hour) => [];
923
+      } else {
924
+        this.yyTimeZy = addDays(this.yyTimeZy, -1);
925
+        this.disabledHours = () => {
926
+          let now = new Date();
927
+          let nHour = now.getHours();
928
+          let nMinute = now.getMinutes();
929
+          if (nMinute > 30) {
930
+            return range(0, nHour + 1);
931
+          } else {
932
+            return range(0, nHour);
933
+          }
934
+        };
935
+        this.disabledMinutes = (hour) => {
936
+          let now = new Date();
937
+          let nHour = now.getHours();
938
+          let nMinute = now.getMinutes();
939
+          if (hour === nHour || hour === undefined) {
940
+            if (nMinute == 0) {
941
+              return [];
942
+            } else if (nMinute <= 30 && nMinute > 0) {
943
+              return [0];
944
+            } else {
945
+              return [0, 30];
946
+            }
947
+          } else {
948
+            return [];
949
+          }
950
+        };
951
+      }
885
     }
952
     }
886
   }
953
   }
887
   // 预约建单
954
   // 预约建单
@@ -1318,7 +1385,6 @@ export class HushijiandanComponent implements OnInit {
1318
     let now = new Date();
1385
     let now = new Date();
1319
     let nHour = now.getHours();
1386
     let nHour = now.getHours();
1320
     let nMinute = now.getMinutes();
1387
     let nMinute = now.getMinutes();
1321
-    console.log(hour, nHour);
1322
     if (hour === nHour || hour === undefined) {
1388
     if (hour === nHour || hour === undefined) {
1323
       if (nMinute == 0) {
1389
       if (nMinute == 0) {
1324
         return [];
1390
         return [];