增加处理意见展示
This commit is contained in:
@@ -363,11 +363,19 @@
|
||||
this.getDicts();
|
||||
},
|
||||
methods: {
|
||||
getDicts() {
|
||||
let res = getDicts("more_dept_name");
|
||||
if (res.code == 200) {
|
||||
console.log('res:',res)
|
||||
this.moreDeptList = [...res.data];
|
||||
async getDicts() {
|
||||
try {
|
||||
let res = await getDicts("more_dept_name");
|
||||
if (res.code == 200) {
|
||||
console.log('res:',res)
|
||||
this.moreDeptList = [...res.data];
|
||||
} else {
|
||||
console.error('获取部门字典数据失败:', res);
|
||||
this.moreDeptList = [];
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取部门字典数据异常:', error);
|
||||
this.moreDeptList = [];
|
||||
}
|
||||
},
|
||||
async getOwnFamily() {
|
||||
@@ -733,7 +741,19 @@
|
||||
this.formData.className = this.ownClassName;
|
||||
this.formData.name = this.ownName;
|
||||
this.formData.stuNo = this.ownStuNo;
|
||||
this.formData.moreDeptName = this.moreDeptList.filter(x => x.dictValue.includes(this.ownDeptName))[0].dictValue;
|
||||
|
||||
// 安全检查:确保moreDeptList存在且不为空,并且能找到匹配的部门
|
||||
if (this.moreDeptList && this.moreDeptList.length > 0 && this.ownDeptName) {
|
||||
const matchedDept = this.moreDeptList.filter(x => x && x.dictValue && x.dictValue.includes(this.ownDeptName));
|
||||
if (matchedDept.length > 0) {
|
||||
this.formData.moreDeptName = matchedDept[0].dictValue;
|
||||
} else {
|
||||
// 如果没有找到匹配的部门,使用第一个部门或者设置为空
|
||||
this.formData.moreDeptName = this.moreDeptList[0] && this.moreDeptList[0].dictValue ? this.moreDeptList[0].dictValue : '';
|
||||
}
|
||||
} else {
|
||||
this.formData.moreDeptName = '';
|
||||
}
|
||||
}
|
||||
// console.log("doEdit", this.formData)
|
||||
// this.lookV = true;
|
||||
|
||||
Reference in New Issue
Block a user