Merge branch 'main' of http://47.112.118.149:10082/xgxt_sd/zhxg_app
This commit is contained in:
84
api/dms/studentDormInfo/index.js
Normal file
84
api/dms/studentDormInfo/index.js
Normal file
@@ -0,0 +1,84 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询宿舍学生关联列表
|
||||
export function listStudent(query) {
|
||||
return request({
|
||||
url: '/dormitory/srs-dormitory-student/checkInInformation',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 新增宿舍学生关联
|
||||
export function addStudent(data) {
|
||||
return request({
|
||||
url: '/dormitory/srs-dormitory-student/addCheckInInformation',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 获取校区
|
||||
export function listAllCampus() {
|
||||
return request({
|
||||
url: '/dormitory/dms-dormitory/listAllCampus',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 根据校区id获取园区
|
||||
export function listParkByCampus(id) {
|
||||
return request({
|
||||
url: '/dormitory/dms-dormitory/listParkByCampus/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 根据园区id获取楼栋
|
||||
export function listBuildingByPark(id) {
|
||||
return request({
|
||||
url: '/dormitory/dms-dormitory/listBuildingByPark/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 根据楼栋id获取楼层
|
||||
export function listFloorByBuilding(id) {
|
||||
return request({
|
||||
url: '/dormitory/dms-dormitory/listFloorByBuilding/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 根据楼层id获取宿舍号
|
||||
export function listAllRoomByFloor(id) {
|
||||
return request({
|
||||
url: '/dormitory/dms-dormitory/listAllRoomByFloor/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 修改证件照
|
||||
export function submitOwnInfo(data){
|
||||
return request({
|
||||
url:'/comprehensive/extraInfo/submitOwnInfo',
|
||||
method:'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 查询年级列表
|
||||
export function listGrade(query = null) {
|
||||
return request({
|
||||
url: '/cph/grade/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询学院名称
|
||||
export function getDeptName() {
|
||||
return request({
|
||||
url: '/system/dept/name'
|
||||
})
|
||||
}
|
||||
19
pages.json
19
pages.json
@@ -209,8 +209,7 @@
|
||||
"navigationBarBackgroundColor": "#1890FF",
|
||||
"navigationBarTextStyle": "white"
|
||||
}
|
||||
},
|
||||
{
|
||||
}, {
|
||||
"path": "pages/record/record",
|
||||
"style": {
|
||||
"navigationBarTitleText": "住宿记录",
|
||||
@@ -218,6 +217,22 @@
|
||||
"navigationBarBackgroundColor": "#1890FF",
|
||||
"navigationBarTextStyle": "white"
|
||||
}
|
||||
}, {
|
||||
"path": "pages/dormitory/studentDormInfo/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "学生入住信息收集",
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationBarBackgroundColor": "#1890FF",
|
||||
"navigationBarTextStyle": "white"
|
||||
}
|
||||
}, {
|
||||
"path": "pages/dormitory/studentDormInfo/informationCollection",
|
||||
"style": {
|
||||
"navigationBarTitleText": "信息收集",
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationBarBackgroundColor": "#1890FF",
|
||||
"navigationBarTextStyle": "white"
|
||||
}
|
||||
}, {
|
||||
"path": "pages/addapply/addapply",
|
||||
"style": {
|
||||
|
||||
1021
pages/dormitory/studentDormInfo/index.vue
Normal file
1021
pages/dormitory/studentDormInfo/index.vue
Normal file
File diff suppressed because it is too large
Load Diff
510
pages/dormitory/studentDormInfo/informationCollection.vue
Normal file
510
pages/dormitory/studentDormInfo/informationCollection.vue
Normal file
@@ -0,0 +1,510 @@
|
||||
<template>
|
||||
<view class="form-container">
|
||||
<view class="form-title">2025-2026学年学生宿舍入住收集表</view>
|
||||
<view class="form-desc">涉及住宿费核算,请同学们按照实际入住情况填写。</view>
|
||||
|
||||
<!-- 1. 校区 -->
|
||||
<view class="form-item">
|
||||
<view class="item-label">
|
||||
<text class="required">*</text>校区
|
||||
</view>
|
||||
<picker @change="handleCampusChange" :range="campusOptions" :range-key="'name'">
|
||||
<view class="picker-input">{{ form.campusName || '请选择校区' }}</view>
|
||||
</picker>
|
||||
</view>
|
||||
|
||||
<!-- 2. 园区 -->
|
||||
<view class="form-item" v-if="form.campusName">
|
||||
<view class="item-label">
|
||||
<text class="required">*</text>园区
|
||||
</view>
|
||||
<picker @change="handleParkChange" :range="parkOptions" :range-key="'name'">
|
||||
<view class="picker-input">{{ form.parkName || '请选择园区' }}</view>
|
||||
</picker>
|
||||
</view>
|
||||
|
||||
<!-- 3. 楼栋 -->
|
||||
<view class="form-item" v-if="form.parkName">
|
||||
<view class="item-label">
|
||||
<text class="required">*</text>楼栋
|
||||
</view>
|
||||
<picker @change="handleBuildingChange" :range="buildingOptions" :range-key="'name'">
|
||||
<view class="picker-input">{{ form.buildingName || '请选择楼栋' }}</view>
|
||||
</picker>
|
||||
</view>
|
||||
|
||||
<!-- 4. 层(下拉框) -->
|
||||
<view class="form-item" v-if="form.buildingName">
|
||||
<view class="item-label">
|
||||
<text class="required">*</text>层
|
||||
</view>
|
||||
<picker @change="handleFloorChange" :range="floorOptions" :range-key="'floor'">
|
||||
<view class="picker-input">{{ form.floorName || '请选择楼层' }}</view>
|
||||
</picker>
|
||||
</view>
|
||||
|
||||
<!-- 5. 宿舍 -->
|
||||
<view class="form-item" v-if="form.floorName">
|
||||
<view class="item-label">
|
||||
<text class="required">*</text>宿舍
|
||||
</view>
|
||||
<picker @change="handleDormChange" :range="dormOptions" :range-key="'displayText'">
|
||||
<view class="picker-input">{{ form.roomNo || '请选择宿舍' }}</view>
|
||||
</picker>
|
||||
</view>
|
||||
|
||||
<!-- 6. 学生学号 -->
|
||||
<view class="form-item">
|
||||
<view class="item-label">
|
||||
<text class="required">*</text>学生学号
|
||||
</view>
|
||||
<input class="input" v-model="form.stuNo" placeholder="请输入学生学号" />
|
||||
</view>
|
||||
|
||||
<!-- 7. 是否为宿舍长 -->
|
||||
<view class="form-item">
|
||||
<view class="item-label">
|
||||
<text class="required">*</text>是否为宿舍长
|
||||
</view>
|
||||
<picker @change="handleDormHeadChange" :range="dormHeadOptions">
|
||||
<view class="picker-input">{{ form.isDormHead || '请选择' }}</view>
|
||||
</picker>
|
||||
</view>
|
||||
|
||||
<!-- 8. 入住时间 -->
|
||||
<view class="form-item">
|
||||
<view class="item-label">
|
||||
<text class="required">*</text>入住时间
|
||||
</view>
|
||||
<picker mode="date" @change="handleCheckinTimeChange">
|
||||
<view class="picker-input">{{ form.checkinTime || '请选择入住时间' }}</view>
|
||||
</picker>
|
||||
</view>
|
||||
|
||||
<!-- 9. 本人证件照 -->
|
||||
<view class="form-item">
|
||||
<view class="item-label">
|
||||
<text class="required">*</text>本人证件照
|
||||
</view>
|
||||
<view class="item-desc">请上传本人证件照,以便宿管阿姨能认识大家,谢谢。</view>
|
||||
<view class="upload-btn" @click="handleUpload">
|
||||
<text class="upload-icon">+</text>
|
||||
<text>上传图片</text>
|
||||
</view>
|
||||
<view class="upload-tip">当前设置:最多上传1张图片,单个图片10MB以内</view>
|
||||
<view class="upload-preview" v-if="form.photoData">
|
||||
<image :src="form.photoData" mode="aspectFill" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 提交按钮 -->
|
||||
<button class="submit-btn" @click="handleSubmit">提交</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listAllCampus,
|
||||
listParkByCampus,
|
||||
listBuildingByPark,
|
||||
listFloorByBuilding,
|
||||
listAllRoomByFloor,
|
||||
addStudent,
|
||||
submitOwnInfo as submitExtraInfo
|
||||
} from "@/api/dms/studentDormInfo/index.js"
|
||||
import {
|
||||
getUserProfile
|
||||
} from '@/api/system/user'
|
||||
import {
|
||||
previewImg
|
||||
} from "@/utils/uploadImg.js"
|
||||
import {
|
||||
checkPic
|
||||
} from "@/utils/checkPic.js"
|
||||
import uploadFile from "@/plugins/upload.js";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
user: [],
|
||||
form: {
|
||||
campusName: '',
|
||||
parkName: '',
|
||||
buildingName: '',
|
||||
floorName: '',
|
||||
roomNo: '',
|
||||
stuNo: '',
|
||||
isDormitoryHead: '',
|
||||
isDormHead: '',
|
||||
checkinTime: '',
|
||||
photo: '',
|
||||
teacherName: '',
|
||||
className: '',
|
||||
deptName: '',
|
||||
stuName: '',
|
||||
displayText: '',
|
||||
isInStudentsleep: '是',
|
||||
photoData: ''
|
||||
},
|
||||
// 校区选项
|
||||
campusOptions: [],
|
||||
// 园区选项(按校区联动)
|
||||
parkOptions: [],
|
||||
// 楼栋选项(按园区联动)
|
||||
buildingOptions: [],
|
||||
// 楼层选项(下拉框)
|
||||
floorOptions: [],
|
||||
// 宿舍号选项(下拉框)
|
||||
dormOptions: [],
|
||||
// 宿舍长选项
|
||||
dormHeadOptions: ['否', '是'],
|
||||
// 当前选中项的id
|
||||
selectedCampus: null, // 选中的校区({id, name})
|
||||
selectedPark: null, // 选中的园区
|
||||
selectedBuilding: null, // 选中的楼栋
|
||||
selectedFloor: null, // 选中的楼层
|
||||
selectedDorm: null, //选中的宿舍
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
this.getUserProfile()
|
||||
this.listAllCampus()
|
||||
},
|
||||
methods: {
|
||||
// 获取用户信息
|
||||
async getUserProfile() {
|
||||
try {
|
||||
const res = await getUserProfile()
|
||||
this.user = res
|
||||
this.form.stuNo = this.user.data.userName
|
||||
console.log('当前用户信息:', res)
|
||||
} catch (err) {
|
||||
console.error('获取用户信息失败:', err)
|
||||
}
|
||||
},
|
||||
// 获取校区数据
|
||||
async listAllCampus() {
|
||||
let res = await listAllCampus()
|
||||
if (res.code == 200) {
|
||||
this.campusOptions = [...res.data]
|
||||
}
|
||||
},
|
||||
// 根据校区id获取园区
|
||||
async listParkByCampus(id) {
|
||||
let res = await listParkByCampus(id)
|
||||
if (res.code == 200) {
|
||||
this.parkOptions = [...res.data]
|
||||
}
|
||||
},
|
||||
// 根据园区id获取楼栋
|
||||
async listBuildingByPark(id) {
|
||||
let res = await listBuildingByPark(id)
|
||||
if (res.code == 200) {
|
||||
this.buildingOptions = [...res.data]
|
||||
}
|
||||
},
|
||||
// 根据楼栋id获取楼层
|
||||
async listFloorByBuilding(id) {
|
||||
let res = await listFloorByBuilding(id)
|
||||
if (res.code == 200) {
|
||||
this.floorOptions = [...res.data]
|
||||
}
|
||||
},
|
||||
// 根据楼层id获取宿舍号
|
||||
async listAllRoomByFloor(id) {
|
||||
let res = await listAllRoomByFloor(id)
|
||||
if (res.code == 200) {
|
||||
this.dormOptions = [...res.data]
|
||||
// 遍历数据,为每个对象添加 displayText 属性
|
||||
this.dormOptions = res.data.map(v => ({
|
||||
...v, // 保留原对象所有属性
|
||||
// 新增拼接后的显示文本属性
|
||||
displayText: `${v.roomNo} -- ${v.gender} -- 床位 ${v.bedNum} -- 已住 ${v.occupancy}`,
|
||||
isFull: v.occupancy >= v.bedNum // 新增:判断是否满人
|
||||
}));
|
||||
}
|
||||
},
|
||||
// 校区选择变化
|
||||
handleCampusChange(e) {
|
||||
this.form.campusName = this.campusOptions[e.detail.value].name;
|
||||
this.form.parkName = ''; // 重置园区
|
||||
this.form.buildingName = ''; // 重置楼栋
|
||||
this.form.floorName = ''; // 重置楼层
|
||||
this.form.roomNo = ''; // 重置宿舍
|
||||
// 获取选中的校区id
|
||||
this.selectedCampus = this.campusOptions[e.detail.value].id;
|
||||
// 获取对应校区下面的园区
|
||||
this.listParkByCampus(this.selectedCampus)
|
||||
},
|
||||
// 园区选择变化
|
||||
handleParkChange(e) {
|
||||
this.form.parkName = this.parkOptions[e.detail.value].name;
|
||||
this.form.buildingName = ''; // 重置楼栋
|
||||
this.form.floorName = ''; // 重置楼层
|
||||
this.form.roomNo = ''; // 重置宿舍
|
||||
// 获取选中的园区的id
|
||||
this.selectedPark = this.parkOptions[e.detail.value].id;
|
||||
// 获取对应园区下面的楼栋
|
||||
this.listBuildingByPark(this.selectedPark)
|
||||
},
|
||||
// 楼栋选择变化
|
||||
handleBuildingChange(e) {
|
||||
this.form.buildingName = this.buildingOptions[e.detail.value].name;
|
||||
this.form.floorName = ''; // 重置楼层
|
||||
this.form.roomNo = ''; // 重置宿舍
|
||||
// 获取选中的楼栋的id
|
||||
this.selectedBuilding = this.buildingOptions[e.detail.value].id;
|
||||
// 获取选中的楼栋下面的楼层
|
||||
this.listFloorByBuilding(this.selectedBuilding)
|
||||
},
|
||||
// 楼层选择变化(下拉框)
|
||||
handleFloorChange(e) {
|
||||
this.form.floorName = this.floorOptions[e.detail.value].floor;
|
||||
this.form.roomNo = ''; // 重置宿舍
|
||||
// 获取选中的楼层的id
|
||||
this.selectedFloor = this.floorOptions[e.detail.value].id;
|
||||
// 获取选中的楼层下面的宿舍号
|
||||
this.listAllRoomByFloor(this.selectedFloor)
|
||||
},
|
||||
// 宿舍号选择变化(行拉框)
|
||||
handleDormChange(e) {
|
||||
const index = e.detail.value;
|
||||
const selectedDorm = this.dormOptions[index]; // 获取选中的宿舍对象
|
||||
|
||||
// 判断是否满人
|
||||
if (selectedDorm.isFull) {
|
||||
// 满人时提示并重置选择
|
||||
uni.showToast({
|
||||
title: `宿舍 ${selectedDorm.roomNo} 已住满,无法选择`,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
// 重置宿舍选择(如果之前有选中值则保留,否则为空)
|
||||
if (!this.form.roomNo) {
|
||||
this.form.roomNo = '';
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// 未满人时正常选中
|
||||
this.form.roomNo = selectedDorm.roomNo; // 显示拼接文本
|
||||
this.selectedDorm = selectedDorm.id; // 存储宿舍ID(用于提交)
|
||||
},
|
||||
// 宿舍长选择变化
|
||||
handleDormHeadChange(e) {
|
||||
this.form.isDormitoryHead = this.dormHeadOptions[e.detail.value] == '是' ? 1 : 0;
|
||||
this.form.isDormHead = this.dormHeadOptions[e.detail.value]
|
||||
},
|
||||
// 入住时间选择变化
|
||||
handleCheckinTimeChange(e) {
|
||||
this.form.checkinTime = e.detail.value;
|
||||
},
|
||||
// 证件照上传
|
||||
handleUpload() {
|
||||
uni.chooseImage({
|
||||
count: 3,
|
||||
success: async (img) => {
|
||||
let bool = await checkPic(img.tempFiles[0]);
|
||||
if (bool) {
|
||||
uploadFile('/common/upload', img.tempFilePaths[0]).then((res) => {
|
||||
// if (this.form.photo !== "") {
|
||||
// this.form.photo = this.form.photo + "," + JSON.parse(res)
|
||||
// .fileName;
|
||||
// } else {
|
||||
// this.form.photo = JSON.parse(res).fileName;
|
||||
// }
|
||||
this.form.photoData = img.tempFilePaths[0];
|
||||
this.form.photo = JSON.parse(res).fileName;
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
// 提交表单
|
||||
async handleSubmit() {
|
||||
console.log(this.form);
|
||||
// 验证必填项
|
||||
if (
|
||||
!this.form.campusName || // 校区名称(字符串,空则false)
|
||||
!this.form.parkName || // 园区名称(字符串,空则false)
|
||||
!this.form.buildingName || // 楼栋名称(字符串,空则false)
|
||||
(!this.form.floorName && this.form.floorName !== 0) || // 楼层(数值,排除0的误判)
|
||||
(!this.form.roomNo && this.form.roomNo !== 0) || // 宿舍号(数值,排除0的误判)
|
||||
!this.form.isDormHead || // 是否宿舍长(值为"是"/"否")
|
||||
!this.form.checkinTime || // 入住时间(日期字符串,空则false)
|
||||
!this.form.photo // 证件照(blob路径,空则false,若必填需加)
|
||||
) {
|
||||
uni.showToast({
|
||||
title: '带*号的为必填项,请填写完整',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.form.dormitoryId = this.selectedDorm;
|
||||
// 模拟提交
|
||||
uni.showLoading({
|
||||
title: '提交中...'
|
||||
});
|
||||
// 添加入住信息
|
||||
let res = await addStudent(this.form);
|
||||
if (res.code == 200) {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: '提交成功',
|
||||
icon: 'success'
|
||||
});
|
||||
// 上次图片头像
|
||||
let data = submitExtraInfo({
|
||||
userId: this.user.data.userId,
|
||||
whitePhoto: this.form.photo
|
||||
})
|
||||
// if (data.code == 200) {
|
||||
// console.log(data);
|
||||
// }
|
||||
|
||||
setTimeout(() => {
|
||||
// 重置表单
|
||||
this.form = {
|
||||
campusName: '',
|
||||
parkName: '',
|
||||
buildingName: '',
|
||||
floorName: '',
|
||||
roomNo: '',
|
||||
stuNo: '',
|
||||
isDormitoryHead: '',
|
||||
checkinTime: '',
|
||||
photo: ''
|
||||
};
|
||||
uni.redirectTo({
|
||||
url: `/pages/dormitory/studentDormInfo/index`
|
||||
})
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.form-container {
|
||||
padding: 30rpx;
|
||||
background-color: #fff;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.form-title {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.form-desc {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
text-align: center;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.form-item {
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.item-label {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
margin-bottom: 16rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
// 红色*号样式
|
||||
.required {
|
||||
color: #ff4d4f;
|
||||
margin-right: 6rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.item-desc {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
// 下拉框样式
|
||||
.picker-input {
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
border: 1px solid #eee;
|
||||
border-radius: 8rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 20rpx;
|
||||
box-sizing: border-box;
|
||||
font-size: 28rpx;
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
|
||||
// 输入框样式
|
||||
.input {
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
border: 1px solid #eee;
|
||||
border-radius: 8rpx;
|
||||
padding: 0 20rpx;
|
||||
box-sizing: border-box;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
// 图片上传样式
|
||||
.upload-btn {
|
||||
width: 200rpx;
|
||||
height: 80rpx;
|
||||
border: 1px dashed #ccc;
|
||||
border-radius: 8rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 10rpx;
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.upload-icon {
|
||||
font-size: 40rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.upload-tip {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.upload-preview {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
border-radius: 8rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.upload-preview image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
// 提交按钮样式
|
||||
.submit-btn {
|
||||
width: 100%;
|
||||
height: 90rpx;
|
||||
background-color: #1890ff;
|
||||
color: #fff;
|
||||
font-size: 32rpx;
|
||||
border-radius: 45rpx;
|
||||
margin-top: 60rpx;
|
||||
}
|
||||
</style>
|
||||
BIN
static/images/workbench/studentDormInfo.png
Normal file
BIN
static/images/workbench/studentDormInfo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.0 KiB |
Reference in New Issue
Block a user