1.”课程编号、课程名称、所属部门、说明、课程权限、分类、类型、线上/线下、讲师、时长、课件、试题、发布状态、创建时间、创建人“可滑动部分字段从左到右顺序”课程编号、课程名称、讲师、课件、试题、课程权限、分类、类型、线上/线下、时长、发布状态、创建时间、创建人、所属部门、说明“ 2.增加一个字段适合人员作为备注字段承接”年培训计划“和”月培训计划“过来的”适合人员“信息只做展示用,支持用户自定义录入, 3.”课程权限“默认当前所示部门,“全部”选项放在下拉列最前面排在部门选项上面 4.列表右侧固定字段“状态”、“操作”宽度再收窄一些 5.审核时要校验“课程名称、所属部门、课程权限、课件”必填!所属部门默认当前录入人员所属部门支持修改,课程权限也是默认当前录入人员所属部门支持修改
This commit is contained in:
1 parent
2f1cda34da
commit
0427a60bc3
13 files changed
+179
-49
No files matched your search
@@ -687,6 +687,8 @@ const ensureLibraryCourse = async (): Promise<TrainingLibraryCourse | null> => {
|
||||
type: editForm.value.type === 'elective' ? 'elective' : 'required',
|
||||
hours: editForm.value.hours || 0,
|
||||
description: row.description || '',
|
||||
// 适合人员备注(000165):计划参加人员名单同步为课程管理「适合人员」展示
|
||||
post_scope: (row.post_scope || '').slice(0, 500),
|
||||
})) as TrainingLibraryCourse | null
|
||||
if (!created) throw new Error('create library course failed')
|
||||
replaceLibraryCourse(created)
|
||||
|
||||
@@ -60,6 +60,13 @@
|
||||
</t-tooltip>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
<!-- 适合人员备注(000165):承接年/月培训计划「适合人员」,只做展示 -->
|
||||
<template #post_scope="{ row }">
|
||||
<t-tooltip v-if="row.post_scope" :content="row.post_scope">
|
||||
<span class="cell-ellipsis">{{ row.post_scope }}</span>
|
||||
</t-tooltip>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
<template #category="{ row }">
|
||||
<t-tag v-if="row.category" theme="primary" variant="light" size="small">{{ row.category }}</t-tag>
|
||||
<span v-else>-</span>
|
||||
@@ -157,11 +164,11 @@
|
||||
<t-input v-model="form.name" placeholder="请输入课程名称" />
|
||||
</t-form-item>
|
||||
<t-form-item label="所属部门">
|
||||
<!-- 对应需求表「主办单位」:锁定为创建人(当前登录人)所属部门,不可修改
|
||||
(000160,服务端同口径强制;无部门档案时可手动选择) -->
|
||||
<!-- 对应需求表「主办单位」:默认创建人(当前登录人)所属部门,支持修改
|
||||
(000165;审核前必填,审核校验兜底;仅传部门名时服务端按组织架构解析) -->
|
||||
<t-select
|
||||
v-model="form.owner_dept_id" :disabled="Boolean(myDeptId)" :clearable="!myDeptId"
|
||||
filterable :placeholder="myDeptId ? '创建人所属部门(不可修改)' : '从组织架构选择所属部门(选填)'" style="width: 100%"
|
||||
v-model="form.owner_dept_id" clearable filterable
|
||||
placeholder="默认当前登录人所属部门,可选其他部门" style="width: 100%"
|
||||
>
|
||||
<t-option v-for="d in depts" :key="d.id" :value="d.id" :label="d.name" />
|
||||
</t-select>
|
||||
@@ -169,6 +176,14 @@
|
||||
<t-form-item label="说明">
|
||||
<t-textarea v-model="form.description" placeholder="课程内容简介(选填)" :autosize="{ minRows: 2 }" />
|
||||
</t-form-item>
|
||||
<t-form-item label="适合人员">
|
||||
<!-- 备注字段(000165):承接年/月培训计划的「适合人员」信息,只做展示,
|
||||
不参与课程权限过滤;支持自定义录入 -->
|
||||
<t-textarea
|
||||
v-model="form.post_scope" placeholder="适合人员备注(选填,仅展示;可见范围请用「课程权限」控制)"
|
||||
:maxlength="500" :autosize="{ minRows: 2 }"
|
||||
/>
|
||||
</t-form-item>
|
||||
<t-form-item label="课程权限">
|
||||
<!-- 000163 课程权限(原「适合人员」):默认所属部门;可同时选择部门和
|
||||
人员,部门与其下人员互斥(选了部门即覆盖其全员,不能再重复选该
|
||||
@@ -224,7 +239,7 @@
|
||||
<t-input-number v-model="form.hours" :min="0" :step="0.5" style="width: 100%" />
|
||||
</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>
|
||||
@@ -686,6 +701,12 @@ const parsePermFromRow = (row?: TrainingLibraryCourse): string[] => {
|
||||
}
|
||||
out.push(n)
|
||||
}
|
||||
// 000165:存量行权限为空时同样默认所属部门(优先行部门,无则当前登录人部门),
|
||||
// 与「课程权限默认部门」口径一致,编辑补齐后再审核
|
||||
if (!out.length) {
|
||||
const fallback = row.owner_dept_id || myDeptId.value
|
||||
if (fallback) out.push(`dept:${fallback}`)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
@@ -793,29 +814,31 @@ watch(filteredItems, resetItemPage)
|
||||
const columns = [
|
||||
// 批量勾选列(000157):配合批量审核/批量删除
|
||||
{ colKey: 'row-select', type: 'multiple', width: 44 },
|
||||
// 左侧列不固定(000154):课程编号/课程名称随横向滚动,操作仍固定右侧
|
||||
// 左侧列不固定(000154),列序 000165 调整:编号/名称/讲师/课件/试题/权限/
|
||||
// 分类/类型/线上线下/时长/发布状态/创建时间/创建人/所属部门/说明(适合人员备注置尾)
|
||||
{ colKey: 'code', title: '课程编号', width: 105 },
|
||||
{ colKey: 'name', title: '课程名称', width: 170 },
|
||||
{ colKey: 'owner_dept', title: '所属部门', width: 110 },
|
||||
{ colKey: 'description', title: '说明', width: 200 },
|
||||
{ colKey: 'lecturer', title: '讲师', width: 110 },
|
||||
// 课件/试题只展示有/无:有=已上传课件或已关联题库,点击直达对应维护抽屉
|
||||
{ colKey: 'material', title: '课件', width: 70 },
|
||||
{ colKey: 'question', title: '试题', width: 70 },
|
||||
{ colKey: 'suitable_members', title: '课程权限', width: 110 },
|
||||
{ colKey: 'category', title: '分类', width: 120 },
|
||||
{ colKey: 'type', title: '类型', width: 84 },
|
||||
{ colKey: 'mode', title: '线上/线下', width: 92 },
|
||||
{ colKey: 'lecturer', title: '讲师', width: 110 },
|
||||
{ colKey: 'hours', title: '时长', width: 84 },
|
||||
// 课件/试题只展示有/无:有=已上传课件或已关联题库,点击直达对应维护抽屉
|
||||
{ colKey: 'material', title: '课件', width: 70 },
|
||||
{ colKey: 'question', title: '试题', width: 70 },
|
||||
// 发布状态(000154):已发布的课程进入培训中心「和信课程」目录
|
||||
{ colKey: 'publish_status', title: '发布状态', width: 90 },
|
||||
{ colKey: 'created_at', title: '创建时间', width: 140 },
|
||||
// 创建人(联查 users):记录课程录入人员
|
||||
{ colKey: 'creator_name', title: '创建人', width: 96 },
|
||||
// 000163 右侧固定区收缩(参考年培训计划页):状态 84,操作收窄至够用,
|
||||
// 按钮紧凑排布(见下方样式),消除固定区的空白浪费
|
||||
{ colKey: 'verify_status', title: '状态', width: 84, fixed: 'right' },
|
||||
{ colKey: 'op', title: '操作', width: 260, fixed: 'right', className: 'op-cell' },
|
||||
{ colKey: 'owner_dept', title: '所属部门', width: 110 },
|
||||
{ colKey: 'description', title: '说明', width: 200 },
|
||||
// 适合人员备注(000165):承接年/月培训计划「适合人员」+ 自定义录入,只做展示
|
||||
{ colKey: 'post_scope', title: '适合人员', width: 140 },
|
||||
// 000165 右侧固定区再收窄:状态 72,操作 224(行内至多 5 个文本按钮,紧凑排布见样式)
|
||||
{ colKey: 'verify_status', title: '状态', width: 72, fixed: 'right' },
|
||||
{ colKey: 'op', title: '操作', width: 224, fixed: 'right', className: 'op-cell' },
|
||||
]
|
||||
|
||||
const lecturerText = (row: TrainingLibraryCourse) =>
|
||||
@@ -861,6 +884,8 @@ const form = ref({
|
||||
// 课程权限(000163):部门/人员 id 列表(逗号分隔),随保存落库
|
||||
perm_dept_ids: '',
|
||||
perm_user_ids: '',
|
||||
// 适合人员备注(000165):承接年/月培训计划「适合人员」,只做展示,支持自定义录入
|
||||
post_scope: '',
|
||||
category: '',
|
||||
type: 'required' as 'required' | 'elective',
|
||||
// 新增默认「线上」(000162):线上课为常规形态;编辑随原值
|
||||
@@ -921,13 +946,16 @@ const openForm = (row?: TrainingLibraryCourse) => {
|
||||
id: row?.id || '',
|
||||
code: row?.code || '',
|
||||
name: row?.name || '',
|
||||
// 新增默认当前登录用户所在部门(锁定不可改);编辑保持原部门
|
||||
owner_dept_id: row?.owner_dept_id || (row ? '' : myDeptId.value),
|
||||
// 所属部门默认当前登录人所在部门,支持修改(000165);编辑保持原部门,
|
||||
// 原部门为空的存量行同样回落默认,便于补齐审核必填项
|
||||
owner_dept_id: row?.owner_dept_id || myDeptId.value,
|
||||
description: row?.description || '',
|
||||
// 课程权限(000163):新增默认所属部门;编辑按 perm 两列回显(存量回退解析)
|
||||
suitable_members: row?.suitable_members || '',
|
||||
perm_dept_ids: row?.perm_dept_ids || '',
|
||||
perm_user_ids: row?.perm_user_ids || '',
|
||||
// 适合人员备注(000165):编辑回显,新增留空
|
||||
post_scope: row?.post_scope || '',
|
||||
category: row?.category || '',
|
||||
type: row?.type === 'elective' ? 'elective' : 'required',
|
||||
// 新增默认「线上」(000162);编辑随原值
|
||||
@@ -970,6 +998,8 @@ const onSave = async () => {
|
||||
suitable_members: form.value.suitable_members.trim(),
|
||||
perm_dept_ids: form.value.perm_dept_ids,
|
||||
perm_user_ids: form.value.perm_user_ids,
|
||||
// 适合人员备注(000165):随保存落库
|
||||
post_scope: form.value.post_scope.trim(),
|
||||
category: form.value.category.trim(),
|
||||
type: form.value.type,
|
||||
mode: form.value.mode,
|
||||
@@ -1012,10 +1042,20 @@ const onDelete = async (row: TrainingLibraryCourse) => {
|
||||
const selectedKeys = ref<string[]>([])
|
||||
const batchSaving = ref(false)
|
||||
|
||||
// 审核前置校验(000165):课程名称/所属部门/课程权限/课件必填,返回首个未满足项的提示
|
||||
const verifyBlockerOf = (row: TrainingLibraryCourse): string => {
|
||||
if (!(row.name || '').trim()) return '未填写课程名称'
|
||||
if (!(row.owner_dept_id || '').trim()) return '未设置所属部门,请先在「编辑」中设置所属部门'
|
||||
if (!hasPermSet(row)) return '未设置课程权限,请先在「编辑」中设置课程权限'
|
||||
if (!hasMaterial(row)) return '未上传课件,请先在列表「课件」入口上传课件'
|
||||
return ''
|
||||
}
|
||||
|
||||
const onVerify = async (row: TrainingLibraryCourse) => {
|
||||
// 审核前置(000163):课程权限必填,未设置先去编辑设置
|
||||
if (!hasPermSet(row)) {
|
||||
MessagePlugin.warning(`课程「${row.name}」未设置课程权限,请先在「编辑」中设置课程权限后再审核`)
|
||||
// 审核前置(000165):名称/所属部门/课程权限/课件必填,先补齐再审核
|
||||
const blocker = verifyBlockerOf(row)
|
||||
if (blocker) {
|
||||
MessagePlugin.warning(`课程「${row.name}」${blocker}后再审核`)
|
||||
return
|
||||
}
|
||||
try {
|
||||
@@ -1043,10 +1083,14 @@ const onBatchVerify = async () => {
|
||||
MessagePlugin.warning('请先勾选本部门待审核状态的课程')
|
||||
return
|
||||
}
|
||||
// 课程权限必填(000163):未设置权限的行先行拦截并提示
|
||||
const noPerm = rows.filter((r) => !hasPermSet(r))
|
||||
if (noPerm.length) {
|
||||
MessagePlugin.warning(`课程「${noPerm.map((r) => r.name).join('、')}」未设置课程权限,请先设置后再审核`)
|
||||
// 审核前置(000165):名称/所属部门/课程权限/课件必填,列出不满足的行并拦截
|
||||
const blockers = rows
|
||||
.map((r) => ({ name: r.name, reason: verifyBlockerOf(r) }))
|
||||
.filter((b) => b.reason)
|
||||
if (blockers.length) {
|
||||
MessagePlugin.warning(
|
||||
`${blockers.map((b) => `课程「${b.name}」${b.reason}`).join(';')}。请先补齐后再批量审核`,
|
||||
)
|
||||
return
|
||||
}
|
||||
batchSaving.value = true
|
||||
@@ -1939,12 +1983,18 @@ onMounted(loadAll)
|
||||
|
||||
// 000163 操作列按钮紧凑排布:缩小左右内边距并固定按钮间距,
|
||||
// 使右侧固定区(状态 84 + 操作 260)收窄至够用,不再出现大片空白
|
||||
/* 000165 操作列收窄至 224:行内至多 5 个文本按钮(编辑/课件/试题/审核或下线/删除),
|
||||
单元格留白与按钮间距同步收紧避免换行 */
|
||||
.library-panel :deep(.op-cell) {
|
||||
padding: 4px 6px;
|
||||
}
|
||||
|
||||
.library-panel :deep(.op-cell .t-button) {
|
||||
padding: 0 5px;
|
||||
padding: 0 4px;
|
||||
}
|
||||
|
||||
.library-panel :deep(.op-cell .t-button + .t-button) {
|
||||
margin-left: 8px;
|
||||
margin-left: 6px;
|
||||
}
|
||||
|
||||
// 批量导入弹窗:模板下载 + Excel 上传一行排布(与培训计划导入同款)
|
||||
|
||||
@@ -386,9 +386,11 @@ const onDemandCourseChange = (name: unknown) => {
|
||||
const course = libraryCourses.value.find((c) => c.name === name)
|
||||
if (!course) return
|
||||
demandForm.value.category = course.category || ''
|
||||
if (course.suitable_members) {
|
||||
demandForm.value.post_scope = course.suitable_members
|
||||
demandSuitableList.value = splitSuitable(course.suitable_members)
|
||||
// 适合人员(000165):优先课程管理备注字段 post_scope,存量课程回退 suitable_members
|
||||
const suitableValue = course.post_scope || course.suitable_members || ''
|
||||
if (suitableValue) {
|
||||
demandForm.value.post_scope = suitableValue
|
||||
demandSuitableList.value = splitSuitable(suitableValue)
|
||||
}
|
||||
const lecturerValue = course.lecturer_id || course.lecturer_external || ''
|
||||
if (lecturerValue) {
|
||||
|
||||
Reference in new issue
Block a user