From e707b45081a0f63d1def6fecb3da606e7c86cbac Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期一, 28 四月 2025 14:25:35 +0800
Subject: [PATCH] gx优化

---
 src/views/home/index.vue |  329 +++++++++++++++++++++++++++++-------------------------
 1 files changed, 177 insertions(+), 152 deletions(-)

diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index e2ec58e..f01fd6b 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -1,158 +1,163 @@
 <template>
     <div class="home-container layout-pd ">
-        <el-row :gutter="10">
-            <el-col class="patTabel" :xs="6" :sm="6" :md="4" :lg="3" :xl="3" v-if="state.isTable">
-                <el-table :data="state.filterTableData" stripe :height="state.tableHeight.left" size="default"
-                    highlight-current-row @current-change="handleCurrentChange" style="width: 100%">
-                    <el-table-column>
-                        <template #header>
-                            <div class="home-title">
-                                <el-avatar shape="square"
-                                    style="width: 16px; height: 16px;background-color: #ffffff;margin-right: 10px;margin-left: 10px;"
-                                    fit="contain" :src="huanzheliebiao" />
-                                <div class="titleHome">患者列表</div>
-                            </div>
-                            <el-input size="default" @change="getPatients" v-model="state.search" placeholder="支持模糊查询"
-                                :prefix-icon="Search" />
+        <div class="container">
+            <div class="container-left" v-if="isLeftVisible">
+                <div class="patTabel">
+                    <el-table :data="state.filterTableData" stripe :height="state.tableHeight.left" size="default"
+                        highlight-current-row @current-change="handleCurrentChange" style="width: 300px">
+                        <el-table-column>
+                            <template #header>
+                                <div class="home-title">
+                                    <el-avatar shape="square"
+                                        style="width: 16px; height: 16px;background-color: #ffffff;margin-right: 10px;margin-left: 10px;"
+                                        fit="contain" :src="huanzheliebiao" />
+                                    <div class="titleHome">患者列表</div>
+                                </div>
+                                <el-input size="default" @change="getPatients" v-model="state.search" placeholder="支持模糊查询"
+                                    :prefix-icon="Search" />
 
