Browse Source

fix: missing time parameter

Signed-off-by: Carlos <568187512@qq.com>
Carlos 1 week ago
parent
commit
8a522271e3

+ 9 - 4
src/app/pages/manager/hazard/inspection-plan/detail/detail-info/detail-info.component.ts

@@ -91,7 +91,9 @@ export class DetailInfoComponent {
   }
   setTurn() {
     this.turns = Array.from({ length: this.data.frequencyTimes }, (_, i) => i);
-    this.currentTurn = this.turns[0];
+    if (this.currentTurn === -1 || !this.turns.includes(this.currentTurn)) {
+      this.currentTurn = this.turns[0];
+    }
   }
   setRounds() {
     const rounds = this.data?.plans || [];
@@ -108,9 +110,12 @@ export class DetailInfoComponent {
           time: `${dayjs(item.startDate).format('MM/DD')} - ${dayjs(item.endDate).format('MM/DD')}`,
         };
       });
-    const firstId = this.rounds[0]?.meta.id;
-    const recentId = this.rounds.find(item => item.state === 'current')?.meta.id;
-    this.selectedRoundId = recentId || firstId;
+    if (this.selectedRoundId === -1 || !this.rounds.find(item => item.meta.id === this.selectedRoundId)) {
+      // 如果未选择轮次,则选择当前轮次
+      const firstId = this.rounds[0]?.meta.id;
+      const recentId = this.rounds.find(item => item.state === 'current')?.meta.id;
+      this.selectedRoundId = recentId || firstId;
+    }
     const currentRound = this.rounds.find(item => item.meta.id === this.selectedRoundId);
     if (currentRound) {
       this.onRoundChange(currentRound);

+ 1 - 1
src/app/pages/manager/hazard/inspection-plan/detail/detail-info/round-edit-form/round-edit-form.component.ts

@@ -84,7 +84,7 @@ export class RoundEditFormComponent {
       peopleNumber: 1,
       leaderUserName: '',
       leaderUserId: '',
-      times: 0,
+      times: this.times,
       troubleshootPlan: this.round?.meta.id,
       // status: '',
       isEditing: true,