From 8534025c45b4736975730678b9ccf23570a75f95 Mon Sep 17 00:00:00 2001
From: liuyu <yu.liu@cqgbkj.com>
Date: 星期二, 22 九月 2026 09:25:48 +0800
Subject: [PATCH] feat(tms): 新增试卷、培训任务、个人任务页面

---
 apps/jnpf-web-apps-main/src/views/x/tms/shared/dic.ts |  167 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 167 insertions(+), 0 deletions(-)

diff --git a/apps/jnpf-web-apps-main/src/views/x/tms/shared/dic.ts b/apps/jnpf-web-apps-main/src/views/x/tms/shared/dic.ts
new file mode 100644
index 0000000..6e58c6c
--- /dev/null
+++ b/apps/jnpf-web-apps-main/src/views/x/tms/shared/dic.ts
@@ -0,0 +1,167 @@
+import type { useBaseStore } from '#/store';
+
+/** 涓� docs/tms/瀛楁娉ㄩ噴涓庡瓧鍏歌鑼�.md 瀵归綈 */
+export const TMS_DIC = {
+  yesNo: 'tmsYesNo',
+  enableStatus: 'tmsEnableStatus',
+  signRule: 'tmsSignRule',
+  questionType: 'tmsQuestionType',
+  difficulty: 'tmsDifficulty',
+  questionSource: 'tmsQuestionSource',
+  openClosedInvalid: 'tmsOpenClosedInvalid',
+  paperSortMode: 'tmsPaperSortMode',
+  courseCategory: 'tmsCourseCategory',
+  trainMode: 'tmsTrainMode',
+  evalMode: 'tmsEvalMode',
+  archiveStatus: 'tmsArchiveStatus',
+  gradeStatus: 'tmsGradeStatus',
+  examStatus: 'tmsExamStatus',
+  passFlag: 'tmsPassFlag',
+  taskPublishStatus: 'tmsTaskPublishStatus',
+  taskCategory: 'tmsTaskCategory',
+  taskKind: 'tmsTaskKind',
+  taskSourceType: 'tmsTaskSourceType',
+  personTaskStatus: 'tmsPersonTaskStatus',
+} as const;
+
+export type TmsDicCode = (typeof TMS_DIC)[keyof typeof TMS_DIC];
+
+export type TmsDicOpt = {
+  id: string;
+  enCode?: string;
+  fullName: string;
+  [key: string]: any;
+};
+
+/** Select 瀛樺瓧鍏� enCode锛堜笌搴撳瓧娈电紪鐮佷竴鑷达級 */
+export const TMS_DIC_FIELD_NAMES = { value: 'enCode', label: 'fullName' } as const;
+
+/** 瀛楀吀涓嶅彲鐢ㄦ椂鐨勫厹搴曪紝浠呬緵 loadTmsDic 鍐呴儴浣跨敤 */
+const FALLBACK_BY_CODE: Record<string, TmsDicOpt[]> = {
+  [TMS_DIC.yesNo]: [
+    { id: '1', enCode: '1', fullName: '鏄�' },
+    { id: '0', enCode: '0', fullName: '鍚�' },
+  ],
+  [TMS_DIC.enableStatus]: [
+    { id: '1', enCode: '1', fullName: '鍚敤' },
+    { id: '0', enCode: '0', fullName: '鍋滅敤' },
+  ],
+  [TMS_DIC.signRule]: [
+    { id: 'scan', enCode: 'scan', fullName: '浠呮壂鐮�' },
+    { id: 'both', enCode: 'both', fullName: '鎵爜+鍦ㄧ嚎' },
+  ],
+  [TMS_DIC.questionType]: [
+    { id: 'single', enCode: 'single', fullName: '鍗曢��' },
+    { id: 'multi', enCode: 'multi', fullName: '澶氶��' },
+    { id: 'judge', enCode: 'judge', fullName: '鍒ゆ柇' },
+    { id: 'blank', enCode: 'blank', fullName: '濉┖' },
+    { id: 'essay', enCode: 'essay', fullName: '闂瓟' },
+  ],
+  [TMS_DIC.difficulty]: [
+    { id: 'easy', enCode: 'easy', fullName: '绠�鍗�' },
+    { id: 'normal', enCode: 'normal', fullName: '涓�鑸�' },
+    { id: 'hard', enCode: 'hard', fullName: '鍥伴毦' },
+  ],
+  [TMS_DIC.questionSource]: [
+    { id: 'self', enCode: 'self', fullName: '鑷懡棰�' },
+    { id: 'import', enCode: 'import', fullName: '瀵煎叆' },
+    { id: 'external', enCode: 'external', fullName: '澶栬喘' },
+  ],
+  [TMS_DIC.openClosedInvalid]: [
+    { id: 'open', enCode: 'open', fullName: '寮�鏀�' },
+    { id: 'closed', enCode: 'closed', fullName: '涓嶅紑鏀�' },
+    { id: 'invalid', enCode: 'invalid', fullName: '搴熷純' },
+  ],
+  [TMS_DIC.paperSortMode]: [
+    { id: 'paper', enCode: 'paper', fullName: '璇曞嵎椤哄簭' },
+    { id: 'random', enCode: 'random', fullName: '闅忔満' },
+  ],
+  [TMS_DIC.courseCategory]: [
+    { id: 'gmp', enCode: 'gmp', fullName: 'GMP' },
+    { id: 'sop', enCode: 'sop', fullName: 'SOP' },
+    { id: 'safety', enCode: 'safety', fullName: '瀹夊叏' },
+    { id: 'skill', enCode: 'skill', fullName: '鎶�鑳�' },
+    { id: 'other', enCode: 'other', fullName: '鍏朵粬' },
+  ],
+  [TMS_DIC.trainMode]: [
+    { id: 'onsite', enCode: 'onsite', fullName: '闆嗕腑鎺堣' },
+    { id: 'practice', enCode: 'practice', fullName: '鎿嶄綔鎺堣' },
+    { id: 'online', enCode: 'online', fullName: '鍦ㄧ嚎瀛︿範' },
+  ],
+  [TMS_DIC.evalMode]: [
+    { id: 'quiz', enCode: 'quiz', fullName: '鎻愰棶' },
+    { id: 'practice', enCode: 'practice', fullName: '鐜板満鎿嶄綔' },
+    { id: 'exam', enCode: 'exam', fullName: '鍦ㄧ嚎鑰冭瘯' },
+    { id: 'none', enCode: 'none', fullName: '鏃犻渶鑰冩牳' },
+  ],
+  [TMS_DIC.archiveStatus]: [
+    { id: 'pending', enCode: 'pending', fullName: '寰呭綊妗�' },
+    { id: 'ready', enCode: 'ready', fullName: '鍙綊妗�' },
+    { id: 'archived', enCode: 'archived', fullName: '宸插綊妗�' },
+    { id: 'invalid', enCode: 'invalid', fullName: '鏃犳晥' },
+  ],
+  [TMS_DIC.gradeStatus]: [
+    { id: 'auto', enCode: 'auto', fullName: '鏃犻渶闃呭嵎' },
+    { id: 'pending', enCode: 'pending', fullName: '寰呮壒鏀�' },
+    { id: 'graded', enCode: 'graded', fullName: '宸叉壒鏀�' },
+  ],
+  [TMS_DIC.examStatus]: [
+    { id: 'doing', enCode: 'doing', fullName: '鑰冭瘯涓�' },
+    { id: 'submitted', enCode: 'submitted', fullName: '宸蹭氦鍗�' },
+    { id: 'cancelled', enCode: 'cancelled', fullName: '宸插彇娑�' },
+  ],
+  [TMS_DIC.passFlag]: [
+    { id: '1', enCode: '1', fullName: '鍚堟牸' },
+    { id: '0', enCode: '0', fullName: '涓嶅悎鏍�' },
+  ],
+  [TMS_DIC.taskPublishStatus]: [
+    { id: 'draft', enCode: 'draft', fullName: '鏈彂甯�' },
+    { id: 'published', enCode: 'published', fullName: '宸插彂甯�' },
+    { id: 'cancelled', enCode: 'cancelled', fullName: '宸插彇娑�' },
+    { id: 'done', enCode: 'done', fullName: '宸插畬鎴�' },
+  ],
+  [TMS_DIC.taskCategory]: [
+    { id: 'temp', enCode: 'temp', fullName: '涓存椂鍩硅' },
+    { id: 'post_plan', enCode: 'post_plan', fullName: '宀椾綅璁″垝' },
+    { id: 'annual_plan', enCode: 'annual_plan', fullName: '骞村害璁″垝' },
+    { id: 'file_effect', enCode: 'file_effect', fullName: '鏂囦欢鐢熸晥' },
+    { id: 'out_train', enCode: 'out_train', fullName: '澶栨淳鍩硅' },
+    { id: 'retrain', enCode: 'retrain', fullName: '鍐嶅煿璁�' },
+  ],
+  [TMS_DIC.taskKind]: [
+    { id: 'new', enCode: 'new', fullName: '鏂板' },
+    { id: 'continue', enCode: 'continue', fullName: '缁х画' },
+  ],
+  [TMS_DIC.taskSourceType]: [
+    { id: 'annual', enCode: 'annual', fullName: '骞磋鍒�' },
+    { id: 'post', enCode: 'post', fullName: '宀楄鍒�' },
+    { id: 'temp', enCode: 'temp', fullName: '涓存椂' },
+    { id: 'file', enCode: 'file', fullName: '鏂囦欢鍩硅' },
+  ],
+  [TMS_DIC.personTaskStatus]: [
+    { id: 'todo', enCode: 'todo', fullName: '鏈畬鎴�' },
+    { id: 'signed', enCode: 'signed', fullName: '宸茬鍒�' },
+    { id: 'done', enCode: 'done', fullName: '宸插畬鎴�' },
+    { id: 'expired', enCode: 'expired', fullName: '宸茶繃鏈�' },
+    { id: 'cancelled', enCode: 'cancelled', fullName: '宸插彇娑�' },
+  ],
+};
+
+export function labelOfDic(options: TmsDicOpt[], v?: string | null) {
+  if (v == null || v === '') return '-';
+  const hit = options.find((x) => x.enCode === v || x.id === v);
+  return hit?.fullName || v;
+}
+
+type BaseStore = ReturnType<typeof useBaseStore>;
+
+/** 缁熶竴瀛楀吀鍏ュ彛锛氭寜缂栫爜鎷夊彇锛屽け璐ユ椂鐢ㄥ唴缃厹搴� */
+export async function loadTmsDic(baseStore: BaseStore, code: string): Promise<TmsDicOpt[]> {
+  const fallback = FALLBACK_BY_CODE[code] ?? [];
+  try {
+    const res = await baseStore.getDictionaryData(code);
+    return Array.isArray(res) && res.length ? (res as TmsDicOpt[]) : fallback;
+  } catch {
+    return fallback;
+  }
+}

--
Gitblit v1.8.0