feat(training): 培训模块改造!
This commit is contained in:
1 parent
57652ae581
commit
5f713f2c0c
11 files changed
+226
-51
No files matched your search
@@ -242,7 +242,7 @@ const saveType = async () => {
|
||||
'新人培训': 'onboarding',
|
||||
'安全培训': 'safety',
|
||||
} as Record<string, string>)[rawType] || rawType.toLowerCase();
|
||||
if (!['onboarding', 'safety'].includes(typeForm.value.training_type) || !typeForm.value.name.trim()) {
|
||||
if (!/^[a-z][a-z0-9_-]*$/.test(typeForm.value.training_type) || !typeForm.value.name.trim()) {
|
||||
msg.warning(t('admin.trainingConfig.messages.typeRequired'));
|
||||
return;
|
||||
}
|
||||
|
||||
+14
-4
@@ -1,4 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* features/admin/modules/training-config/components/TrainingTypeFormModal.vue
|
||||
* 用途:提供培训类型 code 与名称的新增、编辑弹窗。
|
||||
* 依赖:vue-i18n 与父级培训配置页面的表单状态。
|
||||
* 逻辑:允许管理员输入符合编码规范的自定义类型 code,并将保存动作交由父级处理。
|
||||
*/
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -21,10 +27,14 @@ const { t } = useI18n();
|
||||
<div class="px-5 sm:px-8 py-5 space-y-4 overflow-y-auto">
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.trainingConfig.fields.type') }}</label>
|
||||
<select v-model="props.form.training_type" class="select-field text-sm">
|
||||
<option value="onboarding">{{ t('chat.training.safety.tabs.onboarding') }}</option>
|
||||
<option value="safety">{{ t('chat.training.safety.tabs.safety') }}</option>
|
||||
</select>
|
||||
<input
|
||||
v-model="props.form.training_type"
|
||||
type="text"
|
||||
class="input-field text-sm"
|
||||
maxlength="50"
|
||||
pattern="[a-z][a-z0-9_-]*"
|
||||
:placeholder="t('admin.trainingConfig.placeholders.typeCode')"
|
||||
/>
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.trainingConfig.fields.name') }}</label>
|
||||
|
||||
Reference in new issue
Block a user