考试规则创建和编辑增加mapid字段

This commit is contained in:
Yuan 2022-10-28 16:19:39 +08:00
parent 8b47049f69
commit 5cc2dbde12
2 changed files with 20 additions and 8 deletions

View File

@ -1,6 +1,16 @@
<template>
<div class="exam-rule">
<el-form ref="form" :model="examData" :rules="rules" label-width="120px" class="demo-form">
<el-form-item label="关联线路" prop="mapId" required>
<el-select v-model="examData.mapId">
<el-option
v-for="option in mapOptionList"
:key="option.value"
:label="option.label"
:value="option.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('publish.testName')" prop="name">
<el-input v-model="examData.name" :maxlength="50" :placeholder="$t('publish.inputTestName')" />
</el-form-item>
@ -54,17 +64,12 @@
<el-form-item :label="$t('publish.passingScore')" prop="passScore">
<el-input-number v-model="examData.passScore" placeholder="" :min="1" />
</el-form-item>
<!-- <el-form-item v-if="!$route.path.includes('info')" :label="$t('publish.whetherToTry')" required>
<el-radio-group v-model="trial">
<el-radio label="1">{{ $t('publish.trialNo') }}</el-radio>
<el-radio label="2">{{ $t('publish.trialYes') }}</el-radio>
</el-radio-group>
</el-form-item> -->
</el-form>
</div>
</template>
<script>
import { queryMapListByUser } from '@/api/jmap/map'
export default {
name: 'ExamFrom',
props: {
@ -103,9 +108,10 @@ export default {
},
},
haveDate: false,
options: [],
mapOptionList: [],
selectDisable: false,
rules: {
mapId: [{ required: true, message: '请选择线路', trigger: 'blur' }],
name: [{ required: true, message: this.$t('publish.inputTestName'), trigger: 'blur' }],
validDuration: [{ required: true, message: this.$t('publish.inputTestDuration'), trigger: 'blur' }],
fullScore: [{ required: true, message: this.$t('publish.inputFullScore'), trigger: 'blur' }],
@ -122,7 +128,11 @@ export default {
return this.$route.params.mode === 'edit'
},
},
created() {},
created() {
queryMapListByUser().then(resp => {
this.mapOptionList = resp.data.map(item => ({ label: item.name, value: item.id }))
})
},
mounted() {},
methods: {
checkForm() {

View File

@ -56,6 +56,7 @@ export default {
validDuration: 30,
fullScore: 100,
passScore: 60,
mapId: '',
},
ruleList: [],
}
@ -78,6 +79,7 @@ export default {
if (this.isEditMode) {
getPaperDetail(this.$route.params.paperId).then(res => {
this.examData = {
mapId: res.data.mapId,
name: res.data.name,
profile: res.data.profile,
startTime: res.data.startTime,