-                            <el-row style="margin-top: 5px;">
-                                <el-col :span="10">姓名</el-col>
-                                <el-col :span="5">性别</el-col>
-                                <el-col :span="4">年龄</el-col>
-                                <el-col :span="5">床号</el-col>
-                            </el-row>
-                        </template>
-                        <template #default="scope">
-                            <el-row>
-                                <el-col :span="10">{{ scope.row.patientName }}</el-col>
-                                <el-col :span="5">{{ scope.row?.patientGender===0?'男':'女' }}</el-col>
-                                <el-col :span="4">{{ scope.row.age }}</el-col>
-                                <el-col :span="5">{{ scope.row.deviceNo }}</el-col>
-                            </el-row>
-                        </template>
-                    </el-table-column>
-                </el-table>
-            </el-col>
-            <el-col :xs="18" :sm="18" :md="20" :lg="21" :xl="21" >
-                <el-tabs v-model="state.activeName" class="demo-tabs" @tab-click="handleClick">
-                    <el-tab-pane label="患者档案" name="患者档案">
-                        <template #label>
-                            <span class="custom-tabs-label home-title">
-                                <el-icon>
-                                    <Avatar />
-                                </el-icon>
-                                <span style="margin-left: 5px">患者档案</span>
-                            </span>
-                        </template>
-                    </el-tab-pane>
-                    <el-tab-pane label="营养筛查评估" name="营养筛查评估">
-                        <template #label>
-                            <span class="custom-tabs-label home-title">
-                                <el-icon>
-                                    <Histogram />
-                                </el-icon>
-                                <span style="margin-left: 5px">营养筛查评估</span>
-                            </span>
-                        </template>
-                    </el-tab-pane>
-                    <el-tab-pane label="膳食调查" name="膳食调查">
-                        <template #label>
-                            <span class="custom-tabs-label home-title">
-                                <el-icon>
-                                    <Notification />
-                                </el-icon>
-                                <span style="margin-left: 5px">膳食调查</span>
-                            </span>
-                        </template>
-                        
-                    </el-tab-pane>
-
-                    <el-tab-pane label="食物过敏原及胃肠功能调查" name="食物过敏原及胃肠功能调查">
-                        <template #label>
-                            <span class="custom-tabs-label home-title">
-                                <el-icon>
-                                    <Notification />
-                                </el-icon>
-                                <span style="margin-left: 5px">食物过敏原及胃肠功能调查</span>
-                            </span>
-                        </template>
-                    </el-tab-pane>
-                    <el-tab-pane label="随访记录" name="随访记录">
-                        <template #label>
-                            <span class="custom-tabs-label home-title">
-                                <el-icon>
-                                    <ChatDotRound />
-                                </el-icon>
-                                <span style="margin-left: 5px">随访记录</span>
-                            </span>
-                        </template>
-                    </el-tab-pane>
-                    <el-tab-pane label="营养饮食指导方案" name="营养饮食指导方案">
-                        <template #label>
-                            <span class="custom-tabs-label home-title">
-                                <el-icon>
-                                    <Grid />
-                                </el-icon>
-                                <span style="margin-left: 5px">营养饮食指导方案</span>
-                            </span>
-                        </template>
-                    </el-tab-pane>
-                    <el-tab-pane label="生化数据" name="生化数据">
-                        <template #label>
-                            <span class="custom-tabs-label home-title">
-                                <el-icon>
-                                    <Aim />
-                                </el-icon>
-                                <span style="margin-left: 5px">生化数据</span>
-                            </span>
-                        </template>
-                    </el-tab-pane>
-                    <el-tab-pane label="用药记录" name="用药记录">
-                        <template #label>
-                            <span class="custom-tabs-label home-title">
-                                <el-icon>
-                                    <Edit />
-                                </el-icon>
-                                <span style="margin-left: 5px">用药记录</span>
-                            </span>
-                        </template>
-
-                    </el-tab-pane>
-                    <el-tab-pane label="营养服务管理记录" name="营养服务管理记录">
-                        <template #label>
-                            <span class="custom-tabs-label home-title">
-                                <el-icon>
-                                    <Edit />
-                                </el-icon>
-                                <span style="margin-left: 5px">营养服务管理记录</span>
-                            </span>
-                        </template>
-
-                    </el-tab-pane>
-                </el-tabs>
-                <div class="itemDoby">
-                    <patientFile v-show="state.activeName === '患者档案'" :tableHeight="state.tableHeight.detailRight"
-                        ref="patientFileRef" />
-                    <lisUi v-show="state.activeName === '生化数据'" ref="lisUiRef">
-                    </lisUi>
-                    <MedicationRecords v-show="state.activeName === '用药记录'"  :tableHeight="state.tableHeight.detailRight" ref="MedicationRecordsRef">
-                    </MedicationRecords>
-                    <dietarySurvey ref="dietarySurveyRef" v-show="state.activeName === '膳食调查'"  :tableHeight="state.tableHeight.detailRight"></dietarySurvey>
-                    <shiwuguoming ref="shiwuguomingRef" v-show="state.activeName === '食物过敏原及胃肠功能调查'"  :tableHeight="state.tableHeight.detailRight"></shiwuguoming>
-                    <pinggubiao ref="pinggubiaoRef" v-show="state.activeName === '营养筛查评估'"  :tableHeight="state.tableHeight.detailRight"></pinggubiao>
-                    <fangAn ref="fangAnRef" v-show="state.activeName === '营养饮食指导方案'"  :tableHeight="state.tableHeight.detailRight"></fangAn>
-                    <suifangjilu ref="suifangjiluRef" v-show="state.activeName === '随访记录'" :tableHeight="state.tableHeight.detailRight"></suifangjilu>
-
-                    <jilubiao ref="jilubiaoRef" v-show="state.activeName === '营养服务管理记录'" :tableHeight="state.tableHeight.detailRight"></jilubiao>
-
-
+                                <el-row style="margin-top: 5px;">
+                                    <el-col :span="10">姓名</el-col>
+                                    <el-col :span="5">性别</el-col>
+                                    <el-col :span="4">年龄</el-col>
+                                    <el-col :span="5">床号</el-col>
+                                </el-row>
+                            </template>
+                            <template #default="scope">
+                                <el-row>
+                                    <el-col :span="10">{{ scope.row.patientName }}</el-col>
+                                    <el-col :span="5">{{ scope.row?.patientGender===0?'男':'女' }}</el-col>
+                                    <el-col :span="4">{{ scope.row.age }}</el-col>
+                                    <el-col :span="5">{{ scope.row.deviceNo }}</el-col>
+                                </el-row>
+                            </template>
+                        </el-table-column>
+                    </el-table>
                 </div>
