zlwu hace 1 año
padre
commit
594d0c5df3

+ 1 - 1
mobile/src/pages/xgss/wsjc/components/SingleRoomCheck.vue

@@ -387,7 +387,7 @@
                     <view v-if="getStudentLeave(student.studentId)" class="leave-section">
                         <view class="leave-header">
                             <text class="leave-title">请假信息</text>
-                            <u-tag type="warning" size="mini">请假中</u-tag>
+                            <u-tag text="请假中" type="warning" size="mini"></u-tag>
                         </view>
                         <view class="leave-info">
                             <view class="leave-item">

+ 136 - 9
mobile/src/pages/xgss/xssswsjc/xssswsjc.vue

@@ -117,16 +117,12 @@
                         <view class="info-section">
                             <text class="section-title">宿舍信息</text>
                             <view class="dorm-info-grid">
-                                <!-- 第一行:校区和宿舍区 -->
+                                <!-- 第一行:校区 -->
                                 <view class="dorm-row">
                                     <view class="info-item-half">
                                         <text class="label">校区:</text>
                                         <text class="value">{{ item.campusName || '-' }}</text>
                                     </view>
-                                    <view class="info-item-half">
-                                        <text class="label">宿舍区:</text>
-                                        <text class="value">{{ item.areaName || '-' }}</text>
-                                    </view>
                                 </view>
                                 <!-- 第二行:宿舍楼和房间 -->
                                 <view class="dorm-row">
@@ -207,6 +203,35 @@
         <!-- <view class="fab-button" @click="handleAdd">
             <u-icon name="plus" size="24" color="#ffffff" />
         </view> -->
+
+        <!-- 查看检查弹窗 -->
+        <u-popup
+            :show="showViewPopup"
+            mode="bottom"
+            :round="20"
+            closeable
+            :safe-area-inset-bottom="true"
+            @close="handleViewPopupClose"
+        >
+            <view class="popup-container">
+                <view class="popup-header">
+                    <text class="popup-title">
+                        {{ currentViewItem ? currentViewItem.roomName : '' }} - 查看检查
+                    </text>
+                </view>
+
+                <scroll-view scroll-y class="popup-scroll" :style="{ height: popupHeight + 'px' }">
+                    <SingleRoomCheck
+                        v-if="showViewPopup && currentViewItem"
+                        :room-info="currentViewRoomInfo"
+                        :check-info="currentViewCheckInfo"
+                        :existing-data="currentViewData"
+                        :is-view-mode="true"
+                        @cancel="handleViewPopupClose"
+                    />
+                </scroll-view>
+            </view>
+        </u-popup>
     </view>
 </template>
 
@@ -214,9 +239,13 @@
 import { request } from '@/common/request.js';
 import { getDict, getDictLabel, getDictTagType } from '@/common/dict.js';
 import { userManager } from '@/utils/user.js';
+import SingleRoomCheck from '../wsjc/components/SingleRoomCheck.vue';
 
 export default {
     name: 'DormHygieneCheck',
+    components: {
+        SingleRoomCheck,
+    },
     data() {
         return {
             loading: false,
@@ -239,6 +268,14 @@ export default {
             xg_dorm_hygiene_check_type: [],
             xg_dorm_hygiene_check_level: [],
             xg_dorm_hygiene_grade: [],
+
+            // 查看弹窗相关
+            showViewPopup: false,
+            currentViewItem: null,
+            currentViewData: null,
+            currentViewRoomInfo: null,
+            currentViewCheckInfo: null,
+            popupHeight: 600,
         };
     },
 
@@ -257,6 +294,12 @@ export default {
         uni.$on('refreshCheckList', this.handleRefreshEvent);
     },
 
+    onReady() {
+        // 计算弹窗高度(屏幕高度的70%)
+        const systemInfo = uni.getSystemInfoSync();
+        this.popupHeight = systemInfo.windowHeight * 0.7;
+    },
+
     beforeDestroy() {
         // 移除事件监听
         uni.$off('refreshCheckList', this.handleRefreshEvent);
@@ -487,10 +530,73 @@ export default {
         },
 
         // 查看检查
-        handleView(item) {
-            uni.navigateTo({
-                url: `/pages/xgss/xssswsjc/xssswsjcDetail?id=${item.id}&type=view`,
-            });
+        async handleView(item) {
+            try {
+                uni.showLoading({ title: '加载中...' });
+
+                // 加载检查记录详情
+                const res = await request({
+                    url: `/dormHygieneCheck/dormHygieneCheck/${item.id}`,
+                    method: 'GET',
+                });
+
+                uni.hideLoading();
+
+                if (res && res.code === 200 && res.data) {
+                    this.currentViewItem = item;
+                    this.currentViewData = res.data;
+
+                    // 构造房间信息
+                    this.currentViewRoomInfo = {
+                        id: item.roomId,
+                        roomName: item.roomName,
+                        roomCode: item.roomCode,
+                        campusId: item.campusId,
+                        campusName: item.campusName,
+                        areaId: item.areaId,
+                        areaName: item.areaName,
+                        buildingId: item.buildingId,
+                        buildingName: item.buildingName,
+                    };
+
+                    // 构造检查基础信息
+                    this.currentViewCheckInfo = {
+                        checkTitle: item.checkTitle,
+                        checkDate: item.checkDate,
+                        checkerId: item.checkerId,
+                        checkerName: item.checkerName,
+                        checkType: item.checkType,
+                        checkLevel: item.checkLevel,
+                        campusId: item.campusId,
+                        campusName: item.campusName,
+                        buildingId: item.buildingId,
+                        buildingName: item.buildingName,
+                    };
+
+                    this.showViewPopup = true;
+                } else {
+                    uni.showToast({
+                        title: res?.msg || '加载失败',
+                        icon: 'none',
+                    });
+                }
+            } catch (error) {
+                uni.hideLoading();
+                console.error('❌ 加载检查记录失败:', error);
+                uni.showToast({
+                    title: '加载失败',
+                    icon: 'none',
+                });
+            }
+        },
+
+        // 查看检查弹窗关闭处理
+        handleViewPopupClose() {
+            this.showViewPopup = false;
+            this.currentViewItem = null;
+            this.currentViewData = null;
+            this.currentViewRoomInfo = null;
+            this.currentViewCheckInfo = null;
         },
 
         // 修改检查
@@ -903,4 +1009,25 @@ export default {
 ::v-deep .u-button {
     border-radius: 8rpx;
 }
+
+// 查看弹窗样式
+.popup-container {
+    background-color: #fff;
+    border-radius: 20rpx 20rpx 0 0;
+}
+
+.popup-header {
+    padding: 30rpx;
+    border-bottom: 2rpx solid #f0f0f0;
+}
+
+.popup-title {
+    font-size: 32rpx;
+    font-weight: 600;
+    color: #303133;
+}
+
+.popup-scroll {
+    overflow-y: auto;
+}
 </style>