feat(training): 企业培训迭代:核验权限收窄、课程发布状态与培训中心改版
需求域: - 需求导入修复内/外培训与外部讲师落库;按模板标题年入库(年-月一致) - 核验确认收窄为「需求归属部门+经理职称角色」,越权提示联系部门经理 - 确认转月计划后自动推送讲师/课长维护;导入后自动推送部门经理核验(站内+企微) 课程域: - 课程管理发布状态字段(迁移000154)+发布/下线;培训中心「和信课程」目录 - 需求讲师改选后回写课程管理;确认同步带出适合人员/课件/试题 - 月计划详情课件/试题更换(上传/知识库选择/题库换绑)回写课程管理, 无关联条目的存量计划自动创建课程条目 模板与表单: - 教育训练需求表:适合人员/内-外培训口径;部门联动课程下拉; 适合人员/讲师按所选课程自动带出;在线提报课程下拉(本部门)自动带出分类/讲师/适合人员 页面与权限: - 培训中心页签重组(和信课程/我的培训/我的考试),移除线上/线下页签 - 数据驾驶舱迁侧栏(职称角色之下);职称角色迁至更多工具配置中心之后 - 配置中心/职称角色对经理开放;页签「职称角色」更名「角色权限」 - 修复年度下拉空白(TDesign options 需对象数组)、月计划列表地点兜底 其他: 培训预览端口修正与 dev:training 脚本;tmp-extract-duckdb 加入 gitignore
This commit is contained in:
1 parent
aae041a0b4
commit
242dd7e1a6
47 files changed
+5882
-1134
No files matched your search
@@ -1,9 +1,12 @@
|
||||
<template>
|
||||
<div class="rule-panel">
|
||||
<!-- 卡片1:职称角色 · 角色与权限(点选式维护,自定义角色勾选权限分配即生效) -->
|
||||
<!-- [2026-11 需求] 配置中心 tab 化:角色权限/业务规则(含业务参数与课程分类)/推送管理(推送提醒配置+推送记录)/导入模板 -->
|
||||
<t-tabs v-model="activeTab" class="rule-tabs">
|
||||
<t-tab-panel value="roles" label="角色权限">
|
||||
<!-- 角色权限 · 角色与权限(点选式维护,自定义角色勾选权限分配即生效) -->
|
||||
<div class="panel-box">
|
||||
<div class="panel-box__header">
|
||||
<span class="panel-box__title">职称角色 · 角色与权限</span>
|
||||
<span class="panel-box__title">角色权限 · 角色与权限</span>
|
||||
<t-button variant="outline" size="small" @click="openRoleDialog()">新增角色</t-button>
|
||||
</div>
|
||||
<t-table :data="roleRows" :columns="roleColumns" row-key="key" size="small" :loading="roleLoading">
|
||||
@@ -40,15 +43,18 @@
|
||||
系统角色不可删除,展示名与权限分配可改;「权限分配」= 继承所选权限组的全部接口与页面权限,勾选多个取并集。学员为全员默认角色,无需配置。
|
||||
</div>
|
||||
</div>
|
||||
</t-tab-panel>
|
||||
|
||||
<!-- 卡片2:业务规则(全部点选式表单,不再手写 JSON) -->
|
||||
<!-- 业务规则:签到/评分/积分/达标线/滚动等业务规则与业务参数 + 课程分类字典 + 高级配置兜底 -->
|
||||
<t-tab-panel value="rules" label="业务规则">
|
||||
<!-- 业务规则(全部点选式表单,不再手写 JSON) -->
|
||||
<div class="panel-box">
|
||||
<div class="panel-box__header">
|
||||
<span class="panel-box__title">业务规则</span>
|
||||
<t-button variant="outline" size="small" :loading="seeding" @click="onSeed">初始化默认配置</t-button>
|
||||
</div>
|
||||
<div class="panel-box__sub">点选即可修改,每项保存后立即生效;未保存的修改不生效。</div>
|
||||
<div v-for="schema in RULE_SCHEMAS" :key="schema.key" class="rule-section">
|
||||
<div v-for="schema in ruleSchemas" :key="schema.key" class="rule-section">
|
||||
<div class="rule-section__head">
|
||||
<span class="rule-section__title">{{ schema.title }}</span>
|
||||
<span class="rule-section__desc">{{ schema.desc }}</span>
|
||||
@@ -99,6 +105,35 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 课程分类:rule-configs course_category_dict,课程管理筛选/表单下拉选项来源 -->
|
||||
<div class="panel-box">
|
||||
<div class="panel-box__header">
|
||||
<span class="panel-box__title">课程分类</span>
|
||||
<t-button variant="outline" size="small" :disabled="!categoriesDirty" :loading="categoriesSaving" @click="onSaveCategories">保存</t-button>
|
||||
</div>
|
||||
<div class="panel-box__sub">课程管理列表「按分类查询」与「新增课程」弹窗的分类下拉选项;预设之外可在课程表单直接输入自定义分类。</div>
|
||||
<div class="category-editor">
|
||||
<t-tag
|
||||
v-for="c in categoryDraft"
|
||||
:key="c"
|
||||
theme="primary"
|
||||
variant="light"
|
||||
closable
|
||||
@close="onRemoveCategory(c)"
|
||||
>{{ c }}</t-tag>
|
||||
<t-input
|
||||
v-model="categoryInput"
|
||||
class="category-input"
|
||||
size="small"
|
||||
clearable
|
||||
placeholder="输入新分类后回车或点添加"
|
||||
@enter="onAddCategory"
|
||||
/>
|
||||
<t-button variant="outline" size="small" :disabled="!categoryInput.trim()" @click="onAddCategory">添加</t-button>
|
||||
<t-button variant="text" theme="primary" size="small" class="category-reset" @click="onResetCategories">恢复默认</t-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 高级配置:未提供点选表单的规则键,保留 JSON 编辑兜底 -->
|
||||
<div v-if="advancedRows.length" class="panel-box">
|
||||
<div class="panel-box__header">
|
||||
@@ -115,8 +150,64 @@
|
||||
</template>
|
||||
</t-table>
|
||||
</div>
|
||||
</t-tab-panel>
|
||||
|
||||
<!-- 卡片3:推送记录(逐人企微/站内投递明细;手动触发周一讲师提醒) -->
|
||||
<!-- 推送管理:推送提醒参数配置 + 推送投递记录 -->
|
||||
<t-tab-panel value="notify" label="推送管理">
|
||||
<!-- 推送提醒配置(与业务规则同款点选式表单) -->
|
||||
<div class="panel-box">
|
||||
<div class="panel-box__header">
|
||||
<span class="panel-box__title">推送提醒配置</span>
|
||||
</div>
|
||||
<div class="panel-box__sub">点选即可修改,每项保存后立即生效;未保存的修改不生效。</div>
|
||||
<div v-for="schema in notifySchemas" :key="schema.key" class="rule-section">
|
||||
<div class="rule-section__head">
|
||||
<span class="rule-section__title">{{ schema.title }}</span>
|
||||
<span class="rule-section__desc">{{ schema.desc }}</span>
|
||||
<t-button
|
||||
variant="outline"
|
||||
size="small"
|
||||
:disabled="!isDirty(schema.key)"
|
||||
:loading="savingKey === schema.key"
|
||||
@click="onSaveRule(schema.key)"
|
||||
>保存</t-button>
|
||||
</div>
|
||||
<div class="rule-section__fields">
|
||||
<div
|
||||
v-for="field in schema.fields"
|
||||
:key="field.key"
|
||||
class="rule-field"
|
||||
:class="{ 'rule-field--block': field.type === 'text' }"
|
||||
>
|
||||
<span class="rule-field__label">{{ field.label }}</span>
|
||||
<t-input-number
|
||||
v-if="field.type === 'number'"
|
||||
v-model="ruleValues[schema.key][field.key]"
|
||||
:min="field.min"
|
||||
:max="field.max"
|
||||
theme="normal"
|
||||
size="small"
|
||||
class="rule-field__input"
|
||||
/>
|
||||
<t-switch
|
||||
v-else-if="field.type === 'switch'"
|
||||
v-model="ruleValues[schema.key][field.key]"
|
||||
/>
|
||||
<t-textarea
|
||||
v-else
|
||||
v-model="ruleValues[schema.key][field.key]"
|
||||
:autosize="{ minRows: 2, maxRows: 4 }"
|
||||
:placeholder="field.placeholder"
|
||||
class="rule-field__textarea"
|
||||
/>
|
||||
<span v-if="field.unit" class="rule-field__unit">{{ field.unit }}</span>
|
||||
<span v-if="field.vars" class="rule-field__vars">可用变量:{{ field.vars }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 推送记录(逐人企微/站内投递明细;手动触发周一讲师提醒) -->
|
||||
<div class="panel-box">
|
||||
<div class="panel-box__header">
|
||||
<span class="panel-box__title">推送记录</span>
|
||||
@@ -151,12 +242,15 @@
|
||||
展示最近 {{ pushLogs.length }} 条;pending/sending=排队与投递中,sent=企微已送达,skipped=收件人未绑定企微等跳过,dead=重试耗尽,空=仅站内通知。
|
||||
</div>
|
||||
</div>
|
||||
</t-tab-panel>
|
||||
|
||||
<!-- 卡片4:导入模板管理(上传自定义 Excel 模板替换内置默认) -->
|
||||
<!-- 导入模板:上传自定义 Excel 模板替换内置默认 -->
|
||||
<t-tab-panel value="templates" label="导入模板">
|
||||
<!-- 导入模板管理(上传自定义 Excel 模板替换内置默认) -->
|
||||
<div class="panel-box">
|
||||
<div class="panel-box__header">
|
||||
<span class="panel-box__title">导入模板</span>
|
||||
<span class="panel-box__sub">上传后,培训计划批量导入与题库 Excel 导入的下载入口即刻使用新模板</span>
|
||||
<span class="panel-box__sub">上传后,培训计划批量导入、题库 Excel 导入与课程管理批量导入的下载入口即刻使用新模板</span>
|
||||
</div>
|
||||
<t-table :data="templates" :columns="templateColumns" row-key="template_key" size="small" :loading="templateLoading">
|
||||
<template #file_name="{ row }">
|
||||
@@ -189,11 +283,13 @@
|
||||
@change="onUploadFile"
|
||||
/>
|
||||
</div>
|
||||
</t-tab-panel>
|
||||
</t-tabs>
|
||||
|
||||
<!-- 角色编辑弹窗 -->
|
||||
<t-dialog
|
||||
v-model:visible="roleDialogVisible"
|
||||
:header="roleForm.mode === 'add' ? '新增职称角色' : `编辑职称角色 · ${roleForm.label || roleForm.key}`"
|
||||
:header="roleForm.mode === 'add' ? '新增角色' : `编辑角色 · ${roleForm.label || roleForm.key}`"
|
||||
width="480"
|
||||
>
|
||||
<t-form label-width="88px">
|
||||
@@ -244,6 +340,8 @@
|
||||
import { computed, onMounted, ref, watch } from 'vue'
|
||||
import { MessagePlugin } from 'tdesign-vue-next'
|
||||
import {
|
||||
COURSE_CATEGORY_DICT_RULE_KEY,
|
||||
DEFAULT_COURSE_CATEGORIES,
|
||||
ROLE_DICT_RULE_KEY,
|
||||
deleteTrainingTemplate,
|
||||
fetchRoleDict,
|
||||
@@ -265,6 +363,9 @@ import {
|
||||
import { fmtBeijingTime } from '@/utils/datetime'
|
||||
import { downloadTrainingTemplate } from '../trainingTemplates'
|
||||
|
||||
// [2026-11 需求] 配置中心 tab 切换(角色权限/业务规则/推送管理/导入模板)
|
||||
const activeTab = ref('roles')
|
||||
|
||||
const loading = ref(false)
|
||||
const saving = ref(false)
|
||||
const editVisible = ref(false)
|
||||
@@ -393,6 +494,8 @@ interface RuleSchemaDesc {
|
||||
title: string
|
||||
desc: string
|
||||
fields: RuleFieldDesc[]
|
||||
// group:notify = 推送提醒类配置,配置中心归入「推送管理」tab;缺省归「业务规则」tab。
|
||||
group?: 'notify'
|
||||
// serialize UI 表单值 → tr_rule_configs 落库值(默认原样 JSON);
|
||||
// notify_remind_days(数组)/notify_push_enabled(bool) 等非对象契约用。
|
||||
serialize?: (v: Record<string, any>) => any
|
||||
@@ -439,6 +542,7 @@ const RULE_SCHEMAS: RuleSchemaDesc[] = [
|
||||
// (training_scheduler.go loadNotifyConfig);原 remind_policy(t3/t1/third_week/
|
||||
// month_end)从未被后端读取,由本卡替换(third_week/month_end 无实现,随卡移除)。
|
||||
key: 'notify_remind_days',
|
||||
group: 'notify',
|
||||
title: '开课提醒时点',
|
||||
desc: '调度器按提前天数生成讲师授课提醒;学员开课通知由场次"通知方式"决定(立即或前一天),不受本项影响',
|
||||
fields: [
|
||||
@@ -457,6 +561,7 @@ const RULE_SCHEMAS: RuleSchemaDesc[] = [
|
||||
},
|
||||
{
|
||||
key: 'notify_push_enabled',
|
||||
group: 'notify',
|
||||
title: '企微推送总开关',
|
||||
desc: '关闭后新产生的通知只保留站内流水,不再推送企业微信;已入队消息不受影响',
|
||||
fields: [{ key: 'enabled', label: '启用企微推送', type: 'switch' }],
|
||||
@@ -466,6 +571,7 @@ const RULE_SCHEMAS: RuleSchemaDesc[] = [
|
||||
},
|
||||
{
|
||||
key: 'notify_weekly_lecturer',
|
||||
group: 'notify',
|
||||
title: '周一讲师未完成提醒',
|
||||
desc: '每周一上午向当月仍有未结束场次的讲师推送汇总提醒(标题带第 N 周);讲师场次全部结束即自动停推',
|
||||
fields: [
|
||||
@@ -482,6 +588,7 @@ const RULE_SCHEMAS: RuleSchemaDesc[] = [
|
||||
// [2026-11 需求] 提醒推送文案可编辑:各提醒场景的标题/内容模板,保存后新推送即刻生效;
|
||||
// {占位符} 渲染时替换为实际值,清空保存即恢复内置默认文案(后端空值回落默认)。
|
||||
key: 'notify_text_templates',
|
||||
group: 'notify',
|
||||
title: '提醒推送文案',
|
||||
desc: '各提醒推送的标题与内容模板,支持 {占位符} 替换实际值;清空并保存即恢复内置默认文案,对保存后的新推送生效',
|
||||
fields: [
|
||||
@@ -565,6 +672,58 @@ const DEFAULT_RULE_VALUES: Record<string, Record<string, any>> = {
|
||||
|
||||
const RULE_SCHEMA_KEYS = new Set(RULE_SCHEMAS.map((s) => s.key))
|
||||
|
||||
// tab 分组:业务规则(签到/评分/积分/达标线/滚动)与推送提醒(notify_*)各自成 tab
|
||||
const ruleSchemas = RULE_SCHEMAS.filter((s) => s.group !== 'notify')
|
||||
const notifySchemas = RULE_SCHEMAS.filter((s) => s.group === 'notify')
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// 课程分类(course_category_dict):课程管理筛选/表单下拉选项字典,
|
||||
// tag 列表增删 + 保存;保存后课程管理页下次拉取即生效。
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
const categoryDraft = ref<string[]>([])
|
||||
const categorySnapshot = ref('[]')
|
||||
const categoryInput = ref('')
|
||||
const categoriesSaving = ref(false)
|
||||
const categoriesDirty = computed(() => JSON.stringify(categoryDraft.value) !== categorySnapshot.value)
|
||||
|
||||
const onAddCategory = () => {
|
||||
const name = categoryInput.value.trim()
|
||||
if (!name) return
|
||||
if (categoryDraft.value.some((c) => c === name)) {
|
||||
MessagePlugin.warning(`分类「${name}」已存在`)
|
||||
return
|
||||
}
|
||||
categoryDraft.value = [...categoryDraft.value, name]
|
||||
categoryInput.value = ''
|
||||
}
|
||||
|
||||
const onRemoveCategory = (name: string) => {
|
||||
categoryDraft.value = categoryDraft.value.filter((c) => c !== name)
|
||||
}
|
||||
|
||||
// 恢复默认分类(仅改草稿,点「保存」后落库生效)
|
||||
const onResetCategories = () => {
|
||||
categoryDraft.value = [...DEFAULT_COURSE_CATEGORIES]
|
||||
}
|
||||
|
||||
const onSaveCategories = async () => {
|
||||
if (!categoryDraft.value.length) {
|
||||
MessagePlugin.warning('至少保留一个分类')
|
||||
return
|
||||
}
|
||||
categoriesSaving.value = true
|
||||
try {
|
||||
await saveRuleConfig(COURSE_CATEGORY_DICT_RULE_KEY, { categories: categoryDraft.value })
|
||||
categorySnapshot.value = JSON.stringify(categoryDraft.value)
|
||||
MessagePlugin.success('课程分类已保存并生效')
|
||||
} catch (err: any) {
|
||||
MessagePlugin.error(err?.response?.data?.message || '保存失败')
|
||||
} finally {
|
||||
categoriesSaving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const ruleValues = ref<Record<string, Record<string, any>>>({})
|
||||
const savedSnapshot = ref<Record<string, string>>({})
|
||||
const savingKey = ref('')
|
||||
@@ -594,8 +753,15 @@ const applyConfigs = (configs: TrainingRuleConfig[]) => {
|
||||
ruleValues.value = values
|
||||
savedSnapshot.value = snapshot
|
||||
advancedRows.value = configs.filter(
|
||||
(c) => !RULE_SCHEMA_KEYS.has(c.rule_key) && c.rule_key !== ROLE_DICT_RULE_KEY,
|
||||
(c) => !RULE_SCHEMA_KEYS.has(c.rule_key) && c.rule_key !== ROLE_DICT_RULE_KEY && c.rule_key !== COURSE_CATEGORY_DICT_RULE_KEY,
|
||||
)
|
||||
// 课程分类字典:有专属卡片,缺省回退默认分类(与 fetchCourseCategories 同口径)
|
||||
const categoryRaw = configs.find((c) => c.rule_key === COURSE_CATEGORY_DICT_RULE_KEY)?.rule_value?.categories
|
||||
const categories = Array.isArray(categoryRaw)
|
||||
? categoryRaw.filter((c): c is string => typeof c === 'string' && !!c.trim())
|
||||
: [...DEFAULT_COURSE_CATEGORIES]
|
||||
categoryDraft.value = categories
|
||||
categorySnapshot.value = JSON.stringify(categories)
|
||||
}
|
||||
|
||||
const loadAll = async () => {
|
||||
@@ -853,6 +1019,29 @@ watch(pushScene, () => loadPushLogs())
|
||||
display: none;
|
||||
}
|
||||
|
||||
// ---- tab 化布局:tab 内容区与 panel-box 间距 ----
|
||||
.rule-tabs {
|
||||
:deep(.t-tab-panel) {
|
||||
padding: 12px 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
// ---- 课程分类(tag 列表增删编辑) ----
|
||||
.category-editor {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.category-input {
|
||||
width: 220px;
|
||||
}
|
||||
|
||||
.category-reset {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.form-hint {
|
||||
margin-top: 8px;
|
||||
color: var(--td-text-color-placeholder);
|
||||
|
||||
Reference in new issue
Block a user