feat(training): 企业培训迭代:推送深链接与签名下载、课程管理修复与收集模板调整
推送域(000155):
- 广播通知支持 link_url:demand_collect 场景自动签发教育训练需求表模板
匿名下载直链(HMAC token,20 天有效,免登录路由),企微消息尾部拼
「下载模板 + 查看更多详情」链接;站内文本保持纯文本不受影响
- 配置中心新增「推送链接基址」(notify_link_base_url,多入口/内外网部署固定
权威地址,留空跟随推送人访问地址)与「年培训计划收集推送文案」
(demand_collect_*,{year} 渲染收集年度);空标题/内容按模板回落渲染
- 迁移 000155:tr_training_notifications 增 link_url/link_token 列
课程管理:
- 修复点【发布/下线】报「不支持的操作」:动作取值兼容字面量路由(FullPath
末段)与 :action 通配两种注册形态
- 列表新增「创建人」列:creator_id 联查 users 带出姓名,导出 Excel 同步;
新增课程「所属部门」默认当前登录用户所在部门
- 导入加固:表头归一化 + 别名模糊匹配(兼容内置模板/旧口径/自定义模板变体);
导入与新增行支持按部门名兜底解析为 id(前端名册未命中时传 owner_dept_name)
年培训计划:
- 需求列表新增「创建人/创建时间」列(submitter_id 联查 users 带出姓名)
- 收集模板调整:下载时动态删除「培训费用(RMB)」列(旧版自定义模板同步归一,
右侧列/合并/下拉随删列平移);备注右侧追加「调研维度/培训策划要求」说明列
(合并至数据区末行,自动换行带边框,已带说明的自定义模板不覆盖)
开发工具:
- air 热重载适配 Windows:构建收敛到 scripts/air_build.sh(规避 air 经
PowerShell 执行不支持 bash 命令替换),产物改 .exe 后缀;CGO_CFLAGS 取
持久化值并集追加,不覆盖 go env -w 的头文件包含路径
This commit is contained in:
1 parent
242dd7e1a6
commit
4e25fce9aa
30 files changed
+1150
-143
No files matched your search
@@ -185,9 +185,11 @@ export interface TrainingDemand {
|
||||
check_status: 'pending' | 'passed' | 'fixed'
|
||||
check_msg: string
|
||||
status: string
|
||||
/** 联查展示字段:部门名称/讲师姓名 */
|
||||
/** 联查展示字段:部门名称/讲师姓名/创建人姓名(提报人,联查 users 只读) */
|
||||
dept_name?: string
|
||||
lecturer_name?: string
|
||||
submitter_name?: string
|
||||
created_at?: string
|
||||
}
|
||||
|
||||
export interface TrainingAnnualPlan {
|
||||
@@ -460,6 +462,8 @@ export interface TrainingLibraryCourse {
|
||||
clear_file?: boolean
|
||||
/** 讲师姓名(联查 users 只读) */
|
||||
lecturer_name?: string
|
||||
/** 创建人姓名(联查 users 只读;导入/新增时落 creator_id 后带出) */
|
||||
creator_name?: string
|
||||
created_at?: string
|
||||
updated_at?: string
|
||||
}
|
||||
@@ -1270,6 +1274,8 @@ export const markNotificationsRead = () =>
|
||||
post<{ success: boolean }>(`${base}/notifications/read`, {})
|
||||
|
||||
// BroadcastNotification 培训运营向指定平台用户批量推送站内通知(收集下年度计划等场景)。
|
||||
// link_url 传前端 origin:demand_collect 场景企微消息尾部由后端拼
|
||||
// 「下载教育训练需求表模板(签名直链)+ 查看更多详情」两行链接。
|
||||
export const broadcastTrainingNotification = (payload: {
|
||||
user_ids: string[]
|
||||
scene?: string
|
||||
@@ -1277,9 +1283,45 @@ export const broadcastTrainingNotification = (payload: {
|
||||
content?: string
|
||||
ref_type?: string
|
||||
ref_id?: string
|
||||
link_url?: string
|
||||
}) =>
|
||||
post<{ success: boolean; data: { sent: number } }>(`${base}/notifications/broadcast`, payload)
|
||||
|
||||
// ---- 年培训计划收集推送文案(配置中心「提醒推送文案」卡可配) ----
|
||||
|
||||
/** notify_text_templates 规则键(与后端 ruleKeyNotifyTextTemplates 一致)。 */
|
||||
export const NOTIFY_TEXT_TEMPLATES_RULE_KEY = 'notify_text_templates'
|
||||
|
||||
// [2026-11 需求] 收集推送默认文案(与后端 defaultDemandCollect* 逐字一致):
|
||||
// 配置中心 demand_collect_title/demand_collect_content 可编辑,{year} 在
|
||||
// 收集弹窗预填与后端广播回落渲染时替换为收集年度(下一年)。
|
||||
export const DEFAULT_DEMAND_COLLECT_TITLE = '【培训需求收集】{year}年度培训计划收集'
|
||||
export const DEFAULT_DEMAND_COLLECT_CONTENT =
|
||||
'请各部门于 {year} 年 1 月 31 日前提报 {year} 年度培训需求:' +
|
||||
'可点击消息中的「教育训练需求表模板」链接直接下载批量填写后导入,或登录 AIDO → 企业培训 → 培训计划 → 年度需求收集在线逐条提报。'
|
||||
|
||||
/** 读取年培训计划收集推送文案模板(配置中心 notify_text_templates;字段为空/
|
||||
* 拉取失败回落内置默认,与后端 parseNotifyTextTemplates 同口径)。 */
|
||||
export async function fetchDemandCollectText(): Promise<{ title: string; content: string }> {
|
||||
let title = DEFAULT_DEMAND_COLLECT_TITLE
|
||||
let content = DEFAULT_DEMAND_COLLECT_CONTENT
|
||||
try {
|
||||
const res = await listRuleConfigs()
|
||||
const saved = (unwrap<TrainingRuleConfig[]>(res) || []).find(
|
||||
(c) => c.rule_key === NOTIFY_TEXT_TEMPLATES_RULE_KEY,
|
||||
)?.rule_value
|
||||
if (typeof saved?.demand_collect_title === 'string' && saved.demand_collect_title.trim()) {
|
||||
title = saved.demand_collect_title
|
||||
}
|
||||
if (typeof saved?.demand_collect_content === 'string' && saved.demand_collect_content.trim()) {
|
||||
content = saved.demand_collect_content
|
||||
}
|
||||
} catch {
|
||||
// 拉取失败回退内置默认,收集弹窗预填不受影响
|
||||
}
|
||||
return { title, content }
|
||||
}
|
||||
|
||||
// ---- 推送管理(2026-11 推学员/推讲师需求,配置中心展示) ----
|
||||
|
||||
// TrainingPushLog 推送逐人明细行(镜像 internal/types.TrainingPushLog)。
|
||||
|
||||
@@ -70,6 +70,8 @@
|
||||
<t-tag v-if="row.file_name" theme="success" variant="light" size="small" class="material-file-tag">附件</t-tag>
|
||||
</template>
|
||||
<template #created_at="{ row }">{{ fmtBeijingTime(row.created_at) || '-' }}</template>
|
||||
<!-- 创建人(联查 users):记录课程由谁录入 -->
|
||||
<template #creator_name="{ row }">{{ row.creator_name || '-' }}</template>
|
||||
<template #publish_status="{ row }">
|
||||
<t-tag
|
||||
:theme="row.publish_status === 'published' ? 'success' : row.publish_status === 'offline' ? 'default' : 'warning'"
|
||||
@@ -452,6 +454,7 @@ import {
|
||||
exportCourseLibrary,
|
||||
fetchCourseCategories,
|
||||
generateLibraryCourseQuestions,
|
||||
getMyProfile,
|
||||
getTrainingKnowledgeBases,
|
||||
importCourseLibrary,
|
||||
importGeneratedQuestionBank,
|
||||
@@ -487,6 +490,8 @@ const members = ref<TrainingMember[]>([])
|
||||
const depts = ref<TrainingDept[]>([])
|
||||
// 课程分类选项 = 配置中心「课程分类」字典(fetchCourseCategories 缺失回退默认)
|
||||
const configCategories = ref<string[]>([])
|
||||
// 本人所在部门 id:新增课程「所属部门」默认当前登录用户所在部门(getMyProfile)
|
||||
const myDeptId = ref('')
|
||||
|
||||
// ---- 查询条件(编号/名称/分类/类型/形式;列表全量加载,本地过滤) ----
|
||||
const filters = ref({ keyword: '', category: '', type: '', mode: '' })
|
||||
@@ -530,6 +535,8 @@ const columns = [
|
||||
// 发布状态(000154):已发布的课程进入培训中心「和信课程」目录
|
||||
{ colKey: 'publish_status', title: '发布状态', width: 90 },
|
||||
{ colKey: 'created_at', title: '创建时间', width: 140 },
|
||||
// 创建人(联查 users):记录课程录入人员
|
||||
{ colKey: 'creator_name', title: '创建人', width: 96 },
|
||||
{ colKey: 'op', title: '操作', width: 280, fixed: 'right' },
|
||||
]
|
||||
|
||||
@@ -539,16 +546,19 @@ const lecturerText = (row: TrainingLibraryCourse) =>
|
||||
const loadAll = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const [lib, m, d, cats] = await Promise.all([
|
||||
const [lib, m, d, cats, me] = await Promise.all([
|
||||
listCourseLibrary({ page_size: 500 }),
|
||||
listMembers({ page_size: 500 }).catch(() => null),
|
||||
listDepts().catch(() => null),
|
||||
fetchCourseCategories(),
|
||||
// 本人档案:新增课程「所属部门」默认当前登录用户所在部门
|
||||
getMyProfile().catch(() => null),
|
||||
])
|
||||
items.value = unwrap(lib)?.items || []
|
||||
members.value = (m && unwrap(m)?.items) || []
|
||||
depts.value = (d && unwrap(d)) || []
|
||||
configCategories.value = cats
|
||||
myDeptId.value = (me && unwrap(me)?.dept_id) || ''
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
@@ -670,7 +680,8 @@ const openForm = (row?: TrainingLibraryCourse) => {
|
||||
id: row?.id || '',
|
||||
code: row?.code || '',
|
||||
name: row?.name || '',
|
||||
owner_dept_id: row?.owner_dept_id || '',
|
||||
// 新增默认当前登录用户所在部门;编辑保持原部门
|
||||
owner_dept_id: row?.owner_dept_id || (row ? '' : myDeptId.value),
|
||||
description: row?.description || '',
|
||||
suitable_members: row?.suitable_members || '',
|
||||
category: row?.category || '',
|
||||
@@ -830,6 +841,38 @@ const normMode = (raw: string): 'offline' | 'online' => (/线上/.test(raw) ? 'o
|
||||
// 课件收集列的占位文案(已有课件/暂无课件/无等)是状态标记,不落名称登记
|
||||
const isNoMaterial = (raw: string) => /^(已有课件|暂无课件|暂无|无课件|无)$/.test(raw)
|
||||
|
||||
// 表头键归一:去空白与全/半角括号、冒号等标点并转小写(兼容「课程说明(选填)」
|
||||
// 「时长:(学时)」这类自定义模板变体;配置中心上传的自定义模板表头可能带修饰)
|
||||
const normHeaderKey = (s: string) => String(s).trim().toLowerCase().replace(/[\s::,,、。.·()()[\]【】-]/g, '')
|
||||
|
||||
// 列名别名表(归一后口径):先精确命中,再按「表头包含别名」兜底,
|
||||
// 覆盖内置模板/旧口径/自定义模板的常见列名变体
|
||||
const IMPORT_HEADER_ALIASES: Record<string, string[]> = {
|
||||
name: ['课程名称', '名称'],
|
||||
dept: ['所属部门', '主办单位', '部门'],
|
||||
description: ['课程说明', '说明', '课程简介', '简介'],
|
||||
suitable: ['适合人员', '参加人员', '适合对象', '参训人员'],
|
||||
category: ['课程分类', '分类'],
|
||||
type: ['类型必修课或选修课', '类型'],
|
||||
mode: ['线上或线下', '线上线下', '形式'],
|
||||
lecturer: ['讲师姓名', '授课讲师', '培训讲师', '讲师'],
|
||||
hours: ['时长学时', '时长'],
|
||||
material: ['课件收集', '课件'],
|
||||
}
|
||||
|
||||
// 按别名组从归一化行中取值:别名精确 → 表头包含别名(首个命中),未命中返回 ''
|
||||
const pickImportColumn = (row: Record<string, string>, aliases: string[]) => {
|
||||
for (const a of aliases) {
|
||||
if (row[a]) return row[a]
|
||||
}
|
||||
const keys = Object.keys(row)
|
||||
for (const a of aliases) {
|
||||
const hit = keys.find((k) => k.includes(a))
|
||||
if (hit && row[hit]) return row[hit]
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
const onImportExcel = async (e: Event) => {
|
||||
const input = e.target as HTMLInputElement
|
||||
const file = input.files?.[0]
|
||||
@@ -837,13 +880,13 @@ const onImportExcel = async (e: Event) => {
|
||||
if (!file) return
|
||||
try {
|
||||
const wb = XLSX.read(await file.arrayBuffer())
|
||||
// 定位含「课程名称」表头的工作表;表头键做空白归一(兼容内含空格的列名)
|
||||
// 定位含「课程名称」表头的工作表;表头键做归一(空白/全半角标点,见 normHeaderKey)
|
||||
let dataRows: Record<string, string>[] | null = null
|
||||
for (const name of wb.SheetNames) {
|
||||
const sheetRows = XLSX.utils.sheet_to_json<string[]>(wb.Sheets[name], { header: 1, raw: false, defval: '' })
|
||||
const headerIdx = sheetRows.findIndex((r) => r.some((c) => String(c).trim() === '课程名称'))
|
||||
const headerIdx = sheetRows.findIndex((r) => r.some((c) => normHeaderKey(String(c)) === '课程名称'))
|
||||
if (headerIdx < 0) continue
|
||||
const header = (sheetRows[headerIdx] || []).map((c) => String(c).trim().replace(/\s+/g, ''))
|
||||
const header = (sheetRows[headerIdx] || []).map((c) => normHeaderKey(String(c)))
|
||||
dataRows = sheetRows.slice(headerIdx + 1).map((arr) => {
|
||||
const row: Record<string, string> = {}
|
||||
header.forEach((h, i) => {
|
||||
@@ -857,7 +900,8 @@ const onImportExcel = async (e: Event) => {
|
||||
MessagePlugin.error('未找到「课程名称」表头,请使用下载的课程管理导入模板填写')
|
||||
return
|
||||
}
|
||||
// 主办单位(所属部门)按部门名册匹配:名称精确 → 包含(与需求导入同口径),未匹配留空
|
||||
// 主办单位(所属部门)按部门名册匹配:名称精确 → 包含(与需求导入同口径),
|
||||
// 未匹配时仍把部门名传给后端(服务端按组织架构兜底解析为 id)
|
||||
const matchDept = (deptName: string) =>
|
||||
depts.value.find((d) => d.name === deptName) || depts.value.find((d) => deptName.includes(d.name))
|
||||
// 讲师按全部在职员工姓名精确匹配;未命中落外部讲师姓名(与需求导入同口径)
|
||||
@@ -867,13 +911,13 @@ const onImportExcel = async (e: Event) => {
|
||||
let externalLecturers = 0
|
||||
let deptHits = 0
|
||||
for (const row of dataRows) {
|
||||
const name = (row['课程名称'] || '').trim()
|
||||
const name = pickImportColumn(row, IMPORT_HEADER_ALIASES.name)
|
||||
if (!name) {
|
||||
skippedRows += 1
|
||||
continue
|
||||
}
|
||||
let ownerDeptId = ''
|
||||
const deptName = (row['所属部门'] || row['主办单位'] || '').trim()
|
||||
const deptName = pickImportColumn(row, IMPORT_HEADER_ALIASES.dept)
|
||||
if (deptName) {
|
||||
const hit = matchDept(deptName)
|
||||
if (hit) {
|
||||
@@ -883,7 +927,7 @@ const onImportExcel = async (e: Event) => {
|
||||
}
|
||||
let lecturerId = ''
|
||||
let lecturerExternal = ''
|
||||
const lecturerName = (row['讲师'] || '').trim()
|
||||
const lecturerName = pickImportColumn(row, IMPORT_HEADER_ALIASES.lecturer)
|
||||
if (lecturerName) {
|
||||
const hit = members.value.find((m) => (m.user_name || '') === lecturerName)
|
||||
if (hit?.user_id) {
|
||||
@@ -894,17 +938,18 @@ const onImportExcel = async (e: Event) => {
|
||||
externalLecturers += 1
|
||||
}
|
||||
}
|
||||
const hoursRaw = Number.parseFloat((row['时长(学时)'] || row['时长'] || '').replace(/[^\d.]/g, ''))
|
||||
const materialRaw = (row['课件收集'] || row['课件'] || '').trim()
|
||||
const hoursRaw = Number.parseFloat(pickImportColumn(row, IMPORT_HEADER_ALIASES.hours).replace(/[^\d.]/g, ''))
|
||||
const materialRaw = pickImportColumn(row, IMPORT_HEADER_ALIASES.material)
|
||||
// 类型/线上或线下:模板下拉列为全称表头(类型(必修课或选修课)/线上或线下),旧口径短表头同样兼容
|
||||
itemsPayload.push({
|
||||
name,
|
||||
owner_dept_id: ownerDeptId || undefined,
|
||||
description: (row['课程说明'] || row['说明'] || '').trim(),
|
||||
suitable_members: (row['适合人员'] || row['参加人员'] || '').trim(),
|
||||
category: (row['课程分类'] || row['分类'] || '').trim(),
|
||||
type: normType(row['类型(必修课或选修课)'] || row['类型'] || ''),
|
||||
mode: normMode(row['线上或线下'] || row['线上/线下'] || ''),
|
||||
owner_dept_name: deptName || undefined,
|
||||
description: pickImportColumn(row, IMPORT_HEADER_ALIASES.description),
|
||||
suitable_members: pickImportColumn(row, IMPORT_HEADER_ALIASES.suitable),
|
||||
category: pickImportColumn(row, IMPORT_HEADER_ALIASES.category),
|
||||
type: normType(pickImportColumn(row, IMPORT_HEADER_ALIASES.type)),
|
||||
mode: normMode(pickImportColumn(row, IMPORT_HEADER_ALIASES.mode)),
|
||||
lecturer_id: lecturerId || undefined,
|
||||
lecturer_external: lecturerExternal || undefined,
|
||||
hours: Number.isFinite(hoursRaw) && hoursRaw > 0 ? hoursRaw : 0,
|
||||
|
||||
@@ -76,6 +76,9 @@
|
||||
</t-tooltip>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
<!-- 创建人(提报人姓名)/创建时间:记录需求由谁何时录入 -->
|
||||
<template #submitter_name="{ row }">{{ row.submitter_name || '-' }}</template>
|
||||
<template #created_at="{ row }">{{ fmtBeijingTime(row.created_at) || '-' }}</template>
|
||||
<template #check_status="{ row }">
|
||||
<t-tag v-if="row.check_status === 'passed'" theme="success" variant="light" size="small">已确认</t-tag>
|
||||
<t-tag v-else-if="row.check_status === 'pending'" theme="warning" variant="light" size="small">待核验</t-tag>
|
||||
@@ -194,7 +197,7 @@
|
||||
:autosize="{ minRows: 6 }"
|
||||
placeholder="或粘贴需求行:课程名称[,计划培训月份如 3] (支持中英文逗号)"
|
||||
/>
|
||||
<div class="form-hint">模板列对应:编号/部门/课程名称/适合人员/地点/培訓費用/内/外培训(内部或外部,下拉选择)/计划培训月份(1~12,下拉选择)/讲师/备注;适合人员可填多人(、/,分隔),讲师可填系统员工(按姓名自动匹配并带出部门)或外部讲师姓名;导入后统一为「待核验」,由部门经理核验确认。</div>
|
||||
<div class="form-hint">模板列对应:编号/部门/课程名称/适合人员/地点/内/外培训(下拉选择内部或外部)/计划培训月份(1~12,下拉选择)/讲师/备注;费用列已移除;备注右侧为「调研维度与培训策划要求」说明列,无需填写;适合人员可填多人(、/,分隔),讲师可填系统员工(按姓名自动匹配并带出部门)或外部讲师姓名;导入后统一为「待核验」,由部门经理核验确认。</div>
|
||||
<template #footer>
|
||||
<t-button theme="primary" :loading="saving" @click="onImportDemands">导入粘贴内容</t-button>
|
||||
</template>
|
||||
@@ -207,6 +210,7 @@
|
||||
<span class="collect-template-name">教育训练需求表模板(填写后经「批量导入」上传,或「在线提报需求」逐条填写)</span>
|
||||
<t-button variant="outline" size="small" @click="onDownloadDemandTemplate">下载模板</t-button>
|
||||
</div>
|
||||
<div class="form-hint">企微推送的消息尾部会自动附带「下载教育训练需求表模板」直链(20 天内有效)与「查看更多详情>>」入口,课长点击即可下载模板或进入企业培训系统。</div>
|
||||
<div class="collect-section-title">发送人员</div>
|
||||
<t-select
|
||||
v-model="collectForm.userIds"
|
||||
@@ -234,12 +238,16 @@
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { MessagePlugin } from 'tdesign-vue-next'
|
||||
import * as XLSX from 'xlsx'
|
||||
import { fmtBeijingTime } from '@/utils/datetime'
|
||||
import { DEMAND_TEMPLATE_KEY, downloadTrainingTemplate } from '../trainingTemplates'
|
||||
import { apiErrorMessage } from '@/utils/request'
|
||||
import {
|
||||
broadcastTrainingNotification,
|
||||
confirmDemand,
|
||||
DEFAULT_DEMAND_COLLECT_CONTENT,
|
||||
DEFAULT_DEMAND_COLLECT_TITLE,
|
||||
deleteDemand,
|
||||
fetchDemandCollectText,
|
||||
getMyProfile,
|
||||
importDemands,
|
||||
listCourseLibrary,
|
||||
@@ -385,6 +393,9 @@ const demandColumns = [
|
||||
{ colKey: 'train_type', title: '内/外培训', width: 90 },
|
||||
{ colKey: 'location', title: '地点', width: 100 },
|
||||
{ colKey: 'remark', title: '备注', minWidth: 140 },
|
||||
// 创建人(提报人)/创建时间:记录需求录入人员与时间
|
||||
{ colKey: 'submitter_name', title: '创建人', width: 96 },
|
||||
{ colKey: 'created_at', title: '创建时间', width: 140 },
|
||||
// 状态/操作固定在列表右侧,横向滚动时始终可见
|
||||
{ colKey: 'check_status', title: '状态', width: 84, fixed: 'right' },
|
||||
{ colKey: 'op', title: '操作', width: 160, fixed: 'right' },
|
||||
@@ -858,7 +869,10 @@ const collectVisible = ref(false)
|
||||
const collectSending = ref(false)
|
||||
const members = ref<TrainingMember[]>([])
|
||||
const membersLoading = ref(false)
|
||||
const collectForm = ref({ userIds: [] as string[], content: '' })
|
||||
const collectForm = ref({ userIds: [] as string[], title: '', content: '' })
|
||||
|
||||
// {year} 占位符替换为收集年度(下一年;与配置中心文案模板口径一致)
|
||||
const renderCollectTpl = (tpl: string) => tpl.split('{year}').join(String(nextYear))
|
||||
|
||||
// 推送人员下拉展示:姓名/工号 · 岗位 · 部门
|
||||
const memberLabel = (m: TrainingMember) =>
|
||||
@@ -874,10 +888,15 @@ const defaultCollectUserIds = () =>
|
||||
.map((m) => m.user_id)
|
||||
|
||||
const openCollect = async () => {
|
||||
collectForm.value.content =
|
||||
`请各部门于 ${nextYear} 年 1 月 31 日前,登录 AIDO → 企业培训 → 培训计划 → 年度需求收集,` +
|
||||
`提报 ${nextYear} 年度培训需求:可在线逐条提报,或下载「教育训练需求表模板」批量填写后导入。`
|
||||
// [2026-11 需求] 收集推送文案可配(配置中心「提醒推送文案」卡):先以内置
|
||||
// 默认渲染 {year} 打底(拉取失败也不空白),再异步回读配置覆盖预填文案
|
||||
collectForm.value.title = renderCollectTpl(DEFAULT_DEMAND_COLLECT_TITLE)
|
||||
collectForm.value.content = renderCollectTpl(DEFAULT_DEMAND_COLLECT_CONTENT)
|
||||
collectVisible.value = true
|
||||
fetchDemandCollectText().then((tpl) => {
|
||||
collectForm.value.title = renderCollectTpl(tpl.title)
|
||||
collectForm.value.content = renderCollectTpl(tpl.content)
|
||||
})
|
||||
// 名册只拉一次;每次打开按默认角色重置推送人员(支持在此基础上增删)
|
||||
if (!members.value.length) {
|
||||
membersLoading.value = true
|
||||
@@ -903,10 +922,12 @@ const onSendCollect = async () => {
|
||||
const res = await broadcastTrainingNotification({
|
||||
user_ids: collectForm.value.userIds,
|
||||
scene: 'demand_collect',
|
||||
title: `【培训需求收集】${nextYear}年度培训计划收集`,
|
||||
title: collectForm.value.title || renderCollectTpl(DEFAULT_DEMAND_COLLECT_TITLE),
|
||||
content: collectForm.value.content,
|
||||
ref_type: 'plan',
|
||||
ref_id: String(nextYear),
|
||||
// 前端 origin:后端据此在企微消息尾部拼模板签名下载链接与「查看更多详情」入口
|
||||
link_url: window.location.origin,
|
||||
})
|
||||
MessagePlugin.success(`已推送通知 ${unwrap(res)?.sent ?? 0} 人(站内 + 企业微信;未绑定企微的同事仅站内送达,可在配置中心查看推送记录)`)
|
||||
collectVisible.value = false
|
||||
|
||||
@@ -342,6 +342,8 @@ import { MessagePlugin } from 'tdesign-vue-next'
|
||||
import {
|
||||
COURSE_CATEGORY_DICT_RULE_KEY,
|
||||
DEFAULT_COURSE_CATEGORIES,
|
||||
DEFAULT_DEMAND_COLLECT_CONTENT,
|
||||
DEFAULT_DEMAND_COLLECT_TITLE,
|
||||
ROLE_DICT_RULE_KEY,
|
||||
deleteTrainingTemplate,
|
||||
fetchRoleDict,
|
||||
@@ -584,13 +586,25 @@ const RULE_SCHEMAS: RuleSchemaDesc[] = [
|
||||
? {}
|
||||
: { enabled: saved?.enabled !== false, hour: Number(saved?.hour ?? 9) },
|
||||
},
|
||||
{
|
||||
// [2026-11 需求] 企微消息内深链接的环境级基址覆盖:多入口(域名/IP、内外网)
|
||||
// 部署时固定链接指向权威域名,优先于推送人浏览器 origin;清空保存即回落 origin
|
||||
// (本地开发零配置可用)。demand_collect 推送的「下载模板/查看更多详情」共用。
|
||||
key: 'notify_link_base_url',
|
||||
group: 'notify',
|
||||
title: '推送链接基址',
|
||||
desc: '企微推送消息内「下载模板/查看更多详情」链接的对外地址;多入口或内外网部署时请填写课长实际访问的权威地址(如 https://aido.corp.com),留空则跟随推送人当前访问地址',
|
||||
fields: [{ key: 'base_url', label: '对外基址', type: 'text', placeholder: 'https://aido.corp.com' }],
|
||||
serialize: (v) => String(v.base_url || '').trim(),
|
||||
parse: (saved) => ({ base_url: typeof saved === 'string' ? saved : '' }),
|
||||
},
|
||||
{
|
||||
// [2026-11 需求] 提醒推送文案可编辑:各提醒场景的标题/内容模板,保存后新推送即刻生效;
|
||||
// {占位符} 渲染时替换为实际值,清空保存即恢复内置默认文案(后端空值回落默认)。
|
||||
key: 'notify_text_templates',
|
||||
group: 'notify',
|
||||
title: '提醒推送文案',
|
||||
desc: '各提醒推送的标题与内容模板,支持 {占位符} 替换实际值;清空并保存即恢复内置默认文案,对保存后的新推送生效',
|
||||
desc: '各提醒与年培训计划收集推送的标题与内容模板,支持 {占位符} 替换实际值;清空并保存即恢复内置默认文案,对保存后的新推送生效',
|
||||
fields: [
|
||||
{
|
||||
key: 'student_notice_title',
|
||||
@@ -628,6 +642,21 @@ const RULE_SCHEMAS: RuleSchemaDesc[] = [
|
||||
type: 'text',
|
||||
vars: '{year} / {month} / {week} / {week_start} / {week_end} 本周起止(MM-DD) / {count} 未结束场次',
|
||||
},
|
||||
{
|
||||
// [2026-11 需求] 年培训计划收集推送(培训计划页「收集下年度计划」弹窗):
|
||||
// 弹窗预填与后端广播空字段回落共用本模板,{year} 渲染为收集年度(下一年)。
|
||||
key: 'demand_collect_title',
|
||||
label: '年培训计划收集推送 · 标题',
|
||||
type: 'text',
|
||||
placeholder: DEFAULT_DEMAND_COLLECT_TITLE,
|
||||
vars: '{year} 收集年度(推送时按下一年度替换)',
|
||||
},
|
||||
{
|
||||
key: 'demand_collect_content',
|
||||
label: '年培训计划收集推送 · 内容',
|
||||
type: 'text',
|
||||
vars: '{year} 收集年度(推送时按下一年度替换)',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -655,6 +684,7 @@ const DEFAULT_RULE_VALUES: Record<string, Record<string, any>> = {
|
||||
notify_remind_days: { t3: true, t1: true },
|
||||
notify_push_enabled: { enabled: true },
|
||||
notify_weekly_lecturer: { enabled: true, hour: 9 },
|
||||
notify_link_base_url: { base_url: '' },
|
||||
// [2026-11 需求] 提醒推送文案默认模板(与后端 defaultNotifyTextTemplates 逐字一致)
|
||||
notify_text_templates: {
|
||||
student_notice_title: '培训开课通知',
|
||||
@@ -667,6 +697,9 @@ const DEFAULT_RULE_VALUES: Record<string, Record<string, any>> = {
|
||||
weekly_title: '{year}年{month}月教育训练(第{week}周提醒)',
|
||||
weekly_content:
|
||||
'{month} 月已进入第 {week} 周({week_start} 至 {week_end}),您本月仍有 {count} 场培训未结束,请与人事约定培训时间并于月内完成课件、签到与评价。',
|
||||
// 年培训计划收集推送默认文案(与后端 defaultDemandCollect* 同源引用)
|
||||
demand_collect_title: DEFAULT_DEMAND_COLLECT_TITLE,
|
||||
demand_collect_content: DEFAULT_DEMAND_COLLECT_CONTENT,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,11 @@
|
||||
* 未上传时由后端回退内置默认(docs/moban 随二进制分发)。
|
||||
* - demand_collection 教育训练需求表模板.xlsx(2026-11 起的系统内置默认,
|
||||
* 含「计划培训月份」列):培训计划「年度需求收集 → 批量导入」使用;
|
||||
* 列:编号/部门/课程名称/参加人员/地点/培訓費用/內外培訓/计划培训月份/讲师/备注;
|
||||
* 列:编号/部门/课程名称/适合人员/地点/內外培訓/计划培训月份/讲师/备注
|
||||
* (旧口径「培訓費用」列下载时由后端动态删除,右侧列左移;
|
||||
* 备注右侧动态追加「调研维度/培训策划要求」说明列);
|
||||
* 后端下载时动态注入:标题年份=下一年度、课程名称下拉(课程管理 C)、
|
||||
* 计划培训月份下拉(1~12 H)、部门/讲师下拉(部门 B/讲师 I)。
|
||||
* 计划培训月份下拉(1~12 G)、部门/讲师下拉(部门 B/讲师 H)。
|
||||
* - question_bank 部门培训课程试题(题库导入版)模板.xlsx:
|
||||
* 「题库与考试 → Excel 批量导入」与「培训课程 → 创建课程 → 关联题库」指引使用;
|
||||
* 工作表:单选题/多选题/判断题,列:题目/课程名称/难度/正确答案/答案A..答案L。
|
||||
|
||||
Reference in new issue
Block a user