From 8652ddf7b3ec31f087e181ccad52419faf6341f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9F=A6=E4=B8=9C=E6=81=92?= <1747763533@qq.com> Date: Tue, 10 Mar 2026 15:58:12 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=80=E4=BC=8D=E5=A4=8D=E5=AD=A6-=E6=9D=90?= =?UTF-8?q?=E6=96=99=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/flowable/task/todo/detail/index.vue | 363 +++++------------- src/views/routine/dis/basic/index.vue | 19 +- 2 files changed, 112 insertions(+), 270 deletions(-) diff --git a/src/views/flowable/task/todo/detail/index.vue b/src/views/flowable/task/todo/detail/index.vue index 74107d6..ca25a6d 100644 --- a/src/views/flowable/task/todo/detail/index.vue +++ b/src/views/flowable/task/todo/detail/index.vue @@ -1170,118 +1170,53 @@ export default { } }, methods: { - // 班级选择事件(仅更新ID,不处理名称) -// handleChange1(value) { -// if (value && value.length === 3) { -// const [gradeId, majorId, classId] = value; -// // 仅更新子表的ID字段,名称仅前端展示(不提交给后端) -// this.$set(this.form.maList[0], 'finaldata1', gradeId); // 年级ID -// this.$set(this.form.maList[0], 'finaldata2', majorId); // 专业ID -// this.$set(this.form.maList[0], 'newmajor', classId); // 班级ID - -// // finalClassName 仅用于前端展示,不提交 -// const gradeItem = this.ClassNameList.find(item => item.value === gradeId); -// if (gradeItem) { -// const majorItem = gradeItem.children.find(item => item.value === majorId); -// if (majorItem) { -// const classItem = majorItem.children.find(item => item.value === classId); -// if (classItem) { -// this.finalClassName = classItem.label; // 仅前端展示 -// } -// } -// } -// } -// }, -handleChange1(value) { - if (value && value.length === 3) { - const [gradeId, majorId, classId] = value; - // 1. 更新存储用的ID字段 - this.$set(this.form.maList[0], 'finaldata1', gradeId); - this.$set(this.form.maList[0], 'finaldata2', majorId); - this.$set(this.form.maList[0], 'newmajor', classId); - this.$set(this.form.maList[0], 'finalmajor', classId); + + handleChange1(value) { + if (value && value.length === 3) { + const [gradeId, majorId, classId] = value; + // 1. 更新存储用的ID字段 + this.$set(this.form.maList[0], 'finaldata1', gradeId); + this.$set(this.form.maList[0], 'finaldata2', majorId); + this.$set(this.form.maList[0], 'newmajor', classId); + this.$set(this.form.maList[0], 'finalmajor', classId); - // 2. 查找班级名称 - const gradeItem = this.ClassNameList.find(item => item.value === gradeId); - if (gradeItem) { - const majorItem = gradeItem.children.find(item => item.value === majorId); - if (majorItem) { - const classItem = majorItem.children.find(item => item.value === classId); - if (classItem) { - this.finalClassName = classItem.label; + // 2. 查找班级名称 + const gradeItem = this.ClassNameList.find(item => item.value === gradeId); + if (gradeItem) { + const majorItem = gradeItem.children.find(item => item.value === majorId); + if (majorItem) { + const classItem = majorItem.children.find(item => item.value === classId); + if (classItem) { + this.finalClassName = classItem.label; + } + } + } + + // 关键修复:从年级列表中查找年级名称,而不是直接使用 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 } } - } - - // 关键修复:从年级列表中查找年级名称,而不是直接使用 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,不处理名称) -// handleGradeChange(value) { -// const selectedGrade = this.grade_list.find(item => item.gradeId === value); -// if (selectedGrade) { -// // 仅更新子表的ID字段,名称仅前端展示 -// this.$set(this.form.maList[0], 'finallabel', value); // 年级ID(存储用) -// this.$set(this.form.maList[0], 'finalmajor', value); // 年级ID(选择框绑定) - -// this.finalGradeName = selectedGrade.gradeName; // 仅前端展示 -// } -// }, -handleGradeChange(value) { - const selectedGrade = this.grade_list.find(item => item.gradeId === value); - if (selectedGrade) { - // 1. 更新存储用的年级ID - this.$set(this.form.maList[0], 'finallabel', value); - // 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) { - // if (value && value.length === 3) { - // const [gradeId, majorId, classId] = value; - // // 从ClassNameList中找到对应班级名称 - // const gradeItem = this.ClassNameList.find(item => item.value === gradeId); - // if (gradeItem) { - // const majorItem = gradeItem.children.find(item => item.value === majorId); - // if (majorItem) { - // const classItem = majorItem.children.find(item => item.value === classId); - // if (classItem) { - // this.finalClassName = classItem.label; - // // 【关键修改】实时更新form.maList[0]的字段,确保提交时能拿到最新值 - // this.$set(this.form.maList[0], 'finaldata1', gradeId); // 年级ID - // this.$set(this.form.maList[0], 'finaldata2', majorId); // 专业ID - // this.$set(this.form.maList[0], 'newmajor', classId); // 班级ID - // this.$set(this.form.maList[0], 'finalClassName', classItem.label); // 班级名称 - // } - // } - // } - // } - // }, - - // handleGradeChange(value) { - // // 3. 选择框值变更时,同步更新显示名称和存储字段 - // const selectedGrade = this.grade_list.find(item => item.gradeId === value); - // if (selectedGrade) { - // this.finalGradeName = selectedGrade.gradeName; // 更新显示名称 - // // 【关键修改】实时更新form.maList[0]的字段 - // this.$set(this.form.maList[0], 'finallabel', value); // 年级ID(存储用) - // this.$set(this.form.maList[0], 'finalmajor', value); // 年级ID(选择框绑定) - // this.$set(this.form.maList[0], 'finalGradeName', selectedGrade.gradeName); // 年级名称 - // } - // }, + }, + handleGradeChange(value) { + const selectedGrade = this.grade_list.find(item => item.gradeId === value); + if (selectedGrade) { + // 1. 更新存储用的年级ID + this.$set(this.form.maList[0], 'finallabel', value); + // 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', ''); + } + }, penaltyTypeMethodFormat(row, column) { return this.selectDictLabel(this.dict.type.rt_penalty_type, row.penaltyType) }, @@ -1357,57 +1292,38 @@ handleGradeChange(value) { // 退伍复学申请表单数据 getBasicApplication(startUser) { - // // let newName = this.startUser.replace(/-/g, ""); - // let newName = this.startUser.split('-')[0].trim(); - // getStname(newName).then((res) => { - // // console.log("后端返回原始数据:",res.data); - // this.form = res.data + let newName = this.startUser.split('-')[0].trim(); + getStname(newName).then((res) => { + console.log("后端返回原始数据:", res.data); + // 深拷贝确保数据不被污染 + this.form = JSON.parse(JSON.stringify(res.data)); - // // 1. 初始化选择框绑定的核心字段(finalmajor) - // if (this.form.maList && this.form.maList.length > 0) { - // // 从maList中读取已保存的年级ID,赋值给finalmajor(选择框绑定字段) - // this.$set(this.form.maList[0], 'finalmajor', this.form.maList[0].finallabel || ''); - // } else { - // // 若无数据,初始化空值避免undefined - // this.form.maList = [{ finalmajor: '', finallabel: '' }]; - // } + // 初始化maList,防止空指针 + if (!this.form.maList || this.form.maList.length === 0) { + this.form.maList = [{ + finalmajor: '', + finallabel: '', + finaldata1: '', + finaldata2: '', + newmajor: '', + finalClassName: '', + finalGradeName: '' + }]; + } - // this.getClassNameList() - // this.listGrade() - // 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)); + // 1. 初始化选择框绑定的核心字段(finalmajor) + this.$set(this.form.maList[0], 'finalmajor', this.form.maList[0].finallabel || ''); - // 初始化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("获取学生信息失败,请刷新页面重试"); - }); + // 确保数据加载完成后再渲染下拉列表 + this.$nextTick(() => { + this.getClassNameList(); + this.listGrade(); + this.getXWClassNameList(); + }); + }).catch(error => { + console.error("获取退伍复学数据失败:", error); + this.$modal.msgError("获取学生信息失败,请刷新页面重试"); + }); }, /** 获取班级名称列表 */ getClassNameList() { @@ -1434,126 +1350,37 @@ 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() { - 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]; - - // 关键修复:从年级列表中查找年级名称,而不是直接使用 element.label - const gradeId = element.value; - 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 - } + 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]; + + // 关键修复:从年级列表中查找年级名称,而不是直接使用 element.label + const gradeId = element.value; + 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() { try { let res = await listGrade(); // 调用后端接口获取年级列表 diff --git a/src/views/routine/dis/basic/index.vue b/src/views/routine/dis/basic/index.vue index c2988ea..67ebdc8 100644 --- a/src/views/routine/dis/basic/index.vue +++ b/src/views/routine/dis/basic/index.vue @@ -87,6 +87,21 @@ --> + + + + + + + + + + + + + + + @@ -109,8 +124,8 @@ {{ data.label }} ({{ data.children.length }}) - - --> + + -->