提交代码

This commit is contained in:
zlwu committed 2025-09-08 21:40:29 +08:00
1 parent 9d03266e3a
commit 57e4d79721
19 files changed
+5028 -216

No files matched your search

@@ -0,0 +1,81 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DormApplicationVO, DormApplicationForm, DormApplicationQuery, StudentOptionVO, StudentOptionQuery } from './types';
/**
* 查询学生宿舍申请单表(调宿+退宿)列表
* @param query
* @returns {*}
*/
export const listDormApplication = (query?: DormApplicationQuery): AxiosPromise<DormApplicationVO[]> => {
return request({
url: '/dormApplication/dormApplication/list',
method: 'get',
params: query
});
};
/**
* 查询学生宿舍申请单表(调宿+退宿)详细
* @param id
*/
export const getDormApplication = (id: string | number): AxiosPromise<DormApplicationVO> => {
return request({
url: '/dormApplication/dormApplication/' + id,
method: 'get'
});
};
/**
* 新增学生宿舍申请单表(调宿+退宿)
* @param data
*/
export const addDormApplication = (data: DormApplicationForm) => {
return request({
url: '/dormApplication/dormApplication',
method: 'post',
data: data
});
};
/**
* 修改学生宿舍申请单表(调宿+退宿)
* @param data
*/
export const updateDormApplication = (data: DormApplicationForm) => {
return request({
url: '/dormApplication/dormApplication',
method: 'put',
data: data
});
};
/**
* 删除学生宿舍申请单表(调宿+退宿)
* @param id
*/
export const delDormApplication = (id: string | number | Array<string | number>) => {
return request({
url: '/dormApplication/dormApplication/' + id,
method: 'delete'
});
};
/**
* 获取学生选择器选项列表(支持按学号、姓名检索)
* @param query 查询参数
* @returns 学生选项列表
*/
export const getStudentOptions = (
query?: StudentOptionQuery
): AxiosPromise<{
total: number;
rows: StudentOptionVO[];
}> => {
return request({
url: '/holidayStay/holidayStay/studentOptions',
method: 'get',
params: query
});
};
+586
View File
@@ -0,0 +1,586 @@
export interface PageQuery {
pageNum?: number;
pageSize?: number;
}
export interface DormApplicationVO {
/**
* 主键ID(雪花ID)
*/
id: string | number;
/**
* 申请名称
*/
applicationName: string;
/**
* 申请类型(1:调宿申请 2:退宿申请)
*/
applicationType: string;
/**
* 审批状态:cancel-已撤销 , draft-草稿, waiting-待审核, finish-已完成, invalid-已作废, back-已退回, termination-已终止
*/
applicationStatus: string;
/**
* 申请学生ID
*/
studentId: string | number;
/**
* 学号
*/
studentNo: string;
/**
* 学生姓名
*/
studentName: string;
/**
* 学生联系电话
*/
studentPhone: string;
/**
* 学院ID
*/
collegeId: string | number;
/**
* 学院名称
*/
collegeName: string;
/**
* 专业ID
*/
majorId: string | number;
/**
* 专业名称
*/
majorName: string;
/**
* 班级ID
*/
classId: string | number;
/**
* 班级名称
*/
className: string;
/**
* 当前校区ID
*/
currentCampusId: string | number;
/**
* 当前校区名称
*/
currentCampusName: string;
/**
* 当前宿舍楼ID
*/
currentBuildingId: string | number;
/**
* 当前宿舍楼名称
*/
currentBuildingName: string;
/**
* 当前房间ID
*/
currentRoomId: string | number;
/**
* 当前房间号
*/
currentRoomNo: string;
/**
* 当前床位ID
*/
currentBedId: string | number;
/**
* 当前床位号
*/
currentBedNo: string;
/**
* 目标校区ID
*/
targetCampusId: string | number;
/**
* 目标校区名称
*/
targetCampusName: string;
/**
* 目标宿舍楼ID
*/
targetBuildingId: string | number;
/**
* 目标宿舍楼名称
*/
targetBuildingName: string;
/**
* 目标房间ID
*/
targetRoomId: string | number;
/**
* 目标房间号
*/
targetRoomNo: string;
/**
* 目标床位ID
*/
targetBedId: string | number;
/**
* 目标床位号
*/
targetBedNo: string;
/**
* 详细原因说明
*/
reasonDetail: string;
/**
* 申请时间
*/
applyTime: string;
/**
* 附件OSS文件ID,多个用逗号分隔
*/
attachmentOssIds: string;
/**
* 备注信息
*/
remark: string;
/**
* 扩展字段1
*/
extField1: string;
/**
* 扩展字段2
*/
extField2: string;
/**
* 扩展字段3
*/
extField3: string;
/**
* 删除标志(0代表存在 1代表删除)
*/
deleted: string;
/**
* 创建者
*/
createBy: string | number;
/**
* 创建时间
*/
createTime: string;
/**
* 更新者
*/
updateBy: string | number;
/**
* 更新时间
*/
updateTime: string;
}
export interface DormApplicationForm {
/**
* 主键ID(雪花ID)
*/
id?: string | number;
/**
* 申请名称
*/
applicationName?: string;
/**
* 申请类型(1:调宿申请 2:退宿申请)
*/
applicationType?: string;
/**
* 审批状态:cancel-已撤销 , draft-草稿, waiting-待审核, finish-已完成, invalid-已作废, back-已退回, termination-已终止
*/
applicationStatus?: string;
/**
* 申请学生ID
*/
studentId?: string | number;
/**
* 学号
*/
studentNo?: string;
/**
* 学生姓名
*/
studentName?: string;
/**
* 学生联系电话
*/
studentPhone?: string;
/**
* 学院ID
*/
collegeId?: string | number;
/**
* 学院名称
*/
collegeName?: string;
/**
* 专业ID
*/
majorId?: string | number;
/**
* 专业名称
*/
majorName?: string;
/**
* 班级ID
*/
classId?: string | number;
/**
* 班级名称
*/
className?: string;
/**
* 当前校区ID
*/
currentCampusId?: string | number;
/**
* 当前校区名称
*/
currentCampusName?: string;
/**
* 当前宿舍楼ID
*/
currentBuildingId?: string | number;
/**
* 当前宿舍楼名称
*/
currentBuildingName?: string;
/**
* 当前房间ID
*/
currentRoomId?: string | number;
/**
* 当前房间号
*/
currentRoomNo?: string;
/**
* 当前床位ID
*/
currentBedId?: string | number;
/**
* 当前床位号
*/
currentBedNo?: string;
/**
* 目标校区ID
*/
targetCampusId?: string | number;
/**
* 目标校区名称
*/
targetCampusName?: string;
/**
* 目标宿舍楼ID
*/
targetBuildingId?: string | number;
/**
* 目标宿舍楼名称
*/
targetBuildingName?: string;
/**
* 目标房间ID
*/
targetRoomId?: string | number;
/**
* 目标房间号
*/
targetRoomNo?: string;
/**
* 目标床位ID
*/
targetBedId?: string | number;
/**
* 目标床位号
*/
targetBedNo?: string;
/**
* 详细原因说明
*/
reasonDetail?: string;
/**
* 申请时间
*/
applyTime?: string;
/**
* 附件OSS文件ID,多个用逗号分隔
*/
attachmentOssIds?: string;
/**
* 紧急联系人姓名
*/
emergencyContact?: string;
/**
* 紧急联系人电话
*/
emergencyPhone?: string;
/**
* 备注信息
*/
remark?: string;
/**
* 扩展字段1
*/
extField1?: string;
/**
* 扩展字段2
*/
extField2?: string;
/**
* 扩展字段3
*/
extField3?: string;
}
export interface DormApplicationQuery extends PageQuery {
/**
* 申请名称
*/
applicationName?: string;
/**
* 申请类型(1:调宿申请 2:退宿申请)
*/
applicationType?: string;
/**
* 审批状态:cancel-已撤销 , draft-草稿, waiting-待审核, finish-已完成, invalid-已作废, back-已退回, termination-已终止
*/
applicationStatus?: string;
/**
* 申请学生ID
*/
studentId?: string | number;
/**
* 学号
*/
studentNo?: string;
/**
* 学生姓名
*/
studentName?: string;
/**
* 学生联系电话
*/
studentPhone?: string;
/**
* 学院ID
*/
collegeId?: string | number;
/**
* 学院名称
*/
collegeName?: string;
/**
* 专业ID
*/
majorId?: string | number;
/**
* 专业名称
*/
majorName?: string;
/**
* 班级ID
*/
classId?: string | number;
/**
* 班级名称
*/
className?: string;
/**
* 申请时间
*/
applyTime?: string;
/**
* 日期范围参数
*/
params?: any;
}
/**
* 学生选择器选项
*/
export interface StudentOptionVO {
/**
* 学生ID
*/
id: string | number;
/**
* 学号
*/
studentNo: string;
/**
* 学生姓名
*/
name: string;
/**
* 性别:0-男,1-女
*/
gender: string;
/**
* 学院ID
*/
collegeId?: string | number;
/**
* 学院名称
*/
collegeName?: string;
/**
* 专业ID
*/
majorId?: string | number;
/**
* 专业名称
*/
majorName?: string;
/**
* 班级ID
*/
classId?: string | number;
/**
* 班级名称
*/
className?: string;
/**
* 学生联系电话
*/
phone?: string;
/**
* 宿舍信息
*/
dormInfo?: {
campusId?: string | number;
campusName?: string;
areaId?: string | number;
areaName?: string;
buildingId?: string | number;
buildingName?: string;
roomId?: string | number;
roomName?: string;
bedId?: string | number;
bedName?: string;
};
}
/**
* 学生选择器查询参数
*/
export interface StudentOptionQuery {
/**
* 搜索关键字(学号或姓名)
*/
keyword?: string;
/**
* 页码
*/
pageNum?: number;
/**
* 每页大小
*/
pageSize?: number;
}
@@ -545,23 +545,6 @@
<el-option v-for="campus in campusOptions" :key="campus.id" :label="campus.campusName" :value="campus.id" />
</el-select>
</el-form-item>
<el-form-item label="宿舍区ID" prop="areaId" v-if="false">
<el-input v-model="form.areaId" placeholder="请输入宿舍区ID" />
</el-form-item>
<el-form-item label="宿舍区名称" prop="areaId">
<el-select
v-model="form.areaId"
placeholder="请选择宿舍区"
clearable
filterable
:loading="dormLoading"
@change="handleAreaChange"
style="width: 100%"
:disabled="!form.campusId"
>
<el-option v-for="area in areaOptions" :key="area.id" :label="area.areaName" :value="area.id" />
</el-select>
</el-form-item>
<el-form-item label="宿舍楼ID" prop="buildingId" v-if="false">
<el-input v-model="form.buildingId" placeholder="请输入宿舍楼ID" />
</el-form-item>
@@ -574,7 +557,7 @@
:loading="dormLoading"
@change="handleBuildingChange"
style="width: 100%"
:disabled="!form.areaId"
:disabled="!form.campusId"
>
<el-option v-for="building in buildingOptions" :key="building.id" :label="building.buildingName" :value="building.id" />
</el-select>
@@ -849,7 +832,6 @@ const studentSelectVisible = ref(false);
// 宿舍级联选择器相关状态
const campusOptions = ref<CampusOptionVO[]>([]);
const areaOptions = ref<AreaOptionVO[]>([]);
const buildingOptions = ref<BuildingOptionVO[]>([]);
const roomOptions = ref<RoomOptionVO[]>([]);
const bedOptions = ref<BedOptionVO[]>([]);
@@ -880,8 +862,6 @@ const initFormData: HolidayStayForm = {
collegeName: undefined,
campusId: undefined,
campusName: undefined,
areaId: undefined,
areaName: undefined,
buildingId: undefined,
buildingName: undefined,
roomId: undefined,
@@ -920,8 +900,6 @@ const data = reactive<PageData<HolidayStayForm, HolidayStayQuery>>({
collegeName: undefined,
campusId: undefined,
campusName: undefined,
areaId: undefined,
areaName: undefined,
buildingId: undefined,
buildingName: undefined,
roomId: undefined,
@@ -1111,7 +1089,6 @@ const reset = () => {
holidayStayFormRef.value?.resetFields();
// 清空宿舍级联选项
areaOptions.value = [];
buildingOptions.value = [];
roomOptions.value = [];
bedOptions.value = [];
@@ -1170,8 +1147,6 @@ const handleUpdate = async (row?: HolidayStayVO) => {
dormInfo: {
campusId: form.value.campusId,
campusName: form.value.campusName,
areaId: form.value.areaId,
areaName: form.value.areaName,
buildingId: form.value.buildingId,
buildingName: form.value.buildingName,
roomId: form.value.roomId,
@@ -1335,8 +1310,6 @@ const handleStudentChange = async (studentId: string | number) => {
// 清空宿舍信息及选项
form.value.campusId = undefined;
form.value.campusName = undefined;
form.value.areaId = undefined;
form.value.areaName = undefined;
form.value.buildingId = undefined;
form.value.buildingName = undefined;
form.value.roomId = undefined;
@@ -1344,7 +1317,6 @@ const handleStudentChange = async (studentId: string | number) => {
form.value.bedId = undefined;
form.value.bedName = undefined;
areaOptions.value = [];
buildingOptions.value = [];
roomOptions.value = [];
bedOptions.value = [];
@@ -1372,8 +1344,6 @@ const handleStudentChange = async (studentId: string | number) => {
// 填充宿舍信息
form.value.campusId = selectedStudent.dormInfo.campusId;
form.value.campusName = selectedStudent.dormInfo.campusName;
form.value.areaId = selectedStudent.dormInfo.areaId;
form.value.areaName = selectedStudent.dormInfo.areaName;
form.value.buildingId = selectedStudent.dormInfo.buildingId;
form.value.buildingName = selectedStudent.dormInfo.buildingName;
form.value.roomId = selectedStudent.dormInfo.roomId;
@@ -1384,17 +1354,13 @@ const handleStudentChange = async (studentId: string | number) => {
// 级联加载对应的选项
try {
if (selectedStudent.dormInfo.campusId) {
await loadAreaOptions(selectedStudent.dormInfo.campusId);
await loadBuildingOptions(selectedStudent.dormInfo.campusId);
if (selectedStudent.dormInfo.areaId) {
await loadBuildingOptions(selectedStudent.dormInfo.areaId);
if (selectedStudent.dormInfo.buildingId) {
await loadRoomOptions(selectedStudent.dormInfo.buildingId);
if (selectedStudent.dormInfo.buildingId) {
await loadRoomOptions(selectedStudent.dormInfo.buildingId);
if (selectedStudent.dormInfo.roomId) {
await loadBedOptions(selectedStudent.dormInfo.roomId);
}
if (selectedStudent.dormInfo.roomId) {
await loadBedOptions(selectedStudent.dormInfo.roomId);
}
}
}
@@ -1405,8 +1371,6 @@ const handleStudentChange = async (studentId: string | number) => {
// 如果宿舍信息为空,清空宿舍相关字段
form.value.campusId = undefined;
form.value.campusName = undefined;
form.value.areaId = undefined;
form.value.areaName = undefined;
form.value.buildingId = undefined;
form.value.buildingName = undefined;
form.value.roomId = undefined;
@@ -1414,7 +1378,6 @@ const handleStudentChange = async (studentId: string | number) => {
form.value.bedId = undefined;
form.value.bedName = undefined;
areaOptions.value = [];
buildingOptions.value = [];
roomOptions.value = [];
bedOptions.value = [];
@@ -1426,7 +1389,10 @@ const handleStudentChange = async (studentId: string | number) => {
const loadCampusOptions = async () => {
try {
dormLoading.value = true;
const res = await getCampusOptions();
const res = await request({
url: '/xqxx/dormCampus/list',
method: 'get'
});
campusOptions.value = res.rows || [];
} catch (error) {
console.error('加载校区选项失败:', error);
@@ -1440,8 +1406,6 @@ const loadCampusOptions = async () => {
const handleCampusChange = async (campusId: string | number) => {
console.log('校区选择变化处理', campusId);
// 清空下级选项
form.value.areaId = undefined;
form.value.areaName = undefined;
form.value.buildingId = undefined;
form.value.buildingName = undefined;
form.value.roomId = undefined;
@@ -1449,7 +1413,6 @@ const handleCampusChange = async (campusId: string | number) => {
form.value.bedId = undefined;
form.value.bedName = undefined;
areaOptions.value = [];
buildingOptions.value = [];
roomOptions.value = [];
bedOptions.value = [];
@@ -1462,63 +1425,23 @@ const handleCampusChange = async (campusId: string | number) => {
form.value.campusName = selectedCampus.campusName;
}
// 加载宿舍区选项
await loadAreaOptions(campusId);
// 直接加载宿舍楼选项
await loadBuildingOptions(campusId);
} else {
form.value.campusId = undefined;
form.value.campusName = undefined;
}
};
/** 加载宿舍区选项 */
const loadAreaOptions = async (campusId: string | number) => {
try {
dormLoading.value = true;
const res = await getAreaOptions(campusId);
areaOptions.value = res.rows || [];
} catch (error) {
console.error('加载宿舍区选项失败:', error);
areaOptions.value = [];
} finally {
dormLoading.value = false;
}
};
/** 宿舍区选择变化处理 */
const handleAreaChange = async (areaId: string | number) => {
// 清空下级选项
form.value.buildingId = undefined;
form.value.buildingName = undefined;
form.value.roomId = undefined;
form.value.roomName = undefined;
form.value.bedId = undefined;
form.value.bedName = undefined;
buildingOptions.value = [];
roomOptions.value = [];
bedOptions.value = [];
if (areaId) {
// 设置宿舍区名称
const selectedArea = areaOptions.value.find((area) => area.id === areaId);
if (selectedArea) {
form.value.areaId = areaId;
form.value.areaName = selectedArea.areaName;
}
// 加载宿舍楼选项
await loadBuildingOptions(areaId);
} else {
form.value.areaId = undefined;
form.value.areaName = undefined;
}
};
/** 加载宿舍楼选项 */
const loadBuildingOptions = async (areaId: string | number) => {
const loadBuildingOptions = async (campusId: string | number) => {
try {
dormLoading.value = true;
const res = await getBuildingOptions(areaId);
const res = await request({
url: '/sslxx/dormBuilding/list',
method: 'get',
params: { campusId }
});
buildingOptions.value = res.rows || [];
} catch (error) {
console.error('加载宿舍楼选项失败:', error);
@@ -1625,22 +1548,17 @@ const handleBedChange = (bedId: string | number) => {
/** 修改时级联加载宿舍选项数据 */
const loadCascadeOptionsForUpdate = async (formData: HolidayStayForm) => {
try {
// 如果有校区ID,加载宿舍区选项
// 如果有校区ID,加载宿舍楼选项
if (formData.campusId) {
await loadAreaOptions(formData.campusId);
await loadBuildingOptions(formData.campusId);
// 如果有宿舍区ID,加载宿舍楼选项
if (formData.areaId) {
await loadBuildingOptions(formData.areaId);
// 如果有宿舍楼ID,加载房间选项
if (formData.buildingId) {
await loadRoomOptions(formData.buildingId);
// 如果有宿舍楼ID,加载房间选项
if (formData.buildingId) {
await loadRoomOptions(formData.buildingId);
// 如果有房间ID,加载床位选项
if (formData.roomId) {
await loadBedOptions(formData.roomId);
}
// 如果有房间ID,加载床位选项
if (formData.roomId) {
await loadBedOptions(formData.roomId);
}
}
}
@@ -337,23 +337,6 @@
<el-option v-for="campus in campusOptions" :key="campus.id" :label="campus.campusName" :value="campus.id" />
</el-select>
</el-form-item>
<el-form-item label="宿舍区ID" prop="areaId" v-if="false">
<el-input v-model="form.areaId" placeholder="请输入宿舍区ID" />
</el-form-item>
<el-form-item label="宿舍区名称" prop="areaId">
<el-select
v-model="form.areaId"
placeholder="请选择宿舍区"
clearable
filterable
:loading="dormLoading"
@change="handleAreaChange"
style="width: 100%"
:disabled="!form.campusId"
>
<el-option v-for="area in areaOptions" :key="area.id" :label="area.areaName" :value="area.id" />
</el-select>
</el-form-item>
<el-form-item label="宿舍楼ID" prop="buildingId" v-if="false">
<el-input v-model="form.buildingId" placeholder="请输入宿舍楼ID" />
</el-form-item>
@@ -366,7 +349,7 @@
:loading="dormLoading"
@change="handleBuildingChange"
style="width: 100%"
:disabled="!form.areaId"
:disabled="!form.campusId"
>
<el-option v-for="building in buildingOptions" :key="building.id" :label="building.buildingName" :value="building.id" />
</el-select>
@@ -631,7 +614,6 @@ const studentSelectVisible = ref(false);
// 宿舍级联选择器相关状态
const campusOptions = ref<CampusOptionVO[]>([]);
const areaOptions = ref<AreaOptionVO[]>([]);
const buildingOptions = ref<BuildingOptionVO[]>([]);
const roomOptions = ref<RoomOptionVO[]>([]);
const bedOptions = ref<BedOptionVO[]>([]);
@@ -662,8 +644,6 @@ const initFormData: HolidayStayForm = {
collegeName: undefined,
campusId: undefined,
campusName: undefined,
areaId: undefined,
areaName: undefined,
buildingId: undefined,
buildingName: undefined,
roomId: undefined,
@@ -702,8 +682,6 @@ const data = reactive<PageData<HolidayStayForm, HolidayStayQuery>>({
collegeName: undefined,
campusId: undefined,
campusName: undefined,
areaId: undefined,
areaName: undefined,
buildingId: undefined,
buildingName: undefined,
roomId: undefined,
@@ -813,7 +791,6 @@ const reset = () => {
holidayStayFormRef.value?.resetFields();
// 清空宿舍级联选项
areaOptions.value = [];
buildingOptions.value = [];
roomOptions.value = [];
bedOptions.value = [];
@@ -872,8 +849,6 @@ const handleUpdate = async (row?: HolidayStayVO) => {
dormInfo: {
campusId: form.value.campusId,
campusName: form.value.campusName,
areaId: form.value.areaId,
areaName: form.value.areaName,
buildingId: form.value.buildingId,
buildingName: form.value.buildingName,
roomId: form.value.roomId,
@@ -1037,8 +1012,6 @@ const handleStudentChange = async (studentId: string | number) => {
// 清空宿舍信息及选项
form.value.campusId = undefined;
form.value.campusName = undefined;
form.value.areaId = undefined;
form.value.areaName = undefined;
form.value.buildingId = undefined;
form.value.buildingName = undefined;
form.value.roomId = undefined;
@@ -1046,7 +1019,6 @@ const handleStudentChange = async (studentId: string | number) => {
form.value.bedId = undefined;
form.value.bedName = undefined;
areaOptions.value = [];
buildingOptions.value = [];
roomOptions.value = [];
bedOptions.value = [];
@@ -1074,8 +1046,6 @@ const handleStudentChange = async (studentId: string | number) => {
// 填充宿舍信息
form.value.campusId = selectedStudent.dormInfo.campusId;
form.value.campusName = selectedStudent.dormInfo.campusName;
form.value.areaId = selectedStudent.dormInfo.areaId;
form.value.areaName = selectedStudent.dormInfo.areaName;
form.value.buildingId = selectedStudent.dormInfo.buildingId;
form.value.buildingName = selectedStudent.dormInfo.buildingName;
form.value.roomId = selectedStudent.dormInfo.roomId;
@@ -1086,17 +1056,13 @@ const handleStudentChange = async (studentId: string | number) => {
// 级联加载对应的选项
try {
if (selectedStudent.dormInfo.campusId) {
await loadAreaOptions(selectedStudent.dormInfo.campusId);
await loadBuildingOptions(selectedStudent.dormInfo.campusId);
if (selectedStudent.dormInfo.areaId) {
await loadBuildingOptions(selectedStudent.dormInfo.areaId);
if (selectedStudent.dormInfo.buildingId) {
await loadRoomOptions(selectedStudent.dormInfo.buildingId);
if (selectedStudent.dormInfo.buildingId) {
await loadRoomOptions(selectedStudent.dormInfo.buildingId);
if (selectedStudent.dormInfo.roomId) {
await loadBedOptions(selectedStudent.dormInfo.roomId);
}
if (selectedStudent.dormInfo.roomId) {
await loadBedOptions(selectedStudent.dormInfo.roomId);
}
}
}
@@ -1107,8 +1073,6 @@ const handleStudentChange = async (studentId: string | number) => {
// 如果宿舍信息为空,清空宿舍相关字段
form.value.campusId = undefined;
form.value.campusName = undefined;
form.value.areaId = undefined;
form.value.areaName = undefined;
form.value.buildingId = undefined;
form.value.buildingName = undefined;
form.value.roomId = undefined;
@@ -1116,7 +1080,6 @@ const handleStudentChange = async (studentId: string | number) => {
form.value.bedId = undefined;
form.value.bedName = undefined;
areaOptions.value = [];
buildingOptions.value = [];
roomOptions.value = [];
bedOptions.value = [];
@@ -1128,7 +1091,10 @@ const handleStudentChange = async (studentId: string | number) => {
const loadCampusOptions = async () => {
try {
dormLoading.value = true;
const res = await getCampusOptions();
const res = await request({
url: '/xqxx/dormCampus/list',
method: 'get'
});
campusOptions.value = res.rows || [];
} catch (error) {
console.error('加载校区选项失败:', error);
@@ -1142,8 +1108,6 @@ const loadCampusOptions = async () => {
const handleCampusChange = async (campusId: string | number) => {
console.log('校区选择变化处理', campusId);
// 清空下级选项
form.value.areaId = undefined;
form.value.areaName = undefined;
form.value.buildingId = undefined;
form.value.buildingName = undefined;
form.value.roomId = undefined;
@@ -1151,7 +1115,6 @@ const handleCampusChange = async (campusId: string | number) => {
form.value.bedId = undefined;
form.value.bedName = undefined;
areaOptions.value = [];
buildingOptions.value = [];
roomOptions.value = [];
bedOptions.value = [];
@@ -1164,63 +1127,23 @@ const handleCampusChange = async (campusId: string | number) => {
form.value.campusName = selectedCampus.campusName;
}
// 加载宿舍区选项
await loadAreaOptions(campusId);
// 直接加载宿舍楼选项
await loadBuildingOptions(campusId);
} else {
form.value.campusId = undefined;
form.value.campusName = undefined;
}
};
/** 加载宿舍区选项 */
const loadAreaOptions = async (campusId: string | number) => {
try {
dormLoading.value = true;
const res = await getAreaOptions(campusId);
areaOptions.value = res.rows || [];
} catch (error) {
console.error('加载宿舍区选项失败:', error);
areaOptions.value = [];
} finally {
dormLoading.value = false;
}
};
/** 宿舍区选择变化处理 */
const handleAreaChange = async (areaId: string | number) => {
// 清空下级选项
form.value.buildingId = undefined;
form.value.buildingName = undefined;
form.value.roomId = undefined;
form.value.roomName = undefined;
form.value.bedId = undefined;
form.value.bedName = undefined;
buildingOptions.value = [];
roomOptions.value = [];
bedOptions.value = [];
if (areaId) {
// 设置宿舍区名称
const selectedArea = areaOptions.value.find((area) => area.id === areaId);
if (selectedArea) {
form.value.areaId = areaId;
form.value.areaName = selectedArea.areaName;
}
// 加载宿舍楼选项
await loadBuildingOptions(areaId);
} else {
form.value.areaId = undefined;
form.value.areaName = undefined;
}
};
/** 加载宿舍楼选项 */
const loadBuildingOptions = async (areaId: string | number) => {
const loadBuildingOptions = async (campusId: string | number) => {
try {
dormLoading.value = true;
const res = await getBuildingOptions(areaId);
const res = await request({
url: '/sslxx/dormBuilding/list',
method: 'get',
params: { campusId }
});
buildingOptions.value = res.rows || [];
} catch (error) {
console.error('加载宿舍楼选项失败:', error);
@@ -1327,22 +1250,17 @@ const handleBedChange = (bedId: string | number) => {
/** 修改时级联加载宿舍选项数据 */
const loadCascadeOptionsForUpdate = async (formData: HolidayStayForm) => {
try {
// 如果有校区ID,加载宿舍区选项
// 如果有校区ID,加载宿舍楼选项
if (formData.campusId) {
await loadAreaOptions(formData.campusId);
await loadBuildingOptions(formData.campusId);
// 如果有宿舍区ID,加载宿舍楼选项
if (formData.areaId) {
await loadBuildingOptions(formData.areaId);
// 如果有宿舍楼ID,加载房间选项
if (formData.buildingId) {
await loadRoomOptions(formData.buildingId);
// 如果有宿舍楼ID,加载房间选项
if (formData.buildingId) {
await loadRoomOptions(formData.buildingId);
// 如果有房间ID,加载床位选项
if (formData.roomId) {
await loadBedOptions(formData.roomId);
}
// 如果有房间ID,加载床位选项
if (formData.roomId) {
await loadBedOptions(formData.roomId);
}
}
}
File diff suppressed because it is too large. Load diff
+369
View File
@@ -0,0 +1,369 @@
<template>
<div class="p-2 page-container">
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :model="queryParams" label-width="100px">
<el-row :gutter="20">
<el-col :span="6">
<el-form-item label="学生姓名" prop="studentName">
<el-input v-model="queryParams.studentName" placeholder="请输入学生姓名" clearable @keyup.enter="handleQuery" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="学号" prop="studentNo">
<el-input v-model="queryParams.studentNo" placeholder="请输入学号" clearable @keyup.enter="handleQuery" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="学院名称" prop="collegeName">
<el-input v-model="queryParams.collegeName" placeholder="请输入学院名称" clearable @keyup.enter="handleQuery" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="专业名称" prop="majorName">
<el-input v-model="queryParams.majorName" placeholder="请输入专业名称" clearable @keyup.enter="handleQuery" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6">
<el-form-item label="班级名称" prop="className">
<el-input v-model="queryParams.className" placeholder="请输入班级名称" clearable @keyup.enter="handleQuery" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="申请类型" prop="applicationType">
<el-select v-model="queryParams.applicationType" placeholder="请选择申请类型" clearable style="width: 100%">
<el-option label="调宿申请" value="1" />
<el-option label="退宿申请" value="2" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="申请时间" prop="applyTime">
<el-date-picker
clearable
v-model="queryParams.applyTime"
type="date"
style="width: 100%"
value-format="YYYY-MM-DD"
placeholder="请选择申请时间"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="审批状态" prop="applicationStatus">
<el-select v-model="queryParams.applicationStatus" placeholder="请选择审批状态" clearable style="width: 100%">
<el-option label="草稿" value="draft" />
<el-option label="待审核" value="waiting" />
<el-option label="已完成" value="finish" />
<el-option label="已撤销" value="cancel" />
<el-option label="已退回" value="back" />
<el-option label="已作废" value="invalid" />
<el-option label="已终止" value="termination" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24" class="search-btn-container">
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
</div>
</transition>
<el-card shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['dormApplication:dormApplication:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="Edit"
:disabled="single"
@click="handleUpdate()"
v-hasPermi="['dormApplication:dormApplication:edit']"
>修改</el-button
>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" border :data="dormApplicationList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键ID" align="center" prop="id" v-if="false" />
<el-table-column label="申请名称" align="center" prop="applicationName" />
<el-table-column label="申请类型" align="center" prop="applicationType">
<template #default="scope">
<dict-tag :options="dorm_application_type" :value="scope.row.applicationType" />
</template>
</el-table-column>
<el-table-column label="学院名称" align="center" prop="collegeName" />
<el-table-column label="专业名称" align="center" prop="majorName" />
<el-table-column label="班级名称" align="center" prop="className" />
<el-table-column label="学生姓名" align="center" prop="studentName" />
<el-table-column label="学号" align="center" prop="studentNo" />
<el-table-column label="申请时间" align="center" prop="applyTime" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.applyTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="审批状态" align="center" prop="applicationStatus">
<template #default="scope">
<dict-tag :options="student_leave_approval_status" :value="scope.row.applicationStatus" />
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="200px" class-name="small-padding fixed-width" fixed="right">
<template #default="scope">
<el-tooltip :content="['draft', 'cancel', 'back'].includes(scope.row.applicationStatus) ? '修改' : '查看'" placement="top">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['dormApplication:dormApplication:edit']">
{{ ['draft', 'cancel', 'back'].includes(scope.row.applicationStatus) ? '修改' : '查看' }}
</el-button>
</el-tooltip>
<!-- 删除按钮:仅草稿状态可见 -->
<el-tooltip content="删除" placement="top" v-if="scope.row.applicationStatus === 'draft'">
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['dormApplication:dormApplication:remove']"
>删除</el-button
>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
</el-card>
</div>
</template>
<script setup name="DormApplication" lang="ts">
import { ref, reactive, toRefs, onMounted, getCurrentInstance, type ComponentInternalInstance } from 'vue';
import {
listDormApplication,
getDormApplication,
delDormApplication,
addDormApplication,
updateDormApplication
} from '@/api/xg/xsjcxx/xssssq/dormApplication';
import { DormApplicationVO, DormApplicationQuery, DormApplicationForm } from '@/api/xg/xsjcxx/xssssq/types';
// 类型定义
interface DialogOption {
visible: boolean;
title: string;
}
interface ElFormInstance {
validate: (callback?: (valid: boolean) => void) => Promise<boolean>;
resetFields: () => void;
}
interface PageData<T, Q> {
form: T;
queryParams: Q;
rules: Record<string, any>;
}
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
// 加载字典数据
const { dorm_application_type, student_leave_approval_status } = toRefs<any>(
proxy?.useDict('dorm_application_type', 'student_leave_approval_status')
);
const dormApplicationList = ref<DormApplicationVO[]>([]);
const buttonLoading = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const dormApplicationFormRef = ref<ElFormInstance>();
const dialog = reactive<DialogOption>({
visible: false,
title: ''
});
const initFormData: DormApplicationForm = {
id: undefined,
applicationName: undefined,
applicationType: undefined,
applicationStatus: undefined,
studentId: undefined,
studentName: undefined,
studentNo: undefined,
studentPhone: undefined,
collegeId: undefined,
collegeName: undefined,
majorId: undefined,
majorName: undefined,
classId: undefined,
className: undefined,
currentCampusId: undefined,
currentCampusName: undefined,
currentBuildingId: undefined,
currentBuildingName: undefined,
currentRoomId: undefined,
currentRoomNo: undefined,
currentBedId: undefined,
currentBedNo: undefined,
targetCampusId: undefined,
targetCampusName: undefined,
targetBuildingId: undefined,
targetBuildingName: undefined,
targetRoomId: undefined,
targetRoomNo: undefined,
targetBedId: undefined,
targetBedNo: undefined,
reasonDetail: undefined,
applyTime: undefined,
attachmentOssIds: undefined,
remark: undefined,
extField1: undefined,
extField2: undefined,
extField3: undefined
};
const data = reactive<PageData<DormApplicationForm, DormApplicationQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
applicationName: undefined,
applicationType: undefined,
applicationStatus: undefined,
studentId: undefined,
studentName: undefined,
studentNo: undefined,
studentPhone: undefined,
collegeId: undefined,
collegeName: undefined,
majorId: undefined,
majorName: undefined,
classId: undefined,
className: undefined,
applyTime: undefined,
params: {}
},
rules: {
id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }],
applicationName: [{ required: true, message: '申请名称不能为空', trigger: 'blur' }],
applicationType: [{ required: true, message: '申请类型不能为空', trigger: 'change' }],
studentId: [{ required: true, message: '申请学生ID不能为空', trigger: 'blur' }],
studentName: [{ required: true, message: '学生姓名不能为空', trigger: 'blur' }],
studentNo: [{ required: true, message: '学号不能为空', trigger: 'blur' }],
collegeId: [{ required: true, message: '学院ID不能为空', trigger: 'blur' }],
reasonDetail: [{ required: true, message: '详细原因说明不能为空', trigger: 'blur' }],
applyTime: [{ required: true, message: '申请时间不能为空', trigger: 'blur' }]
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询学生宿舍申请单表(调宿+退宿)列表 */
const getList = async () => {
loading.value = true;
const res = await listDormApplication(queryParams.value);
dormApplicationList.value = res.rows;
total.value = res.total;
loading.value = false;
};
/** 取消按钮 */
const cancel = () => {
reset();
dialog.visible = false;
};
/** 表单重置 */
const reset = () => {
form.value = { ...initFormData };
dormApplicationFormRef.value?.resetFields();
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: DormApplicationVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
/** 新增按钮操作 */
const handleAdd = () => {
proxy.$router.push({
path: `/xg/xsjcxx/xssssq/dialog`,
query: {
type: 'add'
}
});
};
/** 修改按钮操作 */
const handleUpdate = async (row?: DormApplicationVO) => {
const _id = row?.id || ids.value[0];
proxy.$router.push({
path: `/xg/xsjcxx/xssssq/dormEdit/index`,
query: {
id: _id,
type: 'update'
}
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: DormApplicationVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除学生宿舍申请单编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
await delDormApplication(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
onMounted(() => {
getList();
});
</script>
<style scoped>
/* 页面容器样式 */
.page-container {
padding: 8px;
}
/* 搜索按钮容器样式 */
.search-btn-container {
display: flex;
justify-content: flex-end;
margin-top: 10px;
}
.search-btn-container .el-form-item {
margin-bottom: 0 !important;
}
</style>