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/course/Form.vue | 79 +++++++++++++++++++++++++++++++++------
1 files changed, 67 insertions(+), 12 deletions(-)
diff --git a/apps/jnpf-web-apps-main/src/views/x/tms/course/Form.vue b/apps/jnpf-web-apps-main/src/views/x/tms/course/Form.vue
index 2dc15ba..d9548b4 100644
--- a/apps/jnpf-web-apps-main/src/views/x/tms/course/Form.vue
+++ b/apps/jnpf-web-apps-main/src/views/x/tms/course/Form.vue
@@ -11,19 +11,20 @@
getCoursePaperOptions,
updateCourse,
} from '#/api/x/tms/course';
-
+import { useBaseStore } from '#/store';
import {
- CATEGORY_OPTIONS,
- ENABLE_OPTIONS,
- EVAL_MODE_OPTIONS,
- TRAIN_MODE_OPTIONS,
- evalModeNeedPaper,
-} from './constants';
+ TMS_DIC,
+ TMS_DIC_FIELD_NAMES,
+ loadTmsDic,
+} from '#/views/x/tms/shared/dic';
+
+import { evalModeNeedPaper } from './constants';
defineOptions({ name: 'TmsCourseForm' });
const emit = defineEmits(['register', 'reload']);
const { createMessage } = useMessage();
+const baseStore = useBaseStore();
const state = reactive({ id: '' });
const { id } = toRefs(state);
@@ -56,7 +57,8 @@
componentProps: {
allowClear: true,
placeholder: '璇烽�夋嫨',
- options: CATEGORY_OPTIONS,
+ options: [],
+ fieldNames: TMS_DIC_FIELD_NAMES,
},
},
{
@@ -66,7 +68,8 @@
componentProps: {
allowClear: true,
placeholder: '璇烽�夋嫨',
- options: TRAIN_MODE_OPTIONS,
+ options: [],
+ fieldNames: TMS_DIC_FIELD_NAMES,
},
},
{
@@ -76,7 +79,8 @@
componentProps: {
allowClear: true,
placeholder: '璇烽�夋嫨',
- options: EVAL_MODE_OPTIONS,
+ options: [],
+ fieldNames: TMS_DIC_FIELD_NAMES,
onChange: (val: string) => syncPaperRequired(val),
},
},
@@ -110,7 +114,11 @@
label: '鍚敤鐘舵��',
component: 'Select',
defaultValue: '1',
- componentProps: { placeholder: '璇烽�夋嫨', options: ENABLE_OPTIONS },
+ componentProps: {
+ placeholder: '璇烽�夋嫨',
+ options: [],
+ fieldNames: TMS_DIC_FIELD_NAMES,
+ },
rules: [{ required: true, message: '蹇呭~', trigger: 'change' }],
},
{
@@ -136,6 +144,53 @@
}
}
+async function loadDicOptions() {
+ const [category, trainMode, evalMode, enable] = await Promise.all([
+ loadTmsDic(baseStore, TMS_DIC.courseCategory),
+ loadTmsDic(baseStore, TMS_DIC.trainMode),
+ loadTmsDic(baseStore, TMS_DIC.evalMode),
+ loadTmsDic(baseStore, TMS_DIC.enableStatus),
+ ]);
+ updateSchema([
+ {
+ field: 'category',
+ componentProps: {
+ allowClear: true,
+ placeholder: '璇烽�夋嫨',
+ options: category,
+ fieldNames: TMS_DIC_FIELD_NAMES,
+ },
+ },
+ {
+ field: 'trainMode',
+ componentProps: {
+ allowClear: true,
+ placeholder: '璇烽�夋嫨',
+ options: trainMode,
+ fieldNames: TMS_DIC_FIELD_NAMES,
+ },
+ },
+ {
+ field: 'evalMode',
+ componentProps: {
+ allowClear: true,
+ placeholder: '璇烽�夋嫨',
+ options: evalMode,
+ fieldNames: TMS_DIC_FIELD_NAMES,
+ onChange: (val: string) => syncPaperRequired(val),
+ },
+ },
+ {
+ field: 'enabled',
+ componentProps: {
+ placeholder: '璇烽�夋嫨',
+ options: enable,
+ fieldNames: TMS_DIC_FIELD_NAMES,
+ },
+ },
+ ]);
+}
+
async function loadPaperOptions() {
const list = await getCoursePaperOptions();
updateSchema({
@@ -156,7 +211,7 @@
resetFields();
state.id = data?.id || '';
try {
- await loadPaperOptions();
+ await Promise.all([loadDicOptions(), loadPaperOptions()]);
if (state.id) {
const info = await getCourseInfo(state.id);
setFieldsValue(info);
--
Gitblit v1.8.0