考试规则创建和编辑增加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> <template>
<div class="exam-rule"> <div class="exam-rule">
<el-form ref="form" :model="examData" :rules="rules" label-width="120px" class="demo-form"> <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-form-item :label="$t('publish.testName')" prop="name">
<el-input v-model="examData.name" :maxlength="50" :placeholder="$t('publish.inputTestName')" /> <el-input v-model="examData.name" :maxlength="50" :placeholder="$t('publish.inputTestName')" />
</el-form-item> </el-form-item>
@ -54,17 +64,12 @@
<el-form-item :label="$t('publish.passingScore')" prop="passScore"> <el-form-item :label="$t('publish.passingScore')" prop="passScore">
<el-input-number v-model="examData.passScore" placeholder="" :min="1" /> <el-input-number v-model="examData.passScore" placeholder="" :min="1" />
</el-form-item> </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> </el-form>
</div> </div>
</template> </template>
<script> <script>
import { queryMapListByUser } from '@/api/jmap/map'
export default { export default {
name: 'ExamFrom', name: 'ExamFrom',
props: { props: {
@ -103,9 +108,10 @@ export default {
}, },
}, },
haveDate: false, haveDate: false,
options: [], mapOptionList: [],
selectDisable: false, selectDisable: false,
rules: { rules: {
mapId: [{ required: true, message: '请选择线路', trigger: 'blur' }],
name: [{ required: true, message: this.$t('publish.inputTestName'), trigger: 'blur' }], name: [{ required: true, message: this.$t('publish.inputTestName'), trigger: 'blur' }],
validDuration: [{ required: true, message: this.$t('publish.inputTestDuration'), trigger: 'blur' }], validDuration: [{ required: true, message: this.$t('publish.inputTestDuration'), trigger: 'blur' }],
fullScore: [{ required: true, message: this.$t('publish.inputFullScore'), trigger: 'blur' }], fullScore: [{ required: true, message: this.$t('publish.inputFullScore'), trigger: 'blur' }],
@ -122,7 +128,11 @@ export default {
return this.$route.params.mode === 'edit' return this.$route.params.mode === 'edit'
}, },
}, },
created() {}, created() {
queryMapListByUser().then(resp => {
this.mapOptionList = resp.data.map(item => ({ label: item.name, value: item.id }))
})
},
mounted() {}, mounted() {},
methods: { methods: {
checkForm() { checkForm() {

View File

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