fix(tygl): 学院选项补上 organizationName/organizationId 映射
上一次修复(7245008)只把 listColleges() 的接口从 /gxmu/college 换成了
/system/organization?parentId=24,配套的 normalizeCollegeOptions 仍读
gxmu_college 时代的键名 collegeName/collegeId——这两个键在新接口里都不存在,
每项映射成 {label:'', value:''},随即被末尾的 .filter(item => item.label && item.value !== '')
整列表滤空,学院下拉没有任何可选值。
- normalizeCollegeOptions 的 label/rawLabel 补 organizationName,value 补 organizationId
(保留旧键,兼容本地草稿缓存)
- 该映射此前无人核对:openCollegePicker 无条件弹面板,空选项表现为「没有匹配的选项」,
静默吞掉了字段不匹配,不像原来的「只有 2 个选项」那样显眼
实测(本机 API):/system/organization?parentId=24 返回 103 条,修复前映射后 0 条,
修复后 103 条;护理学院(id=54) 仍能带出 69 个班级。班级映射未受影响。
This commit is contained in:
@@ -588,12 +588,14 @@ export default {
|
||||
console.warn('tygl options load failed', error)
|
||||
}
|
||||
},
|
||||
// 学院源是 /system/organization(见 docs/adr/0002),字段名是 organizationName/organizationId,
|
||||
// 不是 gxmu_college 时代的 collegeName/collegeId:漏了这两个键会让整个列表被下面的 filter 过滤成空。
|
||||
normalizeCollegeOptions(list) {
|
||||
return (Array.isArray(list) ? list : [])
|
||||
.map((item) => ({
|
||||
label: item.collegeName || item.name || item.label || '',
|
||||
value: Number(item.collegeId || item.id || item.value || 0) || String(item.collegeId || item.id || item.value || ''),
|
||||
rawLabel: item.collegeName || item.name || item.label || ''
|
||||
label: item.collegeName || item.organizationName || item.name || item.label || '',
|
||||
value: Number(item.collegeId || item.organizationId || item.id || item.value || 0) || String(item.collegeId || item.organizationId || item.id || item.value || ''),
|
||||
rawLabel: item.collegeName || item.organizationName || item.name || item.label || ''
|
||||
}))
|
||||
.filter((item) => item.label && item.value !== '')
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user