掛單管理
This commit is contained in:
1 parent
8db6019ba3
commit
9e251fc7d4
12 files changed
+2197
-116
No files matched your search
@@ -213,6 +213,13 @@
|
||||
:headers="room_bed.bed_headers"
|
||||
:items ="room_bed.bed_items"
|
||||
>
|
||||
<!-- 顯示設定條件名稱 -->
|
||||
<template #item.limits="{item}">
|
||||
<span v-if="item.limits && item.limits.length">
|
||||
{{ getConditionNames(item.limits) }}
|
||||
</span>
|
||||
<span v-else class="text-muted">無</span>
|
||||
</template>
|
||||
<template #item.isactive="{item}">
|
||||
{{item.isactive ? '啟用' : '停用'}}
|
||||
</template>
|
||||
@@ -257,7 +264,20 @@
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- ⭐️ 新增:設定條件選單 ⭐️ -->
|
||||
<div class="mb-3">
|
||||
<label class="form-label d-block">設定條件</label>
|
||||
<div v-for="item in room_bed.bed_conditions" :key="item.paramNo" class="form-check form-check-inline">
|
||||
<input class="form-check-input"
|
||||
type="checkbox"
|
||||
:id="'cond_' + item.paramNo"
|
||||
:value="item.paramNo"
|
||||
v-model="room_bed.newBedForm.Limits">
|
||||
<label class="form-check-label" :for="'cond_' + item.paramNo">
|
||||
{{ item.paramName }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-check form-switch mb-3">
|
||||
<input type="checkbox" class="form-check-input" id="isActiveCheck" v-model="room_bed.newBedForm.IsActive" />
|
||||
<label class="form-check-label" for="isActiveCheck">是否啟用</label>
|
||||
@@ -547,9 +567,15 @@
|
||||
{ text: '床位編號', value: 'uuid' },
|
||||
{ text: '床位名稱', value: 'name' },
|
||||
{ text: '床位狀態', value: 'statuscode' },
|
||||
{ text: '設定條件', value: 'limits' }, // 可選:在表格中顯示條件
|
||||
{ text: '是否啟用', value: 'isactive' },
|
||||
{ text: '', value: 'action' },
|
||||
],
|
||||
// 1. 新增條件來源選單 (可經由 API 載入,這裡預設填入您提供的 JSON)
|
||||
bed_conditions: [
|
||||
{ "paramNo": "01", "paramName": "需要輪椅", "remark": "" },
|
||||
{ "paramNo": "02", "paramName": "需要拐杖", "remark": "" }
|
||||
],
|
||||
newBedForm: {
|
||||
uuid: null,
|
||||
RegionUuid: null,
|
||||
@@ -557,13 +583,37 @@
|
||||
statuscode: null,
|
||||
IsActive: true,
|
||||
Gender: null,
|
||||
Limits:[]
|
||||
},
|
||||
showBedModal: false,
|
||||
bed_status: [], //床位狀態列表
|
||||
//bed_conditions:[]
|
||||
}
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
loadBedConditions() {
|
||||
this.room_bed.bed_conditions = 0; // 清空陣列
|
||||
let self = this;
|
||||
let data = [];
|
||||
axios.post(HTTP_HOST + 'api/guadan/getGuadanLimit').then((res) => {
|
||||
|
||||
if (res.status == 200) {
|
||||
res.data.forEach(item => {
|
||||
console.log('掛單條件', item);
|
||||
})
|
||||
this.room_bed.bed_conditions = res.data;
|
||||
}
|
||||
})
|
||||
},
|
||||
getConditionNames(conditionIds) {
|
||||
let condition = conditionIds.split(",");
|
||||
if (!condition || !Array.isArray(condition)) return '';
|
||||
return this.room_bed.bed_conditions
|
||||
.filter(c => condition.includes(c.paramNo))
|
||||
.map(c => c.paramName)
|
||||
.join('、');
|
||||
},
|
||||
closeBedInUsedModal() {
|
||||
this.bed_is_used_modal = false;
|
||||
this.bed_is_used_modal_message = null;
|
||||
@@ -759,6 +809,7 @@
|
||||
statuscode: "101",
|
||||
IsActive: true,
|
||||
Gender: this.currentSelectRoom.gender, // 不設預設值,強制選擇
|
||||
Limits: [] // 重置為空陣列
|
||||
};
|
||||
this.room_bed.showBedModal = true;
|
||||
},
|
||||
@@ -834,13 +885,24 @@
|
||||
statuscode: bed.statuscode,
|
||||
IsActive: bed.isactive,
|
||||
Gender: bed.gender,
|
||||
// 確保將後端回傳的條件清單帶入(如果是字串或陣列,建議統一轉為陣列)
|
||||
Limits: bed.limits ? [...bed.limits] : []
|
||||
};
|
||||
this.room_bed.showBedModal = true;
|
||||
},
|
||||
async saveEditBed() {
|
||||
|
||||
try {
|
||||
await axios.post(HTTP_HOST + 'api/region/bed/update', this.room_bed.newBedForm);
|
||||
let data= {
|
||||
uuid: this.room_bed.newBedForm.uuid,
|
||||
RoomUuid: this.room_bed.newBedForm.RoomUuid,
|
||||
Name: this.room_bed.newBedForm.Name,
|
||||
statuscode: this.room_bed.newBedForm.statuscode,
|
||||
IsActive: this.room_bed.newBedForm.IsActive,
|
||||
Gender: this.room_bed.newBedForm.Gender,
|
||||
Limits: this.room_bed.newBedForm.Limits.join(',') // 假設後端接受逗號分隔的字串
|
||||
};
|
||||
await axios.post(HTTP_HOST + 'api/region/bed/update', data);
|
||||
this.room_bed.showBedModal = false;
|
||||
|
||||
const updated = this.room_bed.newBedForm;
|
||||
@@ -852,7 +914,8 @@
|
||||
roomUuid: updated.RoomUuid,
|
||||
name: updated.Name,
|
||||
statuscode: updated.statuscode,
|
||||
isactive: updated.IsActive
|
||||
isactive: updated.IsActive,
|
||||
limits: updated.Limits
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1015,6 +1078,7 @@
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.loadBedConditions();
|
||||
this.loadRegions();
|
||||
this.loadRegionType();
|
||||
this.getBedStatus();
|
||||
|
||||
Reference in new issue
Block a user