Skip to content

Commit c6d4721

Browse files
committed
患者症状の登録機能と削除機能を追加
1 parent e45c29f commit c6d4721

File tree

3 files changed

+355
-15
lines changed

3 files changed

+355
-15
lines changed

components/SymptomsHistory.vue

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<th>脈拍</th>
1010
<th class="alignLeft" style="padding-left: 20px">症状</th>
1111
<th class="alignLeft">症状</th>
12+
<th></th>
1213
</tr>
1314
</thead>
1415
<tbody>
@@ -59,6 +60,32 @@
5960
</div>
6061
</td>
6162
<td>{{ item.symptom.remarks }}</td>
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>
88+
</td>
6289
</tr>
6390
</tbody>
6491
</table>
@@ -70,13 +97,24 @@ import { Component, Prop, Vue } from 'vue-property-decorator'
7097
import dayjs from 'dayjs'
7198
import { Status } from '@/types/component-interfaces/status'
7299
import SymptomsStatusText from '@/components/SymptomsStatusText.vue'
100+
import ModalBase from '@/components/ModalBase.vue'
101+
import DeleteIcon from '@/static/icon-delete.svg'
102+
import { statusesStore } from '@/store'
73103
74104
@Component({
75105
components: {
76106
SymptomsStatusText,
107+
ModalBase,
108+
DeleteIcon,
77109
},
78110
})
79111
export default class SymptomsHistory extends Vue {
112+
message = ''
113+
showModal = false
114+
115+
@Prop()
116+
patientId!: string
117+
80118
@Prop({ default: [] })
81119
statuses!: Status[]
82120
@@ -98,6 +136,19 @@ export default class SymptomsHistory extends Vue {
98136
getDate(date: string): string {
99137
return dayjs(date).format('M/D (ddd) HH:mm')
100138
}
139+
140+
deleteStatus(id: string): void {
141+
statusesStore
142+
.delete({ patientId: this.patientId, statusId: id })
143+
.then((result) => {
144+
if (result === true) {
145+
this.showModal = false
146+
this.$emit('on-deleted')
147+
} else {
148+
this.message = `削除に失敗しました。${result}`
149+
}
150+
})
151+
}
101152
}
102153
</script>
103154

@@ -116,7 +167,7 @@ export default class SymptomsHistory extends Vue {
116167
}
117168
.symptomsHistoryRow {
118169
display: grid;
119-
grid-template-columns: 9em 5em 5em 5em 1fr 28%;
170+
grid-template-columns: 9em 5em 5em 5em 1fr 28% 2em;
120171
grid-template-rows: auto;
121172
padding: 0 12px 0 0;
122173
td,
@@ -145,4 +196,16 @@ export default class SymptomsHistory extends Vue {
145196
.alerted {
146197
color: $error;
147198
}
199+
.icon {
200+
cursor: pointer;
201+
fill: $gray-2;
202+
}
203+
.buttonContainer {
204+
display: flex;
205+
justify-content: space-between;
206+
margin: 40px 0 30px;
207+
}
208+
.button {
209+
flex: 0 0 46%;
210+
}
148211
</style>

0 commit comments

Comments
 (0)