diff --git a/.air.toml b/.air.toml index 9530b7f..ebd531f 100644 --- a/.air.toml +++ b/.air.toml @@ -4,8 +4,14 @@ tmp_dir = "tmp" [build] args_bin = [] - bin = "./tmp/main" - cmd = "go build -tags \"${GO_BUILD_TAGS}\" -ldflags=\"$(./scripts/get_version.sh ldflags) -X 'google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=warn'\" -o ./tmp/main ./cmd/server" + # 产物带 .exe 后缀:Windows 下 air 经 PowerShell 启动二进制,不识别无后缀文件 + # (Unix 对扩展名不敏感,同一 bin 路径两端通用)。 + bin = "./tmp/main.exe" + # 构建收敛到 scripts/air_build.sh:Windows 下 air 经 PowerShell 执行 cmd, + # 不能做 bash 命令替换/直接执行 .sh,内联 $(./scripts/get_version.sh ...) 会失败; + # macOS/Linux 经 /bin/sh -c 调 bash 同样可用,构建口径全平台一致 + # (GO_BUILD_TAGS/CGO_CFLAGS 环境变量由 scripts/dev.sh 导入,脚本内继承)。 + cmd = "bash ./scripts/air_build.sh" delay = 1000 exclude_dir = ["assets", "tmp", "vendor", "testdata", "frontend", "migrations", "node_modules", "docs", "logs", "data", "Academy-Chrome-Extension", "Formula", "dataset", "docreader", "docker", "llm_debug", "web", "mcp-server", "misc", "scripts", "dist", "client", "helm", "website-docs"] exclude_file = [] diff --git a/frontend/src/api/training/index.ts b/frontend/src/api/training/index.ts index 97046e9..cf31fff 100644 --- a/frontend/src/api/training/index.ts +++ b/frontend/src/api/training/index.ts @@ -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(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)。 diff --git a/frontend/src/views/training/components/LibraryPanel.vue b/frontend/src/views/training/components/LibraryPanel.vue index 1db6ddf..7dd82fb 100644 --- a/frontend/src/views/training/components/LibraryPanel.vue +++ b/frontend/src/views/training/components/LibraryPanel.vue @@ -70,6 +70,8 @@ 附件 + + + + +