提交代码

This commit is contained in:
zlwu committed 2025-10-25 09:41:52 +08:00
1 parent ee6bd9795e
commit cfc83776f5
2 files changed
+303 -22

No files matched your search

@@ -13,18 +13,22 @@
<u-form ref="formRef" :model="formData" :rules="rules" label-width="100">
<!-- 违纪类型 -->
<u-form-item label="违纪类型" prop="disciplineTypeId">
<view @click="showDisciplineTypePicker = true" style="width: 100%">
<view
@click="!isViewMode && (showDisciplineTypePicker = true)"
style="width: 100%"
>
<u-input
:value="disciplineTypeDisplay"
placeholder="请选择违纪类型"
readonly
border="none"
suffix-icon="arrow-down"
:suffix-icon="isViewMode ? '' : 'arrow-down'"
suffix-icon-style="color: #c8c9cc;"
style="pointer-events: none"
/>
</view>
<u-picker
v-if="!isViewMode"
:show="showDisciplineTypePicker && disciplineTypeOptions.length > 0"
:columns="disciplineTypeColumns"
keyName="text"
@@ -39,7 +43,11 @@
class="discipline-type-remark"
>
<u-icon name="info-circle" color="#909399" size="14"></u-icon>
<text class="remark-text">类型说明:{{ selectedDisciplineTypeRemark }}</text>
<text class="remark-text">
【{{ formData.disciplineTypeName }}】类型说明:{{
selectedDisciplineTypeRemark
}}
</text>
</view>
<!-- 宿舍扣分 -->
@@ -48,24 +56,30 @@
v-model.number="formData.totalScore"
type="digit"
placeholder="请输入扣分(0-100分)"
:disabled="isViewMode"
:readonly="isViewMode"
@input="handleTotalScoreChange"
/>
</u-form-item>
<!-- 卫生等级 -->
<u-form-item label="卫生等级" prop="hygieneGrade" required>
<view @click="showHygieneGradePicker = true" style="width: 100%">
<view
@click="!isViewMode && (showHygieneGradePicker = true)"
style="width: 100%"
>
<u-input
:value="hygieneGradeDisplay"
placeholder="请选择卫生等级"
readonly
border="none"
suffix-icon="arrow-down"
:suffix-icon="isViewMode ? '' : 'arrow-down'"
suffix-icon-style="color: #c8c9cc;"
style="pointer-events: none"
/>
</view>
<u-picker
v-if="!isViewMode"
:show="showHygieneGradePicker && xg_dorm_hygiene_grade.length > 0"
:columns="hygieneGradeColumns"
keyName="text"
@@ -160,6 +174,7 @@
重试
</u-button>
<u-button
v-if="!isViewMode"
size="mini"
type="error"
shape="round"
@@ -201,7 +216,7 @@
</view>
<!-- 统一附件上传按钮 -->
<view class="doc-upload-section">
<view v-if="!isViewMode" class="doc-upload-section">
<u-button
type="info"
shape="round"
@@ -234,7 +249,7 @@
<view class="section-card">
<view class="section-header">
<text class="section-title">宿舍学生情况</text>
<view style="margin-left: auto">
<view v-if="!isViewMode" style="margin-left: auto">
<u-button
size="mini"
type="primary"
@@ -305,6 +320,8 @@
type="digit"
placeholder="0-100分"
height="40"
:disabled="isViewMode"
:readonly="isViewMode"
custom-style="height: 40rpx; line-height: 40rpx; font-size: 14px; padding: 0;"
@input="handleStudentScoreChange(student)"
@blur="validateStudentScore(student)"
@@ -312,13 +329,13 @@
</view>
<view class="score-col">
<text class="score-label">出勤状态</text>
<view @click="student.showAttendancePicker = true">
<view @click="!isViewMode && (student.showAttendancePicker = true)">
<u-input
:value="getAttendanceDisplay(student.attendance_status)"
placeholder="请选择"
readonly
border="none"
suffix-icon="arrow-down"
:suffix-icon="isViewMode ? '' : 'arrow-down'"
suffix-icon-style="color: #c8c9cc;"
height="40"
custom-style="height: 40rpx; line-height: 40rpx; font-size: 14px;"
@@ -326,6 +343,7 @@
/>
</view>
<u-picker
v-if="!isViewMode"
:show="
student.showAttendancePicker &&
xg_student_attendance_status.length > 0
@@ -338,13 +356,13 @@
</view>
<view class="score-col">
<text class="score-label">学生评级</text>
<view @click="student.showGradePicker = true">
<view @click="!isViewMode && (student.showGradePicker = true)">
<u-input
:value="getGradeDisplay(student.student_grade)"
placeholder="请选择"
readonly
border="none"
suffix-icon="arrow-down"
:suffix-icon="isViewMode ? '' : 'arrow-down'"
suffix-icon-style="color: #c8c9cc;"
height="40"
custom-style="height: 40rpx; line-height: 40rpx; font-size: 14px;"
@@ -352,6 +370,7 @@
/>
</view>
<u-picker
v-if="!isViewMode"
:show="
student.showGradePicker && xg_dorm_hygiene_grade.length > 0
"
@@ -416,7 +435,7 @@
<view class="violation-section">
<view class="violation-header">
<text class="violation-title">违纪情况</text>
<view style="margin-left: auto">
<view v-if="!isViewMode" style="margin-left: auto">
<u-button
size="mini"
type="warning"
@@ -450,7 +469,7 @@
扣{{ violation.scoreDeduction }}分
</text>
</view>
<view class="violation-actions">
<view v-if="!isViewMode" class="violation-actions">
<u-button
size="mini"
type="primary"
@@ -493,10 +512,24 @@
<!-- 底部操作按钮 -->
<view class="bottom-actions">
<u-button type="info" @click="handleCancel" style="flex: 1; margin-right: 20rpx">
<u-button
v-if="!isViewMode"
type="info"
@click="handleCancel"
style="flex: 1; margin-right: 20rpx"
>
取消
</u-button>
<u-button type="primary" @click="handleSubmit" :loading="submitLoading" style="flex: 1">
<u-button v-if="isViewMode" type="info" @click="handleCancel" style="flex: 1">
关闭
</u-button>
<u-button
v-if="!isViewMode"
type="primary"
@click="handleSubmit"
:loading="submitLoading"
style="flex: 1"
>
保存检查结果
</u-button>
</view>
@@ -569,6 +602,10 @@ export default {
type: Object,
default: null,
},
isViewMode: {
type: Boolean,
default: false,
},
},
data() {
return {
+251 -7
View File
@@ -205,15 +205,77 @@
<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>
<!-- 修改检查弹窗 -->
<u-popup
:show="showEditPopup"
mode="bottom"
:round="20"
closeable
:safe-area-inset-bottom="true"
@close="handleEditPopupClose"
>
<view class="popup-container">
<view class="popup-header">
<text class="popup-title">
{{ currentEditItem ? currentEditItem.roomName : '' }} - 修改检查
</text>
</view>
<scroll-view scroll-y class="popup-scroll" :style="{ height: popupHeight + 'px' }">
<SingleRoomCheck
v-if="showEditPopup && currentEditItem"
:room-info="currentRoomInfo"
:check-info="currentCheckInfo"
:existing-data="currentEditData"
@submit="handleEditSubmit"
@cancel="handleEditPopupClose"
/>
</scroll-view>
</view>
</u-popup>
</view>
</template>
<script>
import { request } from '@/common/request.js';
import { getDict, getDictLabel, getDictTagType } from '@/common/dict.js';
import SingleRoomCheck from './components/SingleRoomCheck.vue';
export default {
name: 'DormHygieneCheck',
components: {
SingleRoomCheck,
},
data() {
return {
loading: false,
@@ -236,6 +298,21 @@ export default {
xg_dorm_hygiene_check_type: [],
xg_dorm_hygiene_check_level: [],
xg_dorm_hygiene_grade: [],
// 修改弹窗相关
showEditPopup: false,
currentEditItem: null,
currentEditData: null,
currentRoomInfo: null,
currentCheckInfo: null,
popupHeight: 600,
// 查看弹窗相关
showViewPopup: false,
currentViewItem: null,
currentViewData: null,
currentViewRoomInfo: null,
currentViewCheckInfo: null,
};
},
@@ -254,6 +331,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);
@@ -455,17 +538,157 @@ export default {
},
// 查看检查
handleView(item) {
uni.navigateTo({
url: `/pages/xgss/wsjc/wsjcDetail?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',
});
}
},
// 修改检查
handleUpdate(item) {
uni.navigateTo({
url: `/pages/xgss/wsjc/wsjcAdd?id=${item.id}&type=update`,
async handleUpdate(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.currentEditItem = item;
this.currentEditData = res.data;
// 构造房间信息
this.currentRoomInfo = {
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.currentCheckInfo = {
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.showEditPopup = true;
} else {
uni.showToast({
title: res?.msg || '加载失败',
icon: 'none',
});
}
} catch (error) {
uni.hideLoading();
console.error('❌ 加载检查记录失败:', error);
uni.showToast({
title: '加载失败',
icon: 'none',
});
}
},
// 修改检查提交处理
handleEditSubmit(data) {
uni.showToast({
title: '修改成功',
icon: 'success',
});
// 关闭弹窗
this.handleEditPopupClose();
// 刷新列表
this.loadCheckList();
},
// 修改检查弹窗关闭处理
handleEditPopupClose() {
this.showEditPopup = false;
this.currentEditItem = null;
this.currentEditData = null;
this.currentRoomInfo = null;
this.currentCheckInfo = null;
},
// 查看检查弹窗关闭处理
handleViewPopupClose() {
this.showViewPopup = false;
this.currentViewItem = null;
this.currentViewData = null;
this.currentViewRoomInfo = null;
this.currentViewCheckInfo = null;
},
// 删除检查
@@ -858,4 +1081,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>