考试管理分类修改
This commit is contained in:
parent
f8257cddfe
commit
d09e1042c0
@ -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
|
||||
})
|
||||
|
@ -37,7 +37,12 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="分类">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-for="tag in scope.row.tags" :key="tag">{{ tag }}</el-tag>
|
||||
<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">
|
||||
|
Loading…
Reference in New Issue
Block a user