From 95e74ae5d546f99589a8dd6a661e3ca3960d6720 Mon Sep 17 00:00:00 2001 From: "DESKTOP-JKIE562\\PC" <1013397054@qq.com> Date: Fri, 27 Nov 2026 00:34:55 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=9C=88=E5=BA=A6=E8=AE=A1=E5=88=92=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E4=B8=8A=E4=BC=A0=E4=B8=B4=E6=97=B6=E8=AF=BE=E4=BB=B6?= =?UTF-8?q?=E3=80=81=E8=AF=95=E9=A2=98=E5=90=8E=E6=9C=88=E5=BA=A6=E8=AE=A1?= =?UTF-8?q?=E5=88=92=E8=AF=A6=E6=83=85=E8=BF=99=E9=87=8C=E7=9A=84=E8=AF=BE?= =?UTF-8?q?=E4=BB=B6=E5=90=8D=E7=A7=B0=E4=B9=9F=E8=A6=81=E8=B7=9F=E9=9A=8F?= =?UTF-8?q?=E5=8F=98=E6=9B=B4=E3=80=81=E8=AF=95=E9=A2=98=EF=BC=81=202.?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=AE=A1=E7=90=86=E9=BB=98=E8=AE=A4=E6=A8=A1?= =?UTF-8?q?=E6=9D=BFexcel=E4=B8=8B=E8=BD=BD=E5=90=8E=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E4=B8=8B=E6=8B=89=E5=88=97=E8=A1=A8=E4=B8=8D?= =?UTF-8?q?=E5=AF=B9=E6=98=BE=E7=A4=BA=E4=BA=86=E9=83=A8=E9=97=A8=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=EF=BC=8C=E6=89=80=E5=B1=9E=E9=83=A8=E9=97=A8=E6=94=BE?= =?UTF-8?q?=E5=9C=A8=E5=88=97=E8=A1=A8=E7=AC=AC=E4=B8=80=E5=88=97=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E9=80=89=E6=8B=A9=E6=89=80=E5=B1=9E=E9=83=A8=E9=97=A8?= =?UTF-8?q?=EF=BC=8C=203.excel=E6=97=B6=E9=95=BF=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E4=B8=AD=E6=98=BE=E7=A4=BA=E4=BA=86=E4=BA=BA?= =?UTF-8?q?=E5=91=98=E5=BA=94=E8=AF=A5=E6=94=BE=E5=88=B0=E8=AE=B2=E5=B8=88?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=204.=E9=80=89=E6=8B=A9=E5=AF=B9=E5=BA=94?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=90=8E=E9=BB=98=E8=AE=A4=E5=B8=A6=E5=87=BA?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=9B=B8=E5=85=B3=E4=BF=A1=E6=81=AF=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/training/components/CoursePanel.vue | 43 +++++++++++++-- .../training/components/LibraryPanel.vue | 4 +- .../src/views/training/trainingTemplates.ts | 3 +- .../application/service/training_template.go | 51 +++++++++++++----- .../training_template_course_library_test.go | 18 ++++--- .../trainingtemplates/course_library.xlsx | Bin 5199 -> 5175 bytes .../trainingtemplates_test.go | 5 +- 7 files changed, 96 insertions(+), 28 deletions(-) diff --git a/frontend/src/views/training/components/CoursePanel.vue b/frontend/src/views/training/components/CoursePanel.vue index 73a3841..cb93d55 100644 --- a/frontend/src/views/training/components/CoursePanel.vue +++ b/frontend/src/views/training/components/CoursePanel.vue @@ -143,8 +143,9 @@
+
+ => { MessagePlugin.warning('缺少课程名称,无法维护课件/试题') return null } + // 000165 复测:先按课程名匹配既有条目并补挂(回写计划),同名课程已存在时 + // 不再另建重复空条目,课件/试题维护落到正确课程 + const byName = libraryCourses.value.find((c) => c.name === name) + if (byName) { + editForm.value.library_course_id = byName.id + activeCourse.value = { ...row, library_course_id: byName.id } + await saveCourse(detailSavePayload({ ...row, library_course_id: byName.id })) + return byName + } assetSaving.value = true try { const created = unwrap(await saveCourseLibraryItem({ @@ -722,7 +734,7 @@ const onChangeMaterial = async (e: Event) => { fd.append('file', file) const updated = unwrap(await uploadCourseLibraryMaterial(lc.id, fd)) as TrainingLibraryCourse | null replaceLibraryCourse(updated) - MessagePlugin.success(`课件已更换为「${updated?.material_name || updated?.file_name || file.name}」,已同步到课程管理「${lc.name}」`) + MessagePlugin.success(`课件已更换为「${updated?.file_name || updated?.material_name || file.name}」,已同步到课程管理「${lc.name}」`) } catch (e: any) { MessagePlugin.error(apiErrorMessage(e, '课件更换失败,请稍后重试')) } finally { @@ -765,6 +777,28 @@ const replaceLibraryCourse = (updated?: TrainingLibraryCourse | null) => { else libraryCourses.value = [...libraryCourses.value, updated] } +// 详情打开回源课程管理(000165 复测):本地列表缓存可能滞后(课件/试题刚在 +// 课程管理或另一计划里更新过),按课程名拉取最新条目替换缓存,课件/试题/适合 +// 人员展示与后续上传落点都跟随最新数据;计划未挂接条目时按名称补挂(回写 +// library_course_id),试题列表一并刷新。失败保持本地缓存展示,不阻断详情打开。 +const refreshDetailLibraryCourse = async (row: TrainingCourse) => { + if (!canManage.value || !row.name) return + try { + const res = unwrap(await listCourseLibrary({ keyword: row.name, page_size: 20 })) + const items = ((unwrap(res)?.items as TrainingLibraryCourse[]) || []) + const hit = items.find((c) => c.id && c.id === row.library_course_id) || items.find((c) => c.name === row.name) + if (!hit) return + replaceLibraryCourse(hit) + if (!row.library_course_id && editForm.value.library_course_id !== hit.id) { + editForm.value.library_course_id = hit.id + activeCourse.value = { ...row, library_course_id: hit.id } + } + loadCourseBanks(editForm.value.library_course_id || '') + } catch { + /* 回源失败保持本地缓存展示 */ + } +} + // ---- 从知识库选择课件/试题(000158):与课程管理同口径(课件 from-kb 挂载, // 试题 KB 文档解析建题库挂课程条目),月计划详情「知识库」入口 ---- const kbRefs = ref({ courseware: null, question_bank: null }) @@ -1668,6 +1702,9 @@ const openDetail = async (row: TrainingCourse) => { } // 课程资产侧信息(000156):适合人员/课件/试题随 library_course_id 展示 loadCourseBanks(row.library_course_id || '') + // 000165 复测:打开详情即回源课程管理最新信息(他人刚更新的课件/试题名称跟随变更); + // 计划未挂接条目时按课程名补挂既有条目,避免资产维护另建重复空条目 + void refreshDetailLibraryCourse(row) // 授课时间回填:优先课程授课时间(期望月份默认值 YYYY-MM 展开为当月 1 日),否则回退最近场次排期 const list = courseSessions.value[row.id] || [] const nearest = list.find((s) => s.status === 'scheduled' && s.start_at) || list.find((s) => s.start_at) || list[0] diff --git a/frontend/src/views/training/components/LibraryPanel.vue b/frontend/src/views/training/components/LibraryPanel.vue index ff7b762..9819c49 100644 --- a/frontend/src/views/training/components/LibraryPanel.vue +++ b/frontend/src/views/training/components/LibraryPanel.vue @@ -242,8 +242,8 @@
- 模板列序与列表字段一致:课程名称(必填)/讲师/课件收集(已有课件或暂无课件)/课程权限/课程分类/类型(必修课或选修课)/线上或线下/时长(学时)/所属部门/课程说明/适合人员备注; - 所属部门、课程分类、类型、线上或线下、讲师、课件收集在模板中支持下拉选择(讲师可选系统员工或直接输入外部姓名);课程权限列填「全部」或部门/人员名(与课程权限下拉同口径,旧模板「适合人员」列同样兼容);适合人员备注列仅做展示说明;分类可填配置中心预设分类或自定义分类,导入后保存;课程编号由系统自动生成。 + 模板列序(000165 复测,无课件收集列,课件导入后在列表「课件」入口上传维护):所属部门(第一列,下拉选择组织架构部门)/课程名称(必填,下拉可选课程管理已有课程,新课程直接填写)/讲师(下拉选系统员工或直接输入外部姓名)/课程权限/课程分类/类型(必修课或选修课)/线上或线下/时长(学时)/课程说明/适合人员备注; + 课程权限列填「全部」或部门/人员名(与课程权限下拉同口径,旧模板「适合人员」列同样兼容);适合人员备注列仅做展示说明;课程分类可填配置中心预设分类或自定义分类,导入后保存;课程编号由系统自动生成。