提交代码
This commit is contained in:
1 parent
59c666a6f4
commit
21856615db
9 files changed
+504
-133
No files matched your search
@@ -84,75 +84,25 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- 学生基础信息展示 -->
|
||||
<div v-if="form.studentId" class="student-info-display">
|
||||
<div class="info-subtitle">学生基础信息</div>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="4">
|
||||
<div class="info-item">
|
||||
<span class="info-label">学生姓名:</span>
|
||||
<span class="info-value">{{ form.studentName || '-' }}</span>
|
||||
<!-- 学生信息和床位信息显示在整行 -->
|
||||
<el-row v-if="form.studentId" :gutter="16">
|
||||
<el-col :span="24">
|
||||
<div class="selected-student-info">
|
||||
<div class="student-info-inline">
|
||||
<div class="info-text">
|
||||
学生信息:{{ form.studentName || '-' }} / {{ form.studentNo || '-' }} / {{ form.collegeName || '-' }} /
|
||||
{{ form.majorName || '-' }} / {{ form.className || '-' }} / {{ form.studentPhone || '-' }}
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="info-item">
|
||||
<span class="info-label">学号:</span>
|
||||
<span class="info-value">{{ form.studentNo || '-' }}</span>
|
||||
<div class="dorm-info-inline" v-if="form.currentCampusName || form.currentBuildingName || form.currentRoomNo || form.currentBedNo">
|
||||
<div class="info-text">
|
||||
床位信息:{{ form.currentCampusName || '-' }} / {{ form.currentBuildingName || '-' }} / {{ form.currentRoomNo || '-' }} /
|
||||
{{ form.currentBedNo || '-' }}
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="info-item">
|
||||
<span class="info-label">班级名称:</span>
|
||||
<span class="info-value">{{ form.className || '-' }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="info-item">
|
||||
<span class="info-label">联系电话:</span>
|
||||
<span class="info-value">{{ form.studentPhone || '-' }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="info-item">
|
||||
<span class="info-label">专业名称:</span>
|
||||
<span class="info-value">{{ form.majorName || '-' }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="info-item">
|
||||
<span class="info-label">学院名称:</span>
|
||||
<span class="info-value">{{ form.collegeName || '-' }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="4">
|
||||
<div class="info-item">
|
||||
<span class="info-label">校区:</span>
|
||||
<span class="info-value">{{ form.currentCampusName || '-' }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="info-item">
|
||||
<span class="info-label">宿舍楼:</span>
|
||||
<span class="info-value">{{ form.currentBuildingName || '-' }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="info-item">
|
||||
<span class="info-label">房间号:</span>
|
||||
<span class="info-value">{{ form.currentRoomNo || '-' }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="info-item">
|
||||
<span class="info-label">床位号:</span>
|
||||
<span class="info-value">{{ form.currentBedNo || '-' }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -256,7 +206,7 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- 目标床位号、紧急联系人、紧急电话一行 -->
|
||||
<!-- 目标床位号 -->
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="6">
|
||||
<el-form-item label="目标床位号" prop="targetBedId">
|
||||
@@ -272,39 +222,34 @@
|
||||
>
|
||||
<el-option v-for="bed in targetBedOptions" :key="bed.id" :label="bed.bedNo || bed.bedName" :value="bed.id" />
|
||||
</el-select>
|
||||
<!-- 目标床位学生信息显示在床位选择下方 -->
|
||||
<div v-if="form.targetBedId && form.targetBedStudentName" class="target-bed-student-inline-info">
|
||||
<div class="student-info-text">
|
||||
学生信息:{{ form.targetBedStudentName || '-' }} / {{ form.targetBedStudentNo || '-' }} /
|
||||
{{ form.targetBedStudentCollegeName || '-' }} / {{ form.targetBedStudentMajorName || '-' }} /
|
||||
{{ form.targetBedStudentClassName || '-' }}
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="紧急联系人" prop="emergencyContact">
|
||||
<el-input v-model="form.emergencyContact" placeholder="请输入紧急联系人" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="紧急电话" prop="emergencyPhone">
|
||||
<el-input v-model="form.emergencyPhone" placeholder="请输入紧急联系电话" />
|
||||
<el-col :span="18">
|
||||
<el-form-item label="申请原因" prop="reasonDetail">
|
||||
<el-input v-model="form.reasonDetail" placeholder="请输入详细的申请原因" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
<!-- 退宿申请时的紧急联系人、紧急电话 -->
|
||||
<!-- 退宿申请时的申请原因 -->
|
||||
<div v-else>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="紧急联系人" prop="emergencyContact">
|
||||
<el-input v-model="form.emergencyContact" placeholder="请输入紧急联系人" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="紧急电话" prop="emergencyPhone">
|
||||
<el-input v-model="form.emergencyPhone" placeholder="请输入紧急联系电话" />
|
||||
<el-col :span="24">
|
||||
<el-form-item label="申请原因" prop="reasonDetail">
|
||||
<el-input v-model="form.reasonDetail" placeholder="请输入详细的申请原因" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<el-form-item label="申请原因" prop="reasonDetail">
|
||||
<el-input v-model="form.reasonDetail" type="textarea" :rows="3" placeholder="请输入详细的申请原因" />
|
||||
</el-form-item>
|
||||
<el-form-item label="上传附件">
|
||||
<div class="attachment-upload-container">
|
||||
<el-upload
|
||||
@@ -519,10 +464,15 @@ const form = reactive<any>({
|
||||
targetRoomNo: '',
|
||||
targetBedId: '',
|
||||
targetBedNo: '',
|
||||
// 目标床位学生信息
|
||||
targetBedStudentId: '',
|
||||
targetBedStudentName: '',
|
||||
targetBedStudentNo: '',
|
||||
targetBedStudentCollegeName: '',
|
||||
targetBedStudentMajorName: '',
|
||||
targetBedStudentClassName: '',
|
||||
applyTime: '',
|
||||
reasonDetail: '',
|
||||
emergencyContact: '',
|
||||
emergencyPhone: '',
|
||||
attachmentOssIds: '',
|
||||
applicationStatus: 'draft',
|
||||
approvalOpinion: '',
|
||||
@@ -924,22 +874,21 @@ const handleStartWorkFlow = async (data: DormApplicationForm) => {
|
||||
let xgcsprIds: number[] = [];
|
||||
|
||||
try {
|
||||
// 获取二级学院审批人(role_key为'ejxyssgly'的角色)
|
||||
// 获取二级学院审批人
|
||||
const ejxysprResponse = await request({
|
||||
url: '/system/user/listByRoleKey',
|
||||
url: '/dormApplication/dormApplication/getCollegeApprovers',
|
||||
method: 'get',
|
||||
params: { roleKey: 'ejxyssgly', collegeId: data.collegeId }
|
||||
params: { collegeId: data.collegeId }
|
||||
});
|
||||
if (ejxysprResponse && ejxysprResponse.data) {
|
||||
ejxysprIds = ejxysprResponse.data.map((user: any) => user.userId);
|
||||
console.log('获取到二级学院审批人列表:', ejxysprIds);
|
||||
}
|
||||
|
||||
// 获取学工处审批人(role_key为'xscxsxxgly'的角色)
|
||||
// 获取学工处审批人
|
||||
const xgcsprResponse = await request({
|
||||
url: '/system/user/listByRoleKey',
|
||||
method: 'get',
|
||||
params: { roleKey: 'xscxsxxgly' }
|
||||
url: '/dormApplication/dormApplication/getStudentAffairsApprovers',
|
||||
method: 'get'
|
||||
});
|
||||
if (xgcsprResponse && xgcsprResponse.data) {
|
||||
xgcsprIds = xgcsprResponse.data.map((user: any) => user.userId);
|
||||
@@ -1087,11 +1036,21 @@ const getDormApplicationInfo = async (id: string | number) => {
|
||||
// 设置状态字段映射
|
||||
form.status = applicationInfo.applicationStatus;
|
||||
|
||||
// 如果有学生ID,则获取学生信息
|
||||
// 如果有学生ID,则获取学生信息并添加到选项中
|
||||
if (applicationInfo.studentId) {
|
||||
await getStudentInfo(applicationInfo.studentId);
|
||||
// 将当前学生添加到学生选项列表中,确保下拉框能正确显示
|
||||
await addCurrentStudentToOptions(applicationInfo.studentId);
|
||||
}
|
||||
|
||||
// 如果有目标学生ID,则将目标学生添加到选项中
|
||||
if (applicationInfo.targetStudentId) {
|
||||
await addCurrentTargetStudentToOptions(applicationInfo.targetStudentId);
|
||||
}
|
||||
|
||||
// 加载目标宿舍级联选项数据(修改时必须调用)
|
||||
await loadTargetCascadeOptionsForUpdate();
|
||||
|
||||
// 处理附件数据
|
||||
await handleAttachmentData();
|
||||
} else {
|
||||
@@ -1349,6 +1308,13 @@ const handleStudentChange = async (value: string | number) => {
|
||||
form.targetRoomNo = '';
|
||||
form.targetBedId = '';
|
||||
form.targetBedNo = '';
|
||||
// 清空目标床位学生信息
|
||||
form.targetBedStudentId = '';
|
||||
form.targetBedStudentName = '';
|
||||
form.targetBedStudentNo = '';
|
||||
form.targetBedStudentCollegeName = '';
|
||||
form.targetBedStudentMajorName = '';
|
||||
form.targetBedStudentClassName = '';
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1402,6 +1368,42 @@ const handleStudentSelectVisibleChange = (visible: boolean) => {
|
||||
}
|
||||
};
|
||||
|
||||
// 将当前学生添加到学生选项列表中(用于数据回显)
|
||||
const addCurrentStudentToOptions = async (studentId: string | number) => {
|
||||
try {
|
||||
console.log('将当前学生添加到选项列表,学生ID:', studentId);
|
||||
const response = await getStudentMsg(studentId);
|
||||
|
||||
if (response.code === 200 && response.data) {
|
||||
const studentInfo = response.data;
|
||||
|
||||
// 检查是否已存在该学生
|
||||
const existingStudent = studentOptions.value.find((student) => student.id === studentId);
|
||||
if (!existingStudent) {
|
||||
// 将学生信息添加到选项列表
|
||||
const studentOption: StudentOptionVO = {
|
||||
id: studentInfo.id,
|
||||
name: studentInfo.name || '',
|
||||
studentNo: studentInfo.studentNo || '',
|
||||
gender: studentInfo.gender || '',
|
||||
phone: studentInfo.phone || '',
|
||||
collegeId: studentInfo.collegeId,
|
||||
collegeName: studentInfo.collegeName || '',
|
||||
majorId: studentInfo.majorId,
|
||||
majorName: studentInfo.majorName || '',
|
||||
classId: studentInfo.classId,
|
||||
className: studentInfo.className || ''
|
||||
};
|
||||
|
||||
studentOptions.value = [studentOption];
|
||||
console.log('当前学生已添加到选项列表:', studentOption);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('添加当前学生到选项列表失败:', error);
|
||||
}
|
||||
};
|
||||
|
||||
// ==================== 目标学生选择相关方法 ====================
|
||||
|
||||
// 目标学生下拉框远程搜索
|
||||
@@ -1445,6 +1447,42 @@ const handleTargetStudentSelectVisibleChange = (visible: boolean) => {
|
||||
}
|
||||
};
|
||||
|
||||
// 将当前目标学生添加到目标学生选项列表中(用于数据回显)
|
||||
const addCurrentTargetStudentToOptions = async (targetStudentId: string | number) => {
|
||||
try {
|
||||
console.log('将当前目标学生添加到选项列表,学生ID:', targetStudentId);
|
||||
const response = await getStudentMsg(targetStudentId);
|
||||
|
||||
if (response.code === 200 && response.data) {
|
||||
const studentInfo = response.data;
|
||||
|
||||
// 检查是否已存在该学生
|
||||
const existingStudent = targetStudentOptions.value.find((student) => student.id === targetStudentId);
|
||||
if (!existingStudent) {
|
||||
// 将学生信息添加到目标学生选项列表
|
||||
const studentOption: StudentOptionVO = {
|
||||
id: studentInfo.id,
|
||||
name: studentInfo.name || '',
|
||||
studentNo: studentInfo.studentNo || '',
|
||||
gender: studentInfo.gender || '',
|
||||
phone: studentInfo.phone || '',
|
||||
collegeId: studentInfo.collegeId,
|
||||
collegeName: studentInfo.collegeName || '',
|
||||
majorId: studentInfo.majorId,
|
||||
majorName: studentInfo.majorName || '',
|
||||
classId: studentInfo.classId,
|
||||
className: studentInfo.className || ''
|
||||
};
|
||||
|
||||
targetStudentOptions.value = [studentOption];
|
||||
console.log('当前目标学生已添加到选项列表:', studentOption);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('添加当前目标学生到选项列表失败:', error);
|
||||
}
|
||||
};
|
||||
|
||||
// 加载初始目标学生数据
|
||||
const loadInitialTargetStudents = async () => {
|
||||
targetStudentLoading.value = true;
|
||||
@@ -1525,6 +1563,9 @@ const clearTargetDormInfo = () => {
|
||||
form.targetBedId = '';
|
||||
form.targetBedNo = '';
|
||||
|
||||
// 清空目标床位学生信息
|
||||
clearTargetBedStudentInfo();
|
||||
|
||||
// 清空选项
|
||||
targetBuildingOptions.value = [];
|
||||
targetRoomOptions.value = [];
|
||||
@@ -1687,7 +1728,7 @@ const loadTargetBedOptions = async (roomId: string | number) => {
|
||||
};
|
||||
|
||||
// 目标床位选择变化处理
|
||||
const handleTargetBedChange = (bedId: string | number) => {
|
||||
const handleTargetBedChange = async (bedId: string | number) => {
|
||||
if (bedId) {
|
||||
// 设置床位名称
|
||||
const selectedBed = targetBedOptions.value.find((bed) => bed.id === bedId);
|
||||
@@ -1695,9 +1736,14 @@ const handleTargetBedChange = (bedId: string | number) => {
|
||||
form.targetBedId = bedId;
|
||||
form.targetBedNo = selectedBed.bedNo || selectedBed.bedName;
|
||||
}
|
||||
|
||||
// 获取该床位的学生信息
|
||||
await getTargetBedStudentInfo(bedId);
|
||||
} else {
|
||||
form.targetBedId = '';
|
||||
form.targetBedNo = '';
|
||||
// 清空目标床位学生信息
|
||||
clearTargetBedStudentInfo();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1715,6 +1761,11 @@ const loadTargetCascadeOptionsForUpdate = async () => {
|
||||
// 如果有房间ID,加载床位选项
|
||||
if (form.targetRoomId) {
|
||||
await loadTargetBedOptions(form.targetRoomId);
|
||||
|
||||
// 如果有床位ID,加载床位学生信息
|
||||
if (form.targetBedId) {
|
||||
await getTargetBedStudentInfo(form.targetBedId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1723,6 +1774,46 @@ const loadTargetCascadeOptionsForUpdate = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
// 获取目标床位的学生信息
|
||||
const getTargetBedStudentInfo = async (bedId: string | number) => {
|
||||
try {
|
||||
console.log('开始获取目标床位学生信息,床位ID:', bedId);
|
||||
const response = await request({
|
||||
url: `/dormBedStudent/dormBedStudent/bedStudentInfo/${bedId}`,
|
||||
method: 'get'
|
||||
});
|
||||
|
||||
if (response.code === 200 && response.data) {
|
||||
const studentInfo = response.data;
|
||||
console.log('获取到的目标床位学生信息:', studentInfo);
|
||||
|
||||
// 填充目标床位学生信息
|
||||
form.targetBedStudentId = studentInfo.studentId || '';
|
||||
form.targetBedStudentName = studentInfo.studentName || '';
|
||||
form.targetBedStudentNo = studentInfo.studentNo || '';
|
||||
form.targetBedStudentCollegeName = studentInfo.collegeName || '';
|
||||
form.targetBedStudentMajorName = studentInfo.majorName || '';
|
||||
form.targetBedStudentClassName = studentInfo.className || '';
|
||||
} else {
|
||||
console.warn('该床位暂无学生信息');
|
||||
clearTargetBedStudentInfo();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取目标床位学生信息失败:', error);
|
||||
clearTargetBedStudentInfo();
|
||||
}
|
||||
};
|
||||
|
||||
// 清空目标床位学生信息
|
||||
const clearTargetBedStudentInfo = () => {
|
||||
form.targetBedStudentId = '';
|
||||
form.targetBedStudentName = '';
|
||||
form.targetBedStudentNo = '';
|
||||
form.targetBedStudentCollegeName = '';
|
||||
form.targetBedStudentMajorName = '';
|
||||
form.targetBedStudentClassName = '';
|
||||
};
|
||||
|
||||
// 初始化页面数据
|
||||
const initPageData = () => {
|
||||
// 重置表单数据
|
||||
@@ -1759,10 +1850,15 @@ const initPageData = () => {
|
||||
targetRoomNo: '',
|
||||
targetBedId: '',
|
||||
targetBedNo: '',
|
||||
// 目标床位学生信息
|
||||
targetBedStudentId: '',
|
||||
targetBedStudentName: '',
|
||||
targetBedStudentNo: '',
|
||||
targetBedStudentCollegeName: '',
|
||||
targetBedStudentMajorName: '',
|
||||
targetBedStudentClassName: '',
|
||||
applyTime: routeParams.value.id ? '' : new Date().toISOString().slice(0, 19).replace('T', ' '),
|
||||
reasonDetail: '',
|
||||
emergencyContact: '',
|
||||
emergencyPhone: '',
|
||||
attachmentOssIds: '',
|
||||
applicationStatus: 'draft',
|
||||
approvalOpinion: '',
|
||||
@@ -1804,9 +1900,10 @@ const submitCallback = async () => {
|
||||
onMounted(() => {
|
||||
nextTick(async () => {
|
||||
routeParams.value = (proxy as any).$route.query;
|
||||
initPageData();
|
||||
// 加载目标校区选项
|
||||
// 先加载目标校区选项,确保级联数据回显时能找到对应的名称
|
||||
await loadTargetCampusOptions();
|
||||
// 然后初始化页面数据(包含数据回显)
|
||||
initPageData();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -1917,11 +2014,29 @@ onMounted(() => {
|
||||
padding-top: 8px;
|
||||
}
|
||||
|
||||
/* 学生基础信息展示样式(在学生选择区域内) */
|
||||
.student-info-display {
|
||||
margin-top: 16px;
|
||||
padding-top: 12px;
|
||||
border-top: 1px solid #e9ecef;
|
||||
/* 选择学生下方的学生信息显示样式 */
|
||||
.selected-student-info {
|
||||
margin-top: 0px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.selected-student-info .student-info-inline,
|
||||
.selected-student-info .dorm-info-inline,
|
||||
.target-bed-student-inline-info {
|
||||
margin-bottom: 8px;
|
||||
padding: 8px 12px;
|
||||
background: #f8f9fa;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #e9ecef;
|
||||
}
|
||||
|
||||
.selected-student-info .student-info-inline .info-text,
|
||||
.selected-student-info .dorm-info-inline .info-text,
|
||||
.target-bed-student-inline-info .student-info-text {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
line-height: 1.4;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.info-subtitle {
|
||||
@@ -1933,30 +2048,6 @@ onMounted(() => {
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
}
|
||||
|
||||
.student-info-display .info-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 8px;
|
||||
padding: 4px 0;
|
||||
}
|
||||
|
||||
.student-info-display .info-label {
|
||||
color: #606266;
|
||||
font-weight: 500;
|
||||
margin-right: 8px;
|
||||
white-space: nowrap;
|
||||
font-size: 13px;
|
||||
min-width: 80px;
|
||||
}
|
||||
|
||||
.student-info-display .info-value {
|
||||
color: #303133;
|
||||
font-weight: 400;
|
||||
flex: 1;
|
||||
word-break: break-all;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.info-title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
@@ -2279,4 +2370,6 @@ onMounted(() => {
|
||||
min-height: 32px !important;
|
||||
padding: 4px 12px !important;
|
||||
}
|
||||
|
||||
/* 目标床位学生信息内联显示样式 - 已合并到选择学生信息样式中 */
|
||||
</style>
|
||||
@@ -328,7 +328,7 @@ const handleAdd = () => {
|
||||
const handleUpdate = async (row?: DormApplicationVO) => {
|
||||
const _id = row?.id || ids.value[0];
|
||||
proxy.$router.push({
|
||||
path: `/xg/xsjcxx/xssssq/dormEdit/index`,
|
||||
path: `/xg/xsjcxx/xssssq/dialog`,
|
||||
query: {
|
||||
id: _id,
|
||||
type: 'update'
|
||||
|
||||
Reference in new issue
Block a user