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/trainMode/Form.vue | 89 ++++++++++++++++++++++++++++++++++++++++----
1 files changed, 80 insertions(+), 9 deletions(-)
diff --git a/apps/jnpf-web-apps-main/src/views/x/tms/trainMode/Form.vue b/apps/jnpf-web-apps-main/src/views/x/tms/trainMode/Form.vue
index 990201f..9c6ab78 100644
--- a/apps/jnpf-web-apps-main/src/views/x/tms/trainMode/Form.vue
+++ b/apps/jnpf-web-apps-main/src/views/x/tms/trainMode/Form.vue
@@ -6,13 +6,14 @@
import { BasicModal, useModalInner } from '@jnpf/ui/modal';
import { createTrainMode, getTrainModeInfo, updateTrainMode } from '#/api/x/tms/trainMode';
-
-import { ENABLE_OPTIONS, SIGN_RULE_OPTIONS, YES_NO_OPTIONS } from './constants';
+import { useBaseStore } from '#/store';
+import { TMS_DIC, TMS_DIC_FIELD_NAMES, loadTmsDic } from '#/views/x/tms/shared/dic';
defineOptions({ name: 'TmsTrainModeForm' });
const emit = defineEmits(['register', 'reload']);
const { createMessage } = useMessage();
+const baseStore = useBaseStore();
const state = reactive({ id: '' });
const { id } = toRefs(state);
@@ -41,7 +42,11 @@
label: '绛惧埌瑙勫垯',
component: 'Select',
defaultValue: 'both',
- componentProps: { placeholder: '璇烽�夋嫨', options: SIGN_RULE_OPTIONS },
+ componentProps: {
+ placeholder: '璇烽�夋嫨',
+ options: [],
+ fieldNames: TMS_DIC_FIELD_NAMES,
+ },
rules: [{ required: true, message: '蹇呭~', trigger: 'change' }],
},
{
@@ -49,7 +54,11 @@
label: '鍏佽鍚嶅崟澶栫鍒�',
component: 'Select',
defaultValue: '0',
- componentProps: { placeholder: '璇烽�夋嫨', options: YES_NO_OPTIONS },
+ componentProps: {
+ placeholder: '璇烽�夋嫨',
+ options: [],
+ fieldNames: TMS_DIC_FIELD_NAMES,
+ },
rules: [{ required: true, message: '蹇呭~', trigger: 'change' }],
},
{
@@ -57,7 +66,11 @@
label: '璧锋椤诲悓涓�澶�',
component: 'Select',
defaultValue: '0',
- componentProps: { placeholder: '璇烽�夋嫨', options: YES_NO_OPTIONS },
+ componentProps: {
+ placeholder: '璇烽�夋嫨',
+ options: [],
+ fieldNames: TMS_DIC_FIELD_NAMES,
+ },
rules: [{ required: true, message: '蹇呭~', trigger: 'change' }],
},
{
@@ -65,7 +78,11 @@
label: '鍦扮偣蹇呭~',
component: 'Select',
defaultValue: '1',
- componentProps: { placeholder: '璇烽�夋嫨', options: YES_NO_OPTIONS },
+ componentProps: {
+ placeholder: '璇烽�夋嫨',
+ options: [],
+ fieldNames: TMS_DIC_FIELD_NAMES,
+ },
rules: [{ required: true, message: '蹇呭~', trigger: 'change' }],
},
{
@@ -80,7 +97,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' }],
},
{
@@ -93,6 +114,56 @@
});
const [registerModal, { closeModal, changeLoading, changeOkLoading }] = useModalInner(init);
+
+async function loadDicOptions() {
+ const [signRule, yesNo, enable] = await Promise.all([
+ loadTmsDic(baseStore, TMS_DIC.signRule),
+ loadTmsDic(baseStore, TMS_DIC.yesNo),
+ loadTmsDic(baseStore, TMS_DIC.enableStatus),
+ ]);
+ updateSchema([
+ {
+ field: 'signRule',
+ componentProps: {
+ placeholder: '璇烽�夋嫨',
+ options: signRule,
+ fieldNames: TMS_DIC_FIELD_NAMES,
+ },
+ },
+ {
+ field: 'allowGuestSign',
+ componentProps: {
+ placeholder: '璇烽�夋嫨',
+ options: yesNo,
+ fieldNames: TMS_DIC_FIELD_NAMES,
+ },
+ },
+ {
+ field: 'sameDayRequired',
+ componentProps: {
+ placeholder: '璇烽�夋嫨',
+ options: yesNo,
+ fieldNames: TMS_DIC_FIELD_NAMES,
+ },
+ },
+ {
+ field: 'placeRequired',
+ componentProps: {
+ placeholder: '璇烽�夋嫨',
+ options: yesNo,
+ fieldNames: TMS_DIC_FIELD_NAMES,
+ },
+ },
+ {
+ field: 'enabled',
+ componentProps: {
+ placeholder: '璇烽�夋嫨',
+ options: enable,
+ fieldNames: TMS_DIC_FIELD_NAMES,
+ },
+ },
+ ]);
+}
async function init(data: { id?: string }) {
changeLoading(true);
@@ -108,9 +179,9 @@
},
});
try {
+ await loadDicOptions();
if (state.id) {
- const info = await getTrainModeInfo(state.id);
- setFieldsValue(info);
+ setFieldsValue(await getTrainModeInfo(state.id));
}
} finally {
changeLoading(false);
--
Gitblit v1.8.0