+            </div>
+            <div class="right" :class="{'full-width': !isLeftVisible}" style="width: 100%;">
+                <div style="width: 100%;">
+                    <el-tabs v-model="state.activeName" class="demo-tabs" @tab-click="handleClick">
+                        <el-tab-pane label="患者档案" name="患者档案">
+                            <template #label>
+                                <span class="custom-tabs-label home-title">
+                                    <el-icon>
+                                        <Avatar />
+                                    </el-icon>
+                                    <span style="margin-left: 5px">患者档案</span>
+                                </span>
+                            </template>
+                        </el-tab-pane>
+                        <el-tab-pane label="营养筛查评估" name="营养筛查评估">
+                            <template #label>
+                                <span class="custom-tabs-label home-title">
+                                    <el-icon>
+                                        <Histogram />
+                                    </el-icon>
+                                    <span style="margin-left: 5px">营养筛查评估</span>
+                                </span>
+                            </template>
+                        </el-tab-pane>
+                        <el-tab-pane label="膳食调查" name="膳食调查">
+                            <template #label>
+                                <span class="custom-tabs-label home-title">
+                                    <el-icon>
+                                        <Notification />
+                                    </el-icon>
+                                    <span style="margin-left: 5px">膳食调查</span>
+                                </span>
+                            </template>
+                            
+                        </el-tab-pane>
 
-            </el-col>
-        </el-row>
-        <div class="fixed-div" v-show="patientsInfo.patientName">
+                        <el-tab-pane label="食物过敏原及胃肠功能调查" name="食物过敏原及胃肠功能调查">
+                            <template #label>
+                                <span class="custom-tabs-label home-title">
+                                    <el-icon>
+                                        <Notification />
+                                    </el-icon>
+                                    <span style="margin-left: 5px">食物过敏原及胃肠功能调查</span>
+                                </span>
+                            </template>
+                        </el-tab-pane>
+                        <el-tab-pane label="随访记录" name="随访记录">
+                            <template #label>
+                                <span class="custom-tabs-label home-title">
+                                    <el-icon>
+                                        <ChatDotRound />
+                                    </el-icon>
+                                    <span style="margin-left: 5px">随访记录</span>
+                                </span>
+                            </template>
+                        </el-tab-pane>
+                        <el-tab-pane label="营养饮食指导方案" name="营养饮食指导方案">
+                            <template #label>
+                                <span class="custom-tabs-label home-title">
+                                    <el-icon>
+                                        <Grid />
+                                    </el-icon>
+                                    <span style="margin-left: 5px">营养饮食指导方案</span>
+                                </span>
+                            </template>
+                        </el-tab-pane>
+                        <el-tab-pane label="生化数据" name="生化数据">
+                            <template #label>
+                                <span class="custom-tabs-label home-title">
+                                    <el-icon>
+                                        <Aim />
+                                    </el-icon>
+                                    <span style="margin-left: 5px">生化数据</span>
+                                </span>
+                            </template>
+                        </el-tab-pane>
+                        <el-tab-pane label="用药记录" name="用药记录">
+                            <template #label>
+                                <span class="custom-tabs-label home-title">
+                                    <el-icon>
+                                        <Edit />
+                                    </el-icon>
+                                    <span style="margin-left: 5px">用药记录</span>
+                                </span>
+                            </template>
+
+                        </el-tab-pane>
+                        <el-tab-pane label="营养服务管理记录" name="营养服务管理记录">
+                            <template #label>
+                                <span class="custom-tabs-label home-title">
+                                    <el-icon>
+                                        <Edit />
+                                    </el-icon>
+                                    <span style="margin-left: 5px">营养服务管理记录</span>
+                                </span>
+                            </template>
+
+                        </el-tab-pane>
+                    </el-tabs>
+                    <div class="itemDoby">
+                        <patientFile v-show="state.activeName === '患者档案'" :tableHeight="state.tableHeight.detailRight"
+                            ref="patientFileRef" />
+                        <lisUi v-show="state.activeName === '生化数据'" ref="lisUiRef">
+                        </lisUi>
+                        <MedicationRecords v-show="state.activeName === '用药记录'"  :tableHeight="state.tableHeight.detailRight" ref="MedicationRecordsRef">
+                        </MedicationRecords>
+                        <dietarySurvey ref="dietarySurveyRef" v-show="state.activeName === '膳食调查'"  :tableHeight="state.tableHeight.detailRight"></dietarySurvey>
+                        <shiwuguoming ref="shiwuguomingRef" v-show="state.activeName === '食物过敏原及胃肠功能调查'"  :tableHeight="state.tableHeight.detailRight"></shiwuguoming>
+                        <pinggubiao ref="pinggubiaoRef" v-show="state.activeName === '营养筛查评估'"  :tableHeight="state.tableHeight.detailRight"></pinggubiao>
+                        <fangAn ref="fangAnRef" v-show="state.activeName === '营养饮食指导方案'"  :tableHeight="state.tableHeight.detailRight"></fangAn>
+                        <suifangjilu ref="suifangjiluRef" v-show="state.activeName === '随访记录'" :tableHeight="state.tableHeight.detailRight"></suifangjilu>
+
+                        <jilubiao ref="jilubiaoRef" v-show="state.activeName === '营养服务管理记录'" :tableHeight="state.tableHeight.detailRight"></jilubiao>
+
+
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="fixed-div" v-show="patientsInfo.patientName" @click="toggleVisibility">
             <el-avatar :size="80" :src="patientsInfo.patientAvatarIcon" />
             <div>{{ patientsInfo.patientName }}</div>
