修改挂单功能

This commit is contained in:
2025-09-09 16:25:28 +08:00
parent e6c6b1f43f
commit ded24a8446
23 changed files with 1073 additions and 231 deletions

View File

@@ -217,8 +217,8 @@
<template #item.isactive="{item}">
{{item.isactive ? '啟用' : '停用'}}
</template>
<template #item.statusuuid="{item}">
{{getBedStatusNameById(item.statusuuid)}}
<template #item.statuscode="{item}">
{{getBedStatusNameById(item.statuscode)}}
</template>
<template #item.action ="{item}">
<button type="button" class="btn btn-primary" @click="editBed(item)">
@@ -252,8 +252,8 @@
<div class="mb-3">
<label class="form-label">狀態</label>
<select class="form-control" v-model="room_bed.newBedForm.statusuuid">
<option v-for="status in room_bed.bed_status" :value="status.uuid">
<select class="form-control" v-model="room_bed.newBedForm.statuscode">
<option v-for="status in room_bed.bed_status" :value="status.code">
{{status.name}}
</option>
</select>
@@ -528,7 +528,7 @@
bed_headers: [
{ text: '床位編號', value: 'uuid' },
{ text: '床位名稱', value: 'name' },
{ text: '床位狀態', value: 'statusuuid' },
{ text: '床位狀態', value: 'statuscode' },
{ text: '是否啟用', value: 'isactive' },
{ text: '', value: 'action' },
],
@@ -536,7 +536,7 @@
uuid: null,
RegionUuid: null,
Name: '',
statusuuid: null,
statuscode: null,
IsActive: true,
Gender: null,
},
@@ -664,7 +664,7 @@
});
},
confirmDeleteRegion() {
axios.post('/api/region/delete', { uuid: this.form.uuid })
axios.post('/api/region/delete', { statuscode: this.form.statuscode })
.then(() => {
this.showDeleteModal = false;
this.$refs.messageModal.open({
@@ -716,7 +716,7 @@
uuid: null,
RoomUuid: this.currentSelectRoom.uuid,
Name: '',
statusuuid: null,
statuscode: null,
IsActive: true,
Gender: this.currentSelectRoom.gender, // 不設預設值,強制選擇
};
@@ -791,7 +791,7 @@
RegionUuid: bed.regionUuid,
RoomUuid: bed.roomUuid,
Name: bed.name,
statusuuid: bed.statusuuid,
statuscode: bed.statuscode,
IsActive: bed.isactive,
Gender: bed.gender,
};
@@ -811,7 +811,7 @@
...this.room_bed.bed_items[index], // 保留原本未更新欄位
roomUuid: updated.RoomUuid,
name: updated.Name,
statusuuid: updated.statusuuid,
statuscode: updated.statuscode,
isactive: updated.IsActive
});
}
@@ -839,10 +839,8 @@
this.room_bed.bed_status = res.data;
})
},
getBedStatusNameById(id) {
console.log(id)
//傳入一個Id獲取該Id對應的名稱
const status = this.room_bed.bed_status.find(i => i.uuid == id);
getBedStatusNameById(statuscode) {
const status = this.room_bed.bed_status.find(i => i.code == statuscode);
if (status) {
return status.name;
}