From ffd10ee242e45e6f649be0b06d705f80eece1d7c Mon Sep 17 00:00:00 2001 From: weicw1996 Date: Mon, 12 Oct 2026 19:11:22 +0800 Subject: [PATCH] =?UTF-8?q?fix(tygl):=20=E5=AD=A6=E9=99=A2=E9=80=89?= =?UTF-8?q?=E9=A1=B9=E8=A1=A5=E4=B8=8A=20organizationName/organizationId?= =?UTF-8?q?=20=E6=98=A0=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 上一次修复(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 个班级。班级映射未受影响。 --- pages/tygl/index.vue | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pages/tygl/index.vue b/pages/tygl/index.vue index 688f667..470a106 100644 --- a/pages/tygl/index.vue +++ b/pages/tygl/index.vue @@ -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 !== '') },