+            <el-icon size="20" v-if="isLeftVisible"><Fold /></el-icon>
+            <el-icon size="20" v-else><Expand /></el-icon>
         </div>
     </div>
 </template>
@@ -204,7 +209,9 @@
 const fangAnRef=ref()
 const suifangjiluRef=ref()
 const jilubiaoRef=ref()
+const isLeftVisible=ref(true)
 const state = reactive({
+    
     global: {
         homeChartOne: null,
         homeChartTwo: null,
@@ -224,6 +231,10 @@
     setTableHeight()
     getPatients()
 })
+// 定义一个方法来切换左边div的显示状态
+const toggleVisibility = () => {
+  isLeftVisible.value = !isLeftVisible.value;
+};
 const handleCurrentChange = (val: any | undefined) => {
     if (val) {
         console.log(val)
@@ -337,10 +348,26 @@
 </script>
 
 <style lang="scss">
+.container {
+    gap: 10px; /* 在flex项目之间设置间距 */
+    display: flex;
+}
+
+.container-left {
+    width: 300px; /* 右边div的固定宽度 */
+    transition: all 0.3s ease; /* 添加过渡效果,使宽度变化更加平滑 */
+}
+.right {
+    flex-grow: 1; /* 让这个div扩展以填充可用空间 */
+    transition: all 0.3s ease; /* 添加过渡效果,使宽度变化更加平滑 */
+}
+.full-width {
+    width: 100%; /* 当左边div隐藏时,右边div占据全部宽度 */
+}
 .home-container {
     overflow: hidden;
-
     .patTabel {
+        width: 100%;
         .el-table th.el-table__cell {
             background-color: #6babfa;
             color: #ffffff;
@@ -349,8 +376,6 @@
         .el-table__body tr.current-row>td.el-table__cell {
             background: rgb(197.7, 225.9, 255);
             color: #409EFF;
-            /* height: 25px; */
-            /* border: tomato solid 1px; */
         }
     }
 
@@ -392,7 +417,7 @@
     align-items: center;
     bottom: 10px;
     right: 30px;
-    width: 200px;
+    width: 220px;
     height: 100px;
     color: rgb(16, 3, 3);
     padding: 10px;

--
Gitblit v1.8.0