From faa7b8278a8da0d01f1e34bf4f961be5dd181a3e Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期二, 13 八月 2024 17:49:02 +0800
Subject: [PATCH] update
---
src/views/ecg/room/index.vue | 9 +++++----
src/api/ecg/room/index.ts | 8 +++++++-
src/views/ecg/room/RoomForm.vue | 37 ++++++++++++++++++++++++++++++++-----
3 files changed, 44 insertions(+), 10 deletions(-)
diff --git a/src/api/ecg/room/index.ts b/src/api/ecg/room/index.ts
index 05f5676..5cb3175 100644
--- a/src/api/ecg/room/index.ts
+++ b/src/api/ecg/room/index.ts
@@ -3,7 +3,8 @@
// 璇婂鍜岃瘖鐤楀簥 VO
export interface RoomVO {
id: number //
- roomNo: string // 璇婂缂栧彿
+ roomId: number // 璇婂缂栧彿
+ roomName: string // 璇婂鍚嶇О
bedNo: string // 璇婄枟搴婄紪鍙�
}
@@ -37,5 +38,10 @@
// 瀵煎嚭璇婂鍜岃瘖鐤楀簥 Excel
exportRoom: async (params) => {
return await request.download({ url: `/clinic/room/export-excel`, params })
+ },
+
+ // 瀵煎嚭璇婂鍜岃瘖鐤楀簥 Excel
+ getSimpleRoomList: async () => {
+ return await request.get({ url: `/clinic/room/simple-list` })
}
}
diff --git a/src/views/ecg/room/RoomForm.vue b/src/views/ecg/room/RoomForm.vue
index da1ac66..9664ad6 100644
--- a/src/views/ecg/room/RoomForm.vue
+++ b/src/views/ecg/room/RoomForm.vue
@@ -7,8 +7,15 @@
label-width="100px"
v-loading="formLoading"
>
- <el-form-item label="璇婂缂栧彿" prop="roomNo">
- <el-input v-model="formData.roomNo" placeholder="璇疯緭鍏ヨ瘖瀹ょ紪鍙�" />
+ <el-form-item label="璇婂缂栧彿" prop="roomId">
+ <el-select v-model="formData.roomId" placeholder="璇疯緭鍏ヨ瘖瀹ょ紪鍙�" >
+ <el-option
+ v-for="rooms in roomListRef"
+ :key="rooms.roomId"
+ :label="rooms.roomName"
+ :value="rooms.roomId"
+ />
+ </el-select>
</el-form-item>
<el-form-item label="璇婄枟搴婄紪鍙�" prop="bedNo">
<el-input v-model="formData.bedNo" placeholder="璇疯緭鍏ヨ瘖鐤楀簥缂栧彿" />
@@ -35,14 +42,16 @@
const formType = ref('') // 琛ㄥ崟鐨勭被鍨嬶細create - 鏂板锛泆pdate - 淇敼
const formData = ref({
id: undefined,
- roomNo: undefined,
+ roomId: undefined,
+ roomName: undefined,
bedNo: undefined
})
const formRules = reactive({
- roomNo: [{ required: true, message: '璇婂缂栧彿涓嶈兘涓虹┖', trigger: 'blur' }],
+ roomId: [{ required: true, message: '璇婂缂栧彿涓嶈兘涓虹┖', trigger: 'blur' }],
bedNo: [{ required: true, message: '璇婄枟搴婄紪鍙蜂笉鑳戒负绌�', trigger: 'blur' }]
})
const formRef = ref() // 琛ㄥ崟 Ref
+const roomListRef = ref<RoomVO[]>([]) // 鍒楄〃鐨勬暟鎹�
/** 鎵撳紑寮圭獥 */
const open = async (type: string, id?: number) => {
@@ -71,6 +80,7 @@
formLoading.value = true
try {
const data = formData.value as unknown as RoomVO
+ data.roomName = getRoomNameById( data.roomId )
if (formType.value === 'create') {
await RoomApi.createRoom(data)
message.success(t('common.createSuccess'))
@@ -90,9 +100,26 @@
const resetForm = () => {
formData.value = {
id: undefined,
- roomNo: undefined,
+ roomId: undefined,
+ roomName: undefined,
bedNo: undefined
}
formRef.value?.resetFields()
}
+
+/** 鏌ヨ璇婂鍒楄〃 */
+const getSimpleRoomList = async () => {
+ const data = await RoomApi.getSimpleRoomList()
+ roomListRef.value = data
+}
+
+const getRoomNameById = (id) => {
+ return roomListRef.value.find( e => e.roomId === id)!.roomName
+}
+
+/** 鍒濆鍖� **/
+onMounted(() => {
+ getSimpleRoomList()
+})
+
</script>
diff --git a/src/views/ecg/room/index.vue b/src/views/ecg/room/index.vue
index cf58b81..839b685 100644
--- a/src/views/ecg/room/index.vue
+++ b/src/views/ecg/room/index.vue
@@ -8,9 +8,9 @@
:inline="true"
label-width="68px"
>
- <el-form-item label="璇婂缂栧彿" prop="roomNo">
+ <el-form-item label="璇婂缂栧彿" prop="roomId">
<el-input
- v-model="queryParams.roomNo"
+ v-model="queryParams.roomId"
placeholder="璇疯緭鍏ヨ瘖瀹ょ紪鍙�"
clearable
@keyup.enter="handleQuery"
@@ -64,7 +64,8 @@
<!-- 鍒楄〃 -->
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
- <el-table-column label="璇婂缂栧彿" align="center" prop="roomNo" />
+ <el-table-column label="璇婂缂栧彿" align="center" prop="roomId" />
+ <el-table-column label="璇婂鍚嶇О" align="center" prop="roomName" />
<el-table-column label="璇婄枟搴婄紪鍙�" align="center" prop="bedNo" />
<el-table-column
label="鍒涘缓鏃堕棿"
@@ -125,7 +126,7 @@
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
- roomNo: undefined,
+ roomId: undefined,
bedNo: undefined,
createTime: []
})
--
Gitblit v1.9.3