考试管理分类修改

This commit is contained in:
Yuan 2022-10-28 16:00:37 +08:00
parent f8257cddfe
commit d09e1042c0
2 changed files with 16 additions and 6 deletions

View File

@ -32,7 +32,7 @@
></el-option>
</el-select>
</el-form-item>
<el-form-item label="分类" prop="tags" required>
<el-form-item label="分类" required>
<el-select v-model="form.tags" @change="getQuestionAmount">
<el-option
v-for="item in labels"
@ -112,12 +112,15 @@ export default {
message()
}
}
const tagsValidator = (rule, value, message) => {
message()
}
return {
form: {
id: '',
type: '',
subtype: '',
tags: '',
tags: '',
amount: 1,
score: 1,
},
@ -130,13 +133,13 @@ export default {
subtype: [{ required: true, message: '请选择规则类型', trigger: 'change' }],
amount: [{ required: true, validator: number, trigger: 'blur' }],
score: [{ required: true, validator: score, trigger: 'blur' }],
tags: [{ required: true, message: '请选择分类', trigger: 'blur' }],
tags: [{ validator: tagsValidator, trigger: 'blur' }],
},
}
},
created() {
getLabelList().then(resp => {
this.labels = [{ label: '无', value: '' }, ...resp.data.map(item => ({ label: item, value: item }))]
this.labels = [{ label: '无', value: '' }, ...resp.data.map(item => ({ label: item, value: item }))]
})
},
mounted() {},
@ -169,6 +172,8 @@ export default {
rule =>
rule.type === this.form.type &&
rule.subtype === this.form.subtype &&
rule.tags &&
this.form.tags &&
rule.tags.includes(this.form.tags)
)
return isDuplicated
@ -181,7 +186,7 @@ export default {
groupType: this.form.type,
subType: this.form.subtype,
}
if (this.form.tags !== '') param.tags = [this.form.tags]
if (this.form.tags !== '') param.tags = [this.form.tags]
getQuestionAmount(param).then(resp => {
this.topicNum = resp.data
})

View File

@ -37,8 +37,13 @@
</el-table-column>
<el-table-column label="分类">
<template slot-scope="scope">
<template v-if="scope.row.tags">
<el-tag v-for="tag in scope.row.tags" :key="tag">{{ tag }}</el-tag>
</template>
<template v-else>
<el-tag></el-tag>
</template>
</template>
</el-table-column>
<el-table-column :label="$t('global.operate')" width="100">
<template slot-scope="scope">