退伍复学-学务转专业调整
This commit is contained in:
@@ -871,30 +871,35 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// 获取学务班级名称列表
|
// 获取学务班级名称列表
|
||||||
getXWClassNameList() {
|
getXWClassNameList() {
|
||||||
getClassName().then(res => {
|
getClassName().then(res => {
|
||||||
this.ClassNameList = res.data
|
this.ClassNameList = res.data;
|
||||||
// console.log(this.ClassNameList)
|
if (this.ClassNameList != null) {
|
||||||
if (this.ClassNameList != null) {
|
this.ClassNameList.forEach(element => {
|
||||||
this.ClassNameList.forEach(element => {
|
if (element.value == this.form.maList[0].finaldata1) {
|
||||||
if (element.value == this.form.maList[0].finaldata1) {
|
element.children.forEach(elementTwo => {
|
||||||
// console.log(element.label)
|
if (elementTwo.value == this.form.maList[0].finaldata2) {
|
||||||
element.children.forEach(elementTwo => {
|
elementTwo.children.forEach(elementFree => {
|
||||||
if (elementTwo.value == this.form.maList[0].finaldata2) {
|
if (elementFree.value == this.form.maList[0].newmajor) {
|
||||||
// console.log(elementTwo.label)
|
this.finalClassName = elementFree.label;
|
||||||
// this.saveClassName =elementTwo.label
|
this.classVlue1 = [element.value, elementTwo.value, elementFree.value];
|
||||||
elementTwo.children.forEach(elementFree => {
|
|
||||||
this.finalClassName = elementFree.label
|
// 关键修复:从年级列表中查找年级名称,而不是直接使用 element.label
|
||||||
this.classVlue1 = [element.value, elementTwo.value, elementFree.value];
|
const gradeId = element.value;
|
||||||
// console.log(elementFree.label)
|
const gradeItem = this.grade_list.find(item => item.gradeId === gradeId);
|
||||||
});
|
if (gradeItem) {
|
||||||
}
|
this.finalGradeName = gradeItem.gradeName; // 正确的年级名称
|
||||||
});
|
this.$set(this.form.maList[0], 'finallabel', gradeItem.gradeId); // 正确的年级ID
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
})
|
}
|
||||||
},
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
/** 获取班级名称列表 */
|
/** 获取班级名称列表 */
|
||||||
getClassNameList() {
|
getClassNameList() {
|
||||||
|
|||||||
@@ -577,7 +577,7 @@
|
|||||||
<span style="color: red;"> ( 专业调整:)</span>
|
<span style="color: red;"> ( 专业调整:)</span>
|
||||||
<!-- 年级 -->
|
<!-- 年级 -->
|
||||||
<el-select
|
<el-select
|
||||||
v-model="form.maList[0].finalmajor"
|
v-model="form.maList[0].finallabel"
|
||||||
filterable
|
filterable
|
||||||
clearable
|
clearable
|
||||||
placeholder="请选择年级"
|
placeholder="请选择年级"
|
||||||
@@ -590,7 +590,7 @@
|
|||||||
:label="item.gradeName"
|
:label="item.gradeName"
|
||||||
:value="item.gradeId"
|
:value="item.gradeId"
|
||||||
/>
|
/>
|
||||||
</el-select>-
|
</el-select>
|
||||||
<!-- 班级 -->
|
<!-- 班级 -->
|
||||||
|
|
||||||
<el-cascader v-model="classVlue1" placeholder="请选择班级" :show-all-levels="false" :options="ClassNameList"
|
<el-cascader v-model="classVlue1" placeholder="请选择班级" :show-all-levels="false" :options="ClassNameList"
|
||||||
@@ -1195,12 +1195,13 @@ export default {
|
|||||||
handleChange1(value) {
|
handleChange1(value) {
|
||||||
if (value && value.length === 3) {
|
if (value && value.length === 3) {
|
||||||
const [gradeId, majorId, classId] = value;
|
const [gradeId, majorId, classId] = value;
|
||||||
|
// 1. 更新存储用的ID字段
|
||||||
this.$set(this.form.maList[0], 'finaldata1', gradeId);
|
this.$set(this.form.maList[0], 'finaldata1', gradeId);
|
||||||
this.$set(this.form.maList[0], 'finaldata2', majorId);
|
this.$set(this.form.maList[0], 'finaldata2', majorId);
|
||||||
this.$set(this.form.maList[0], 'newmajor', classId);
|
this.$set(this.form.maList[0], 'newmajor', classId);
|
||||||
// 确保finalmajor与newmajor同步,存储班级ID
|
|
||||||
this.$set(this.form.maList[0], 'finalmajor', classId);
|
this.$set(this.form.maList[0], 'finalmajor', classId);
|
||||||
|
|
||||||
|
// 2. 查找班级名称
|
||||||
const gradeItem = this.ClassNameList.find(item => item.value === gradeId);
|
const gradeItem = this.ClassNameList.find(item => item.value === gradeId);
|
||||||
if (gradeItem) {
|
if (gradeItem) {
|
||||||
const majorItem = gradeItem.children.find(item => item.value === majorId);
|
const majorItem = gradeItem.children.find(item => item.value === majorId);
|
||||||
@@ -1211,6 +1212,13 @@ handleChange1(value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 关键修复:从年级列表中查找年级名称,而不是直接使用 gradeItem.label
|
||||||
|
const selectedGrade = this.grade_list.find(item => item.gradeId === gradeId);
|
||||||
|
if (selectedGrade) {
|
||||||
|
this.finalGradeName = selectedGrade.gradeName; // 正确的年级名称
|
||||||
|
this.$set(this.form.maList[0], 'finallabel', selectedGrade.gradeId); // 正确的年级ID
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 年级选择事件(仅更新ID,不处理名称)
|
// 年级选择事件(仅更新ID,不处理名称)
|
||||||
@@ -1227,9 +1235,17 @@ handleChange1(value) {
|
|||||||
handleGradeChange(value) {
|
handleGradeChange(value) {
|
||||||
const selectedGrade = this.grade_list.find(item => item.gradeId === value);
|
const selectedGrade = this.grade_list.find(item => item.gradeId === value);
|
||||||
if (selectedGrade) {
|
if (selectedGrade) {
|
||||||
// 仅更新年级ID和名称,不修改finalmajor
|
// 1. 更新存储用的年级ID
|
||||||
this.$set(this.form.maList[0], 'finallabel', value);
|
this.$set(this.form.maList[0], 'finallabel', value);
|
||||||
this.finalGradeName = selectedGrade.gradeName;
|
// 2. 同步更新显示用的年级名称(这里必须是 selectedGrade.gradeName)
|
||||||
|
this.finalGradeName = selectedGrade.gradeName;
|
||||||
|
// 3. 清空班级选择,避免年级和班级不匹配
|
||||||
|
this.classVlue1 = [];
|
||||||
|
this.finalClassName = null;
|
||||||
|
this.$set(this.form.maList[0], 'finaldata1', '');
|
||||||
|
this.$set(this.form.maList[0], 'finaldata2', '');
|
||||||
|
this.$set(this.form.maList[0], 'newmajor', '');
|
||||||
|
this.$set(this.form.maList[0], 'finalmajor', '');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// handleChange1(value) {
|
// handleChange1(value) {
|
||||||
@@ -1341,25 +1357,57 @@ handleGradeChange(value) {
|
|||||||
|
|
||||||
// 退伍复学申请表单数据
|
// 退伍复学申请表单数据
|
||||||
getBasicApplication(startUser) {
|
getBasicApplication(startUser) {
|
||||||
// let newName = this.startUser.replace(/-/g, "");
|
// // let newName = this.startUser.replace(/-/g, "");
|
||||||
let newName = this.startUser.split('-')[0].trim();
|
// let newName = this.startUser.split('-')[0].trim();
|
||||||
getStname(newName).then((res) => {
|
// getStname(newName).then((res) => {
|
||||||
// console.log("后端返回原始数据:",res.data);
|
// // console.log("后端返回原始数据:",res.data);
|
||||||
this.form = res.data
|
// this.form = res.data
|
||||||
|
|
||||||
// 1. 初始化选择框绑定的核心字段(finalmajor)
|
// // 1. 初始化选择框绑定的核心字段(finalmajor)
|
||||||
if (this.form.maList && this.form.maList.length > 0) {
|
// if (this.form.maList && this.form.maList.length > 0) {
|
||||||
// 从maList中读取已保存的年级ID,赋值给finalmajor(选择框绑定字段)
|
// // 从maList中读取已保存的年级ID,赋值给finalmajor(选择框绑定字段)
|
||||||
this.$set(this.form.maList[0], 'finalmajor', this.form.maList[0].finallabel || '');
|
// this.$set(this.form.maList[0], 'finalmajor', this.form.maList[0].finallabel || '');
|
||||||
} else {
|
// } else {
|
||||||
// 若无数据,初始化空值避免undefined
|
// // 若无数据,初始化空值避免undefined
|
||||||
this.form.maList = [{ finalmajor: '', finallabel: '' }];
|
// this.form.maList = [{ finalmajor: '', finallabel: '' }];
|
||||||
}
|
// }
|
||||||
|
|
||||||
this.getClassNameList()
|
// this.getClassNameList()
|
||||||
this.listGrade()
|
// this.listGrade()
|
||||||
this.getXWClassNameList()
|
// this.getXWClassNameList()
|
||||||
});
|
// });
|
||||||
|
let newName = this.startUser.split('-')[0].trim();
|
||||||
|
getStname(newName).then((res) => {
|
||||||
|
console.log("后端返回原始数据:", res.data);
|
||||||
|
// 深拷贝确保数据不被污染
|
||||||
|
this.form = JSON.parse(JSON.stringify(res.data));
|
||||||
|
|
||||||
|
// 初始化maList,防止空指针
|
||||||
|
if (!this.form.maList || this.form.maList.length === 0) {
|
||||||
|
this.form.maList = [{
|
||||||
|
finalmajor: '',
|
||||||
|
finallabel: '',
|
||||||
|
finaldata1: '',
|
||||||
|
finaldata2: '',
|
||||||
|
newmajor: '',
|
||||||
|
finalClassName: '',
|
||||||
|
finalGradeName: ''
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1. 初始化选择框绑定的核心字段(finalmajor)
|
||||||
|
this.$set(this.form.maList[0], 'finalmajor', this.form.maList[0].finallabel || '');
|
||||||
|
|
||||||
|
// 确保数据加载完成后再渲染下拉列表
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.getClassNameList();
|
||||||
|
this.listGrade();
|
||||||
|
this.getXWClassNameList();
|
||||||
|
});
|
||||||
|
}).catch(error => {
|
||||||
|
console.error("获取退伍复学数据失败:", error);
|
||||||
|
this.$modal.msgError("获取学生信息失败,请刷新页面重试");
|
||||||
|
});
|
||||||
},
|
},
|
||||||
/** 获取班级名称列表 */
|
/** 获取班级名称列表 */
|
||||||
getClassNameList() {
|
getClassNameList() {
|
||||||
@@ -1387,52 +1435,143 @@ handleGradeChange(value) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// 获取学务班级名称列表
|
// 获取学务班级名称列表
|
||||||
|
// getXWClassNameList() {
|
||||||
|
// getClassName().then(res => {
|
||||||
|
// this.ClassNameList = res.data
|
||||||
|
// // console.log(this.ClassNameList)
|
||||||
|
// if (this.ClassNameList != null) {
|
||||||
|
// this.ClassNameList.forEach(element => {
|
||||||
|
// if (element.value == this.form.maList[0].finaldata1) {
|
||||||
|
// // console.log(element.label)
|
||||||
|
// element.children.forEach(elementTwo => {
|
||||||
|
// if (elementTwo.value == this.form.maList[0].finaldata2) {
|
||||||
|
// // console.log(elementTwo.label)
|
||||||
|
// // this.saveClassName =elementTwo.label
|
||||||
|
// elementTwo.children.forEach(elementFree => {
|
||||||
|
// this.finalClassName = elementFree.label
|
||||||
|
// this.classVlue1 = [element.value, elementTwo.value, elementFree.value];
|
||||||
|
// // console.log(elementFree.label)
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
// getXWClassNameList() {
|
||||||
|
// getClassName().then(res => {
|
||||||
|
// this.ClassNameList = res.data;
|
||||||
|
// if (this.ClassNameList != null) {
|
||||||
|
// this.ClassNameList.forEach(element => {
|
||||||
|
// if (element.value == this.form.maList[0].finaldata1) {
|
||||||
|
// element.children.forEach(elementTwo => {
|
||||||
|
// if (elementTwo.value == this.form.maList[0].finaldata2) {
|
||||||
|
// elementTwo.children.forEach(elementFree => {
|
||||||
|
// if (elementFree.value == this.form.maList[0].newmajor) {
|
||||||
|
// this.finalClassName = elementFree.label;
|
||||||
|
// this.classVlue1 = [element.value, elementTwo.value, elementFree.value];
|
||||||
|
// // 同步更新年级名称
|
||||||
|
// this.finalGradeName = element.label;
|
||||||
|
// this.$set(this.form.maList[0], 'finallabel', element.value);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// },
|
||||||
getXWClassNameList() {
|
getXWClassNameList() {
|
||||||
getClassName().then(res => {
|
getClassName().then(res => {
|
||||||
this.ClassNameList = res.data
|
this.ClassNameList = res.data;
|
||||||
// console.log(this.ClassNameList)
|
if (this.ClassNameList != null) {
|
||||||
if (this.ClassNameList != null) {
|
this.ClassNameList.forEach(element => {
|
||||||
this.ClassNameList.forEach(element => {
|
if (element.value == this.form.maList[0].finaldata1) {
|
||||||
if (element.value == this.form.maList[0].finaldata1) {
|
element.children.forEach(elementTwo => {
|
||||||
// console.log(element.label)
|
if (elementTwo.value == this.form.maList[0].finaldata2) {
|
||||||
element.children.forEach(elementTwo => {
|
elementTwo.children.forEach(elementFree => {
|
||||||
if (elementTwo.value == this.form.maList[0].finaldata2) {
|
if (elementFree.value == this.form.maList[0].newmajor) {
|
||||||
// console.log(elementTwo.label)
|
this.finalClassName = elementFree.label;
|
||||||
// this.saveClassName =elementTwo.label
|
this.classVlue1 = [element.value, elementTwo.value, elementFree.value];
|
||||||
elementTwo.children.forEach(elementFree => {
|
|
||||||
this.finalClassName = elementFree.label
|
// 关键修复:从年级列表中查找年级名称,而不是直接使用 element.label
|
||||||
this.classVlue1 = [element.value, elementTwo.value, elementFree.value];
|
const gradeId = element.value;
|
||||||
// console.log(elementFree.label)
|
const gradeItem = this.grade_list.find(item => item.gradeId === gradeId);
|
||||||
});
|
if (gradeItem) {
|
||||||
|
this.finalGradeName = gradeItem.gradeName; // 正确的年级名称
|
||||||
|
this.$set(this.form.maList[0], 'finallabel', gradeItem.gradeId); // 正确的年级ID
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
/** 获取年级列表 */
|
/** 获取年级列表 */
|
||||||
|
// async listGrade() {
|
||||||
|
// try {
|
||||||
|
// let res = await listGrade()
|
||||||
|
// if (res.code == 200) {
|
||||||
|
// this.grade_list = [...res.rows]
|
||||||
|
// console.log(this.grade_list)
|
||||||
|
// this.grade_list.forEach(element => {
|
||||||
|
// // console.log("newgrade",this.form.maList[0].newgrade)
|
||||||
|
// if (element.gradeId == this.form.maList[0].newgrade) {
|
||||||
|
// this.saveGradeName = element.gradeName
|
||||||
|
// }
|
||||||
|
// if (element.gradeId == this.form.maList[0].finallabel) {
|
||||||
|
// this.finalGradeName = element.gradeName
|
||||||
|
// // this.$set(this.form.maList[0], 'finalmajor', element.gradeId);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
// } catch (error) {
|
||||||
|
// console.error('获取年级列表失败:', error)
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// async listGrade() {
|
||||||
|
// try {
|
||||||
|
// let res = await listGrade();
|
||||||
|
// if (res.code == 200) {
|
||||||
|
// this.grade_list = [...res.rows];
|
||||||
|
// this.grade_list.forEach(element => {
|
||||||
|
// if (element.gradeId == this.form.maList[0].newgrade) {
|
||||||
|
// this.saveGradeName = element.gradeName;
|
||||||
|
// }
|
||||||
|
// if (element.gradeId == this.form.maList[0].finallabel) {
|
||||||
|
// this.finalGradeName = element.gradeName;
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// } catch (error) {
|
||||||
|
// console.error('获取年级列表失败:', error);
|
||||||
|
// }
|
||||||
|
// },
|
||||||
async listGrade() {
|
async listGrade() {
|
||||||
try {
|
try {
|
||||||
let res = await listGrade()
|
let res = await listGrade(); // 调用后端接口获取年级列表
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.grade_list = [...res.rows]
|
this.grade_list = [...res.rows];
|
||||||
console.log(this.grade_list)
|
// 打印日志,检查返回的数据结构
|
||||||
|
console.log("年级列表:", this.grade_list);
|
||||||
this.grade_list.forEach(element => {
|
this.grade_list.forEach(element => {
|
||||||
// console.log("newgrade",this.form.maList[0].newgrade)
|
|
||||||
if (element.gradeId == this.form.maList[0].newgrade) {
|
if (element.gradeId == this.form.maList[0].newgrade) {
|
||||||
this.saveGradeName = element.gradeName
|
this.saveGradeName = element.gradeName;
|
||||||
}
|
}
|
||||||
if (element.gradeId == this.form.maList[0].finallabel) {
|
if (element.gradeId == this.form.maList[0].finallabel) {
|
||||||
this.finalGradeName = element.gradeName
|
this.finalGradeName = element.gradeName;
|
||||||
// this.$set(this.form.maList[0], 'finalmajor', element.gradeId);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取年级列表失败:', error)
|
console.error('获取年级列表失败:', error);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1711,7 +1850,7 @@ handleGradeChange(value) {
|
|||||||
xwIdea: this.taskForm.comment,
|
xwIdea: this.taskForm.comment,
|
||||||
xwTime: new Date(),
|
xwTime: new Date(),
|
||||||
xwQm: assigneeName,
|
xwQm: assigneeName,
|
||||||
finalGradeId: maList0.finalmajor,
|
finalGradeId: this.form.maList[0].finallabel,
|
||||||
// 3. 关键:将子表数据包装到 maList 数组中
|
// 3. 关键:将子表数据包装到 maList 数组中
|
||||||
maList: [
|
maList: [
|
||||||
{
|
{
|
||||||
@@ -1765,44 +1904,125 @@ handleGradeChange(value) {
|
|||||||
else if (this.taskName == "教务处主管") {
|
else if (this.taskName == "教务处主管") {
|
||||||
const currentFlowItem = this.flowRecordList.find(item => item.taskName === this.taskName);
|
const currentFlowItem = this.flowRecordList.find(item => item.taskName === this.taskName);
|
||||||
const assigneeName = currentFlowItem ? currentFlowItem.assigneeName : "";
|
const assigneeName = currentFlowItem ? currentFlowItem.assigneeName : "";
|
||||||
updateBasic({
|
// updateBasic({
|
||||||
|
// id: stNameData.id,
|
||||||
|
// jwStatus: "1",
|
||||||
|
// jwIdea: this.taskForm.comment,
|
||||||
|
// jwTime: new Date(),
|
||||||
|
// jwQm: assigneeName
|
||||||
|
// }).then(response => {
|
||||||
|
// console.log("===== updateBasic 响应结果 =====", response);
|
||||||
|
// this.$modal.msgSuccess(response.msg)
|
||||||
|
|
||||||
|
// // 2. 打印updateStudent的前置条件
|
||||||
|
// console.log("===== updateStudent 执行前置检查 =====");
|
||||||
|
// console.log("是否转专业(conversion):", stNameData.conversion);
|
||||||
|
// console.log("学生ID(studentId):", stNameData.studentId);
|
||||||
|
// console.log("finaldata1(院部ID):", stNameData.maList ? stNameData.maList[0].finaldata1 : "无");
|
||||||
|
// console.log("finaldata2(专业ID):", stNameData.maList ? stNameData.maList[0].finaldata2 : "无");
|
||||||
|
// console.log("finalmajor(班级ID):", stNameData.maList ? stNameData.maList[0].finalmajor : "无");
|
||||||
|
// })
|
||||||
|
// if (stNameData.conversion == "Y") {
|
||||||
|
// const maList0 = this.form.maList ? this.form.maList[0] : {};
|
||||||
|
// updateStudent({
|
||||||
|
// stuId: stNameData.studentId,
|
||||||
|
// deptId: parseInt(maList0.finaldata1),
|
||||||
|
// majorId: parseInt(maList0.finaldata2),
|
||||||
|
// classId: parseInt(maList0.finalmajor),
|
||||||
|
// status: '31',
|
||||||
|
// // updateStudent({
|
||||||
|
// // stuId: stNameData.studentId,
|
||||||
|
// // deptId: parseInt(stNameData.maList[0].finaldata1),
|
||||||
|
// // majorId: parseInt(stNameData.maList[0].finaldata2),
|
||||||
|
// // classId: parseInt(stNameData.maList[0].finalmajor),
|
||||||
|
// // status: '31',
|
||||||
|
// }).then(response => {
|
||||||
|
// console.log("updateStudent",response)
|
||||||
|
// })
|
||||||
|
// } else {
|
||||||
|
// updateStudent({ stuId: stNameData.studentId, status: '31', }).then(response => { })
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 先更新退伍复学主表
|
||||||
|
const updateBasicParams = {
|
||||||
id: stNameData.id,
|
id: stNameData.id,
|
||||||
jwStatus: "1",
|
jwStatus: "1",
|
||||||
jwIdea: this.taskForm.comment,
|
jwIdea: this.taskForm.comment,
|
||||||
jwTime: new Date(),
|
jwTime: new Date(),
|
||||||
jwQm: assigneeName
|
jwQm: assigneeName,
|
||||||
}).then(response => {
|
stId: stNameData.stId, // 补充stId,解决日志中stId为空的问题
|
||||||
|
processId: this.taskForm.procInsId
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log("更新教务处主管审批参数:", updateBasicParams);
|
||||||
|
|
||||||
|
updateBasic(updateBasicParams).then(response => {
|
||||||
console.log("===== updateBasic 响应结果 =====", response);
|
console.log("===== updateBasic 响应结果 =====", response);
|
||||||
this.$modal.msgSuccess(response.msg)
|
this.$modal.msgSuccess(response.msg);
|
||||||
|
|
||||||
// 2. 打印updateStudent的前置条件
|
// 2. 打印updateStudent的前置条件
|
||||||
console.log("===== updateStudent 执行前置检查 =====");
|
console.log("===== updateStudent 执行前置检查 =====");
|
||||||
console.log("是否转专业(conversion):", stNameData.conversion);
|
console.log("是否转专业(conversion):", stNameData.conversion);
|
||||||
console.log("学生ID(studentId):", stNameData.studentId);
|
console.log("学生ID(studentId):", stNameData.studentId);
|
||||||
|
console.log("stId:", stNameData.stId);
|
||||||
console.log("finaldata1(院部ID):", stNameData.maList ? stNameData.maList[0].finaldata1 : "无");
|
console.log("finaldata1(院部ID):", stNameData.maList ? stNameData.maList[0].finaldata1 : "无");
|
||||||
console.log("finaldata2(专业ID):", stNameData.maList ? stNameData.maList[0].finaldata2 : "无");
|
console.log("finaldata2(专业ID):", stNameData.maList ? stNameData.maList[0].finaldata2 : "无");
|
||||||
console.log("finalmajor(班级ID):", stNameData.maList ? stNameData.maList[0].finalmajor : "无");
|
console.log("finalmajor(班级ID):", stNameData.maList ? stNameData.maList[0].finalmajor : "无");
|
||||||
})
|
|
||||||
if (stNameData.conversion == "Y") {
|
// 修复转专业判断和参数类型问题
|
||||||
const maList0 = this.form.maList ? this.form.maList[0] : {};
|
if (stNameData.conversion == "Y" && stNameData.maList && stNameData.maList.length > 0) {
|
||||||
updateStudent({
|
const maList0 = stNameData.maList[0];
|
||||||
stuId: stNameData.studentId,
|
// 确保参数是数字类型,且有值
|
||||||
deptId: parseInt(maList0.finaldata1),
|
const deptId = maList0.finaldata1 ? parseInt(maList0.finaldata1) : null;
|
||||||
majorId: parseInt(maList0.finaldata2),
|
const majorId = maList0.finaldata2 ? parseInt(maList0.finaldata2) : null;
|
||||||
classId: parseInt(maList0.finalmajor),
|
const classId = maList0.finalmajor ? parseInt(maList0.finalmajor) : null;
|
||||||
status: '31',
|
const stuId = stNameData.studentId || stNameData.stId;
|
||||||
// updateStudent({
|
|
||||||
// stuId: stNameData.studentId,
|
// 只有所有必要参数都存在时才更新
|
||||||
// deptId: parseInt(stNameData.maList[0].finaldata1),
|
if (stuId && deptId && majorId && classId) {
|
||||||
// majorId: parseInt(stNameData.maList[0].finaldata2),
|
updateStudent({
|
||||||
// classId: parseInt(stNameData.maList[0].finalmajor),
|
stuId: stuId,
|
||||||
// status: '31',
|
deptId: deptId,
|
||||||
}).then(response => {
|
majorId: majorId,
|
||||||
console.log("updateStudent",response)
|
classId: classId,
|
||||||
})
|
status: '31',
|
||||||
} else {
|
}).then(response => {
|
||||||
updateStudent({ stuId: stNameData.studentId, status: '31', }).then(response => { })
|
console.log("updateStudent 响应:", response);
|
||||||
}
|
// 更新成功后重新获取学生信息,确保前端数据最新
|
||||||
|
this.getBasicApplication(this.startUser);
|
||||||
|
}).catch(error => {
|
||||||
|
console.error("updateStudent 失败:", error);
|
||||||
|
this.$modal.msgError("更新学生信息失败:" + error.message);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.error("转专业参数不完整:", {
|
||||||
|
stuId, deptId, majorId, classId
|
||||||
|
});
|
||||||
|
this.$modal.msgWarning("转专业参数不完整,无法更新学生信息");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 不转专业,只更新状态
|
||||||
|
const stuId = stNameData.studentId || stNameData.stId;
|
||||||
|
if (stuId) {
|
||||||
|
updateStudent({
|
||||||
|
stuId: stuId,
|
||||||
|
status: '31'
|
||||||
|
}).then(response => {
|
||||||
|
console.log("updateStudent 响应:", response);
|
||||||
|
// 更新成功后重新获取学生信息
|
||||||
|
this.getBasicApplication(this.startUser);
|
||||||
|
}).catch(error => {
|
||||||
|
console.error("updateStudent 失败:", error);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.error("学生ID为空,无法更新状态");
|
||||||
|
this.$modal.msgError("学生ID为空,无法更新状态");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
console.error("updateBasic 失败:", error);
|
||||||
|
this.$modal.msgError("审批更新失败:" + error.message);
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -447,30 +447,35 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
// 获取学务班级名称列表
|
// 获取学务班级名称列表
|
||||||
getXWClassNameList() {
|
getXWClassNameList() {
|
||||||
getClassName().then(res => {
|
getClassName().then(res => {
|
||||||
this.ClassNameList = res.data
|
this.ClassNameList = res.data;
|
||||||
// console.log(this.ClassNameList)
|
if (this.ClassNameList != null) {
|
||||||
if (this.ClassNameList != null) {
|
this.ClassNameList.forEach(element => {
|
||||||
this.ClassNameList.forEach(element => {
|
if (element.value == this.form.maList[0].finaldata1) {
|
||||||
if (element.value == this.form.maList[0].finaldata1) {
|
element.children.forEach(elementTwo => {
|
||||||
// console.log(element.label)
|
if (elementTwo.value == this.form.maList[0].finaldata2) {
|
||||||
element.children.forEach(elementTwo => {
|
elementTwo.children.forEach(elementFree => {
|
||||||
if (elementTwo.value == this.form.maList[0].finaldata2) {
|
if (elementFree.value == this.form.maList[0].newmajor) {
|
||||||
// console.log(elementTwo.label)
|
this.finalClassName = elementFree.label;
|
||||||
// this.saveClassName =elementTwo.label
|
this.classVlue1 = [element.value, elementTwo.value, elementFree.value];
|
||||||
elementTwo.children.forEach(elementFree => {
|
|
||||||
this.finalClassName = elementFree.label
|
// 关键修复:从年级列表中查找年级名称,而不是直接使用 element.label
|
||||||
this.classVlue1 = [element.value, elementTwo.value, elementFree.value];
|
const gradeId = element.value;
|
||||||
// console.log(elementFree.label)
|
const gradeItem = this.grade_list.find(item => item.gradeId === gradeId);
|
||||||
});
|
if (gradeItem) {
|
||||||
|
this.finalGradeName = gradeItem.gradeName; // 正确的年级名称
|
||||||
|
this.$set(this.form.maList[0], 'finallabel', gradeItem.gradeId); // 正确的年级ID
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
/** 获取班级名称列表 */
|
/** 获取班级名称列表 */
|
||||||
getClassNameList() {
|
getClassNameList() {
|
||||||
|
|||||||
Reference in New Issue
Block a user