fix(bug修复):1.如图四所示创建月度计划选择课程管理中的课程时下拉数据只能拉出自己部门课程
deploy-hxtesting / build-and-deploy (push) Successful in 1m12s
deploy-hxtesting / build-and-deploy (push) Successful in 1m12s
2.创建月度培训计划时选择课程默认展示出来的课程信息要能支持修改相关课件信息,及上传课件、试题,(修改上传后需要课长签核) 3.创建好月度计划培训后填写了授课地点但发布时一直提示如图2、3所示! 4.年度、月度培训计划列表中数据要按按计划培训时间来倒序排,创建月度计划培训时计划培训时间默认未授课培训月份!
This commit is contained in:
1 parent
102d94e6c8
commit
f88fce3673
5 files changed
+304
-12
No files matched your search
@@ -122,15 +122,91 @@
|
||||
<t-form-item label="所属部门">
|
||||
<t-input :value="deptNamesOf(form.dept_ids)" disabled placeholder="随课程带出" />
|
||||
</t-form-item>
|
||||
<!-- 课程资产侧信息随所选课程带出(000156):只读展示;维护入口见详情弹窗「更换」或课程管理 -->
|
||||
<!-- 课程资产侧信息随所选课程带出(000156);000163 起课件/试题可在创建时
|
||||
上传/更换(回写课程管理主数据,变更后课程回「待核验」须课长/经理签核) -->
|
||||
<t-form-item label="适合人员">
|
||||
<t-input :value="formLibraryCourse?.suitable_members || '-'" disabled placeholder="随所选课程带出" />
|
||||
</t-form-item>
|
||||
<t-form-item label="课件">
|
||||
<t-input :value="formLibraryCourse?.material_name || formLibraryCourse?.file_name || '-'" disabled placeholder="随所选课程带出" />
|
||||
<div class="asset-row">
|
||||
<t-input
|
||||
:value="formLibraryCourse?.material_name || formLibraryCourse?.file_name || '-'"
|
||||
disabled
|
||||
placeholder="随所选课程带出,可上传/更换"
|
||||
class="asset-value"
|
||||
/>
|
||||
<t-button
|
||||
variant="outline" size="small" :disabled="!form.library_course_id"
|
||||
:loading="formAssetSaving" @click="formMaterialInput?.click()"
|
||||
>上传课件</t-button>
|
||||
<t-button
|
||||
variant="outline" size="small" :disabled="!form.library_course_id"
|
||||
:loading="formAssetSaving" @click="openFormKbCourseware"
|
||||
>知识库</t-button>
|
||||
<input ref="formMaterialInput" type="file" class="hidden-file-input" @change="onFormChangeMaterial" />
|
||||
</div>
|
||||
<div v-if="formKbCoursewareVisible" class="asset-relink">
|
||||
<t-select
|
||||
v-model="formKbCoursewareDocId"
|
||||
filterable
|
||||
clearable
|
||||
:loading="kbDocsLoading"
|
||||
placeholder="选择「企业培训(课件)」知识库文档作为课件"
|
||||
style="flex: 1"
|
||||
>
|
||||
<t-option v-for="doc in kbCoursewareDocs" :key="doc.id" :value="doc.id" :label="doc.file_name" />
|
||||
</t-select>
|
||||
<t-button theme="primary" size="small" :loading="formAssetSaving" :disabled="!formKbCoursewareDocId" @click="onFormAttachKbCourseware">确定</t-button>
|
||||
</div>
|
||||
<div class="bank-hint">课件上传/更换后自动回写课程管理,该课程回「待核验」,需所属部门课长/经理签核后方可发布计划</div>
|
||||
</t-form-item>
|
||||
<t-form-item label="试题">
|
||||
<t-input :value="formCourseBanksText" disabled placeholder="随所选课程带出" />
|
||||
<div class="asset-row">
|
||||
<t-input
|
||||
:value="formCourseBanksText"
|
||||
disabled
|
||||
placeholder="随所选课程带出,可更换"
|
||||
class="asset-value"
|
||||
/>
|
||||
<t-button
|
||||
variant="outline" size="small" :disabled="!form.library_course_id"
|
||||
:loading="formAssetSaving" @click="formRelinkVisible = !formRelinkVisible"
|
||||
>更换试题</t-button>
|
||||
<t-button
|
||||
variant="outline" size="small" :disabled="!form.library_course_id"
|
||||
:loading="formAssetSaving" @click="openFormKbBank"
|
||||
>知识库</t-button>
|
||||
</div>
|
||||
<div v-if="formRelinkVisible" class="asset-relink">
|
||||
<t-select
|
||||
v-model="formRelinkBankId"
|
||||
filterable
|
||||
clearable
|
||||
placeholder="选择题库替换该课程当前试题"
|
||||
style="flex: 1"
|
||||
>
|
||||
<t-option
|
||||
v-for="b in allBanks"
|
||||
:key="b.id"
|
||||
:value="b.id"
|
||||
:label="`${b.name}(${b.question_count}题)`"
|
||||
/>
|
||||
</t-select>
|
||||
<t-button theme="primary" size="small" :loading="formAssetSaving" :disabled="!formRelinkBankId" @click="onFormRelinkBank">确认更换</t-button>
|
||||
</div>
|
||||
<div v-if="formKbBankVisible" class="asset-relink">
|
||||
<t-select
|
||||
v-model="formKbBankDocId"
|
||||
filterable
|
||||
clearable
|
||||
:loading="kbDocsLoading"
|
||||
placeholder="选择「企业培训(题库)」知识库文档解析建题库"
|
||||
style="flex: 1"
|
||||
>
|
||||
<t-option v-for="doc in kbBankDocs" :key="doc.id" :value="doc.id" :label="doc.file_name" />
|
||||
</t-select>
|
||||
<t-button theme="primary" size="small" :loading="formAssetSaving" :disabled="!formKbBankDocId" @click="onFormImportKbBank">确定</t-button>
|
||||
</div>
|
||||
</t-form-item>
|
||||
<t-form-item label="学时 / 学分">
|
||||
<t-input-number v-model="form.hours" :min="0" :step="0.5" :disabled="!form.library_course_id" style="width: 48%" />
|
||||
@@ -203,7 +279,7 @@
|
||||
</div>
|
||||
</t-form-item>
|
||||
</t-form>
|
||||
<div class="form-hint">发布后将自动生成计划与学员名单(线下计划含签到码),并推送讲师与学员通知;适合人员/课件/试题随所选课程自动带出,详情弹窗可更换(自动同步课程管理),选择课程时自动带出。</div>
|
||||
<div class="form-hint">发布后将自动生成计划与学员名单(线下计划含签到码),并推送讲师与学员通知;课程信息随所选课程带出,课件/试题可在本弹窗上传/更换(自动同步课程管理,变更后该课程回「待核验」,需课长/经理重新签核后方可发布)。</div>
|
||||
<template #footer>
|
||||
<t-button variant="outline" @click="formVisible = false">暂存草稿</t-button>
|
||||
<t-button theme="primary" :loading="saving" @click="onSave">保存并发布</t-button>
|
||||
@@ -500,7 +576,7 @@ import {
|
||||
import { fmtBeijingTime } from '@/utils/datetime'
|
||||
import { apiErrorMessage, get } from '@/utils/request'
|
||||
import TrainingPagination from './TrainingPagination.vue'
|
||||
import { useTrainingPager } from './useTrainingPager'
|
||||
import { plannedMonthSortKey, useTrainingPager } from './useTrainingPager'
|
||||
|
||||
const props = defineProps<{ roles: string[]; admin?: boolean }>()
|
||||
// 课程维护:人事/课长/讲师(roles 已按权限组展开,经理经课长继承自动命中);
|
||||
@@ -787,6 +863,136 @@ const formVisible = ref(false)
|
||||
const sessionsVisible = ref(false)
|
||||
const activeCourse = ref<TrainingCourse | null>(null)
|
||||
|
||||
// ---- 创建弹窗课件/试题维护(000163):与调整弹窗同口径,直接回写课程管理
|
||||
// 主数据;课件/试题变更后端自动置该课程「待核验」,须课长/经理签核后方可发布 ----
|
||||
const formAssetSaving = ref(false)
|
||||
const formMaterialInput = ref<HTMLInputElement | null>(null)
|
||||
const formKbCoursewareVisible = ref(false)
|
||||
const formKbCoursewareDocId = ref('')
|
||||
const formRelinkVisible = ref(false)
|
||||
const formRelinkBankId = ref('')
|
||||
const formKbBankVisible = ref(false)
|
||||
const formKbBankDocId = ref('')
|
||||
|
||||
// 创建弹窗目标课程条目:未选课程时按钮已禁用,这里兜底提示
|
||||
const requireFormLibraryCourse = (): TrainingLibraryCourse | null => {
|
||||
const lc = formLibraryCourse.value
|
||||
if (!lc) MessagePlugin.warning('请先从课程管理选择课程')
|
||||
return lc || null
|
||||
}
|
||||
|
||||
const openFormKbCourseware = async () => {
|
||||
formKbCoursewareVisible.value = !formKbCoursewareVisible.value
|
||||
formKbBankVisible.value = false
|
||||
if (!formKbCoursewareVisible.value) return
|
||||
await ensureKbRefs()
|
||||
await loadKbDocs('courseware')
|
||||
}
|
||||
|
||||
const openFormKbBank = async () => {
|
||||
formKbBankVisible.value = !formKbBankVisible.value
|
||||
formKbCoursewareVisible.value = false
|
||||
if (!formKbBankVisible.value) return
|
||||
await ensureKbRefs()
|
||||
await loadKbDocs('question_bank')
|
||||
}
|
||||
|
||||
// 上传课件:文件直接回写课程管理条目(名称登记为空时后端以文件名兜底)
|
||||
const onFormChangeMaterial = async (e: Event) => {
|
||||
const input = e.target as HTMLInputElement
|
||||
const file = input.files?.[0]
|
||||
input.value = ''
|
||||
const lc = requireFormLibraryCourse()
|
||||
if (!lc || !file) return
|
||||
formAssetSaving.value = true
|
||||
try {
|
||||
const fd = new FormData()
|
||||
fd.append('file', file)
|
||||
const updated = unwrap(await uploadCourseLibraryMaterial(lc.id, fd)) as TrainingLibraryCourse | null
|
||||
replaceLibraryCourse(updated)
|
||||
MessagePlugin.success(`课件已上传到课程「${lc.name}」,该课程回「待核验」,需所属部门课长/经理签核后方可发布计划`)
|
||||
} catch (e: any) {
|
||||
MessagePlugin.error(apiErrorMessage(e, '课件上传失败,请稍后重试'))
|
||||
} finally {
|
||||
formAssetSaving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 从知识库选文档挂为课件(与上传同口径,变更后回「待核验」)
|
||||
const onFormAttachKbCourseware = async () => {
|
||||
const lc = requireFormLibraryCourse()
|
||||
const doc = kbCoursewareDocs.value.find((d) => d.id === formKbCoursewareDocId.value)
|
||||
if (!lc || !doc) {
|
||||
if (lc && !doc) MessagePlugin.warning('请先选择知识库课件文档')
|
||||
return
|
||||
}
|
||||
formAssetSaving.value = true
|
||||
try {
|
||||
const updated = unwrap(await attachCourseLibraryMaterialFromKb(lc.id, { knowledge_id: doc.id })) as TrainingLibraryCourse | null
|
||||
replaceLibraryCourse(updated)
|
||||
formKbCoursewareVisible.value = false
|
||||
formKbCoursewareDocId.value = ''
|
||||
MessagePlugin.success(`课件已更换为知识库文档「${doc.file_name}」,课程「${lc.name}」回「待核验」,需课长/经理签核后方可发布计划`)
|
||||
} catch (e: any) {
|
||||
MessagePlugin.error(apiErrorMessage(e, '课件更换失败,请稍后重试'))
|
||||
} finally {
|
||||
formAssetSaving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 更换试题:所选题库整体替换该课程条目的题库(后端同步重置签核状态)
|
||||
const onFormRelinkBank = async () => {
|
||||
const lc = requireFormLibraryCourse()
|
||||
if (!lc || !formRelinkBankId.value) {
|
||||
if (lc && !formRelinkBankId.value) MessagePlugin.warning('请先选择要挂接的题库')
|
||||
return
|
||||
}
|
||||
formAssetSaving.value = true
|
||||
try {
|
||||
const banks = (unwrap(await linkLibraryCourseQuestionBank(lc.id, formRelinkBankId.value)) || []) as TrainingQuestionBank[]
|
||||
// 同步本地题库总表的挂接关系(与调整弹窗 onRelinkBank 同口径)
|
||||
const linked = new Set(banks.map((b) => b.id))
|
||||
allBanks.value = allBanks.value.map((b) => {
|
||||
if (b.library_course_id === lc.id) return { ...b, library_course_id: linked.has(b.id) ? b.id : '' }
|
||||
if (b.id === formRelinkBankId.value) return { ...b, library_course_id: lc.id }
|
||||
return b
|
||||
})
|
||||
formRelinkVisible.value = false
|
||||
formRelinkBankId.value = ''
|
||||
MessagePlugin.success(`试题已更换到课程「${lc.name}」,该课程回「待核验」,需课长/经理签核后方可发布计划`)
|
||||
} catch (e: any) {
|
||||
MessagePlugin.error(apiErrorMessage(e, '试题更换失败,请稍后重试'))
|
||||
} finally {
|
||||
formAssetSaving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 从知识库题库文档解析建题库并挂当前所选课程条目(后端同步重置签核状态)
|
||||
const onFormImportKbBank = async () => {
|
||||
const lc = requireFormLibraryCourse()
|
||||
const doc = kbBankDocs.value.find((d) => d.id === formKbBankDocId.value)
|
||||
if (!lc || !doc) {
|
||||
if (lc && !doc) MessagePlugin.warning('请先选择知识库题库文档')
|
||||
return
|
||||
}
|
||||
formAssetSaving.value = true
|
||||
try {
|
||||
const bank = unwrap(await importQuestionBankFromKnowledge({
|
||||
knowledge_id: doc.id,
|
||||
name: doc.file_name.replace(/\.[^.]+$/, ''),
|
||||
library_course_id: lc.id,
|
||||
})) as TrainingQuestionBank | null
|
||||
formKbBankVisible.value = false
|
||||
formKbBankDocId.value = ''
|
||||
if (bank) allBanks.value = [bank, ...allBanks.value.filter((b) => b.id !== bank.id)]
|
||||
MessagePlugin.success(`试题已更换为知识库题库「${bank?.name || doc.file_name}」,课程「${lc.name}」回「待核验」,需课长/经理签核后方可发布计划`)
|
||||
} catch (e: any) {
|
||||
MessagePlugin.error(apiErrorMessage(e, '试题更换失败,请稍后重试'))
|
||||
} finally {
|
||||
formAssetSaving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 讲师只读展示:员工名册映射姓名,外部讲师直接显示
|
||||
const lecturerDisplay = (lecturerId: string) => {
|
||||
if (lecturerId) {
|
||||
@@ -911,6 +1117,13 @@ const onLibraryCourseChange = (libraryCourseId: unknown) => {
|
||||
form.value.lecturer_id = lc?.lecturer_id || ''
|
||||
form.value.description = lc?.description || ''
|
||||
form.value.dept_ids = lc?.owner_dept_id ? [lc.owner_dept_id] : []
|
||||
// 换选课程后重置课件/试题维护的临时选择状态(000163)
|
||||
formKbCoursewareVisible.value = false
|
||||
formKbCoursewareDocId.value = ''
|
||||
formRelinkVisible.value = false
|
||||
formRelinkBankId.value = ''
|
||||
formKbBankVisible.value = false
|
||||
formKbBankDocId.value = ''
|
||||
}
|
||||
|
||||
// 「前往课程管理」:切到课程管理子页(同页内由 Training 按路由 tab 切换面板)
|
||||
@@ -1052,10 +1265,17 @@ const teachDateValue = (row: TrainingCourse): string | null => {
|
||||
return shown ? shown.replaceAll('/', '-').slice(0, 10) : null
|
||||
}
|
||||
|
||||
// 计划培训时间排序键:计划培训时间优先,缺失时回退授课时间(含最近场次)
|
||||
const courseSortKey = (row: TrainingCourse): number => {
|
||||
const pk = plannedMonthSortKey(row.planned_time)
|
||||
if (pk >= 0) return pk
|
||||
return plannedMonthSortKey(row.teach_time || teachDateValue(row))
|
||||
}
|
||||
|
||||
const filteredCourses = computed(() => {
|
||||
const kw = filters.value.keyword.trim().toLowerCase()
|
||||
const months = filters.value.months || []
|
||||
return courses.value.filter((row) => {
|
||||
const list = courses.value.filter((row) => {
|
||||
if (kw && !(row.name || '').toLowerCase().includes(kw)) return false
|
||||
if (filters.value.lecturerId && row.lecturer_id !== filters.value.lecturerId) return false
|
||||
if (filters.value.status && row.status !== filters.value.status) return false
|
||||
@@ -1066,6 +1286,8 @@ const filteredCourses = computed(() => {
|
||||
}
|
||||
return true
|
||||
})
|
||||
// 000163:按计划培训时间倒序(缺失计划培训时间的行按授课时间,均无则排最后)
|
||||
return list.slice().sort((a, b) => courseSortKey(b) - courseSortKey(a))
|
||||
})
|
||||
|
||||
// 共用分页(000163):计划列表默认每页 15 条
|
||||
@@ -1140,7 +1362,9 @@ const loadAll = async () => {
|
||||
listMembers({ page_size: 500 }),
|
||||
listLecturers().catch(() => []),
|
||||
listSessions({ year: 0, month: 0 }).catch(() => []),
|
||||
listCourseLibrary({ page_size: 500 }).catch(() => null),
|
||||
// scope=plan(000163):创建月度计划选课口径 —— 维护角色可选全部部门课程,
|
||||
// 不再按本部门收窄(后端对纯学员/无维护角色调用方仍按原范围收窄)
|
||||
listCourseLibrary({ page_size: 500, scope: 'plan' }).catch(() => null),
|
||||
listQuestionBanks({ page_size: 200 }).catch(() => null),
|
||||
])
|
||||
courses.value = unwrap(c)?.items || []
|
||||
@@ -1162,6 +1386,13 @@ const openCreate = (mode: 'offline' | 'online') => {
|
||||
description: '',
|
||||
}
|
||||
resetFormParticipants()
|
||||
// 重置课件/试题维护临时状态(000163),避免上一次打开的残留选择
|
||||
formKbCoursewareVisible.value = false
|
||||
formKbCoursewareDocId.value = ''
|
||||
formRelinkVisible.value = false
|
||||
formRelinkBankId.value = ''
|
||||
formKbBankVisible.value = false
|
||||
formKbBankDocId.value = ''
|
||||
formVisible.value = true
|
||||
}
|
||||
|
||||
@@ -1220,6 +1451,11 @@ const onSave = async () => {
|
||||
dept_ids: form.value.dept_ids,
|
||||
lecturer_id: form.value.lecturer_id || undefined,
|
||||
teach_time: teachTimeOf(form.value),
|
||||
// 000163 根因修复:授课地点须随课程落库(此前只写到场次,发布校验读
|
||||
// course.location 恒为空,导致「已填授课地点仍提示需先设置授课地点」)
|
||||
location: form.value.mode === 'offline' ? form.value.location.trim() : '',
|
||||
// 000163:计划培训时间默认取授课时间所在月份(YYYY-MM)
|
||||
planned_time: form.value.start_at ? form.value.start_at.slice(0, 7) : '',
|
||||
post_scope: postScope,
|
||||
// 课程管理关联(服务端据此带出并锁定课程信息,自动生成计划编号)
|
||||
library_course_id: form.value.library_course_id,
|
||||
@@ -1519,7 +1755,11 @@ const detailSavePayload = (row: TrainingCourse) => {
|
||||
// 其余需求确认同步字段原样透传(详情表单不编辑,防止保存时被零值覆盖丢失)
|
||||
train_type: row.train_type || '',
|
||||
plant: row.plant || '',
|
||||
location: row.location || '',
|
||||
// 000163:授课地点随课程落库(发布校验读 course.location;此前只写场次,
|
||||
// 「调整」里改了授课地点发布仍提示未设置)
|
||||
location: editForm.value.mode === 'offline'
|
||||
? (editForm.value.location.trim() || row.location || '')
|
||||
: (row.location || ''),
|
||||
session_count: row.session_count || 0,
|
||||
// 000161 讲师计划侧可改:名册 id 或外部讲师姓名
|
||||
lecturer_external: lecturer.external,
|
||||
|
||||
@@ -253,7 +253,7 @@ import { fmtBeijingTime } from '@/utils/datetime'
|
||||
import { DEMAND_TEMPLATE_KEY, downloadTrainingTemplate } from '../trainingTemplates'
|
||||
import { apiErrorMessage } from '@/utils/request'
|
||||
import TrainingPagination from './TrainingPagination.vue'
|
||||
import { useTrainingPager } from './useTrainingPager'
|
||||
import { plannedMonthSortKey, useTrainingPager } from './useTrainingPager'
|
||||
import {
|
||||
broadcastTrainingNotification,
|
||||
confirmDemand,
|
||||
@@ -519,7 +519,10 @@ const buildDemandQuery = () => {
|
||||
|
||||
const loadDemands = async () => {
|
||||
const d = await listDemands(buildDemandQuery())
|
||||
demands.value = unwrap(d)?.items || []
|
||||
// 000163:按计划培训月份倒序(2027-12 → 2027-1,无计划培训时间的排最后)
|
||||
const items = (unwrap(d)?.items || []) as TrainingDemand[]
|
||||
demands.value = items.slice()
|
||||
.sort((a, b) => plannedMonthSortKey(b.planned_time) - plannedMonthSortKey(a.planned_time))
|
||||
}
|
||||
|
||||
// 共用分页(000163):需求列表默认每页 15 条;查询条件/年度切换后回到第 1 页
|
||||
|
||||
@@ -33,3 +33,13 @@ export function useTrainingPager<T>(source: Ref<T[]> | (() => T[])) {
|
||||
|
||||
return { page, pageSize, total, paged, reset }
|
||||
}
|
||||
|
||||
/**
|
||||
* 计划培训时间排序键(000163):「2027-1」「2027-11」「2027-03-15 14:00」等
|
||||
* 统一解析为「年×12+月」序号,供列表按计划培训时间倒序排列(字符串直排会把
|
||||
* 2027-2 排到 2027-12 之后);无法解析返回 -1(无计划培训时间的行排最后)。
|
||||
*/
|
||||
export function plannedMonthSortKey(value?: string | null): number {
|
||||
const m = (value || '').trim().match(/^(\d{4})-(\d{1,2})/)
|
||||
return m ? Number(m[1]) * 12 + Number(m[2]) : -1
|
||||
}
|
||||
@@ -175,7 +175,33 @@ func (s *trainingService) ImportQuestionBankFromKnowledge(ctx context.Context, t
|
||||
libraryCourseID = oldLibraryCourseID
|
||||
}
|
||||
bank := &types.TrainingQuestionBank{Name: name, CourseID: courseID, LibraryCourseID: libraryCourseID, KnowledgeID: knowledgeID}
|
||||
return s.ImportQuestionBank(ctx, tenantID, bank, questions, updaterID)
|
||||
created, err := s.ImportQuestionBank(ctx, tenantID, bank, questions, updaterID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// 试题变更回待核验(000163):同课件「换课件即回待核验」口径,导入后须
|
||||
// 所属部门课长/经理重新签核,课程方可发布。
|
||||
s.resetLibraryCourseVerify(ctx, tenantID, created.LibraryCourseID)
|
||||
return created, nil
|
||||
}
|
||||
|
||||
// resetLibraryCourseVerify 课程管理条目试题变更后重置签核状态(000163):
|
||||
// 更换/导入题库同课件变更口径回「待核验」。fail-open:条目缺失或回写失败
|
||||
// 仅记日志,不阻断题库操作本身。
|
||||
func (s *trainingService) resetLibraryCourseVerify(ctx context.Context, tenantID uint64, libraryCourseID string) {
|
||||
if libraryCourseID == "" {
|
||||
return
|
||||
}
|
||||
item, err := s.repo.GetCourseLibraryItem(ctx, tenantID, libraryCourseID)
|
||||
if err != nil || item == nil {
|
||||
return
|
||||
}
|
||||
item.VerifyStatus = types.CourseLibraryVerifyPending
|
||||
item.ConfirmedBy = ""
|
||||
item.ConfirmedAt = nil
|
||||
if err := s.repo.UpdateCourseLibraryItem(ctx, item); err != nil {
|
||||
logger.Warnf(ctx, "[Training] reset library course verify failed, tenant=%d course=%s err=%v", tenantID, libraryCourseID, err)
|
||||
}
|
||||
}
|
||||
|
||||
// ListLibraryCourseQuestionBanks 课程管理条目下的题库列表(试题维护抽屉,000153)。
|
||||
@@ -188,6 +214,7 @@ func (s *trainingService) ListLibraryCourseQuestionBanks(ctx context.Context, te
|
||||
|
||||
// LinkQuestionBankToLibraryCourse 更换课程管理条目的试题(000156):所选题库整体
|
||||
// 替换该条目当前挂接的题库,回写课程管理资产(月计划侧更换入口)。
|
||||
// 更换后重置签核状态(000163):同课件变更口径,须课长/经理重新签核方可发布。
|
||||
func (s *trainingService) LinkQuestionBankToLibraryCourse(ctx context.Context, tenantID uint64, libraryCourseID, bankID string) error {
|
||||
if libraryCourseID == "" {
|
||||
return errors.NewBadRequestError("缺少课程管理条目")
|
||||
@@ -195,7 +222,11 @@ func (s *trainingService) LinkQuestionBankToLibraryCourse(ctx context.Context, t
|
||||
if _, err := s.repo.GetQuestionBank(ctx, tenantID, bankID); err != nil {
|
||||
return errors.NewNotFoundError("题库不存在")
|
||||
}
|
||||
return s.repo.RelinkQuestionBankToLibraryCourse(ctx, tenantID, libraryCourseID, bankID)
|
||||
if err := s.repo.RelinkQuestionBankToLibraryCourse(ctx, tenantID, libraryCourseID, bankID); err != nil {
|
||||
return err
|
||||
}
|
||||
s.resetLibraryCourseVerify(ctx, tenantID, libraryCourseID)
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeleteQuestionBank 删除题库(连带题目与缓存试卷;试题维护抽屉删除入口,000153)。
|
||||
|
||||
@@ -88,6 +88,14 @@ func (h *Handler) ListCourseLibrary(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if q.Scope == "plan" {
|
||||
// scope=plan(000163)创建月度计划选课口径:月培训计划维护角色(人事/课长/
|
||||
// 经理/讲师)可选全部部门的课程,不再按本部门收窄;纯学员/无维护角色
|
||||
// 调用方保持原数据范围,不放大数据可见性。
|
||||
if !h.requireRoles(c, types.TrainingRoleHR, types.TrainingRoleSupervisor, types.TrainingRoleLecturer) {
|
||||
return
|
||||
}
|
||||
q.DeptID, q.RelatedUserID = "", ""
|
||||
} else {
|
||||
q.DeptID, q.RelatedUserID = h.callerCourseLibraryScope(c)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user