61
61
</td >
62
62
<td >{{ item.symptom.remarks }}</td >
63
63
<td >
64
- <DeleteIcon class =" icon" @click =" showModal = true" />
65
- <ModalBase :show =" showModal" @close =" showModal = false" >
66
- <h2 >記録を削除する</h2 >
67
- <p >この記録を削除してもよろしいですか?</p >
68
- <div class =" buttonContainer" >
69
- <ActionButton
70
- class =" button"
71
- theme =" primary"
72
- size =" L"
73
- @click =" deleteStatus(item.statusId)"
74
- >
75
- はい
76
- </ActionButton >
77
- <ActionButton
78
- class =" button"
79
- theme =" outline"
80
- size =" L"
81
- @click =" showModal = false"
82
- >
83
- いいえ
84
- </ActionButton >
85
- </div >
86
- <p v-if =" message" >{{ message }}</p >
87
- </ModalBase >
64
+ <DeleteIcon class =" icon" @click =" showDeleteModal(item.statusId)" />
88
65
</td >
89
66
</tr >
90
67
</tbody >
91
68
</table >
69
+ <ModalBase :show =" showModal" @close =" closeDeleteModal" >
70
+ <h2 >記録を削除する</h2 >
71
+ <p >この記録を削除してもよろしいですか?</p >
72
+ <div class =" buttonContainer" >
73
+ <ActionButton
74
+ class =" button"
75
+ theme =" primary"
76
+ size =" L"
77
+ @click =" deleteStatus(targetDeleteStatusId)"
78
+ >
79
+ はい
80
+ </ActionButton >
81
+ <ActionButton
82
+ class =" button"
83
+ theme =" outline"
84
+ size =" L"
85
+ @click =" closeDeleteModal"
86
+ >
87
+ いいえ
88
+ </ActionButton >
89
+ </div >
90
+ <p v-if =" message" >{{ message }}</p >
91
+ </ModalBase >
92
92
</section >
93
93
</template >
94
94
@@ -111,6 +111,7 @@ import { statusesStore } from '@/store'
111
111
export default class SymptomsHistory extends Vue {
112
112
message = ' '
113
113
showModal = false
114
+ targetDeleteStatusId = ' '
114
115
115
116
@Prop ()
116
117
patientId! : string
@@ -137,12 +138,23 @@ export default class SymptomsHistory extends Vue {
137
138
return dayjs (date ).format (' M/D (ddd) HH:mm' )
138
139
}
139
140
141
+ showDeleteModal(id : string ): void {
142
+ this .showModal = true
143
+ this .targetDeleteStatusId = id
144
+ }
145
+
146
+ closeDeleteModal(): void {
147
+ this .showModal = false
148
+ this .targetDeleteStatusId = ' '
149
+ }
150
+
140
151
deleteStatus(id : string ): void {
141
152
statusesStore
142
153
.delete ({ patientId: this .patientId , statusId: id })
143
154
.then ((result ) => {
144
155
if (result === true ) {
145
156
this .showModal = false
157
+ this .targetDeleteStatusId = ' '
146
158
this .$emit (' on-deleted' )
147
159
} else {
148
160
this .message = ` 削除に失敗しました。${result } `
0 commit comments