From 4138fa77375ab7e1750fd7de7d2627306a7959bc Mon Sep 17 00:00:00 2001 From: eight <641137800@qq.com> Date: 星期一, 26 八月 2024 09:33:15 +0800 Subject: [PATCH] update --- src/components/RoomStatus/src/RoomStatus.vue | 20 +++++++++++++------- 1 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/components/RoomStatus/src/RoomStatus.vue b/src/components/RoomStatus/src/RoomStatus.vue index 8d18057..a240b8c 100644 --- a/src/components/RoomStatus/src/RoomStatus.vue +++ b/src/components/RoomStatus/src/RoomStatus.vue @@ -9,7 +9,7 @@ const props = defineProps({ title: { - type: Number, + type: String, required: true }, bedList: { @@ -18,27 +18,33 @@ } }) -const onclick = (item) => { - console.error(item); - item.onstage = !item.onstage; +const onclick = async (item) => { + item.status = !item.status; + await RoomApi.updateRoom(item) } </script> <template> - <el-card style="width: 180px" shadow="hover" > + <el-card style="width: 200px" shadow="hover" > <template #header>{{title}}</template> <div v-for="(bedItem, index) in bedList" :key="index"> - <img v-if="bedItem.onstage" + <img v-if="bedItem.status === 0" + src="@/assets/room/close.jpg" + style="width: 100%" + @click = onclick(bedItem) + /> + <img v-else-if="bedItem.status === 10" src="@/assets/room/doctor.png" style="width: 100%" @click = onclick(bedItem) /> - <img v-if="!bedItem.onstage" + <img v-else-if="bedItem.status === 20" src="@/assets/room/doctor-off.jpeg" style="width: 100%" @click = onclick(bedItem) /> + {{bedItem.bedNo}} - {{bedItem.doctor_name}} </div> </el-card> </template> -- Gitblit v1.9.3