组卷策略问题未解决
This commit is contained in:
parent
1e1970327b
commit
dcad25334b
|
@ -35,13 +35,7 @@
|
||||||
</a-row>
|
</a-row>
|
||||||
|
|
||||||
<a-card :bordered="false" title="组卷策略详情">
|
<a-card :bordered="false" title="组卷策略详情">
|
||||||
<a-table
|
<a-table :columns="columns" :data-source="tableData" bordered :position="{ disabled: false }" :pagination="false">
|
||||||
:columns="columns"
|
|
||||||
:data-source="tableData"
|
|
||||||
bordered
|
|
||||||
:position="{ disabled: false }"
|
|
||||||
:pagination="false"
|
|
||||||
>
|
|
||||||
<template slot="topicNum" slot-scope="text, record">
|
<template slot="topicNum" slot-scope="text, record">
|
||||||
<a-input-number style="margin: -5px 0" v-model="record.topicNum" :min="0" :max="record.totalNum" />
|
<a-input-number style="margin: -5px 0" v-model="record.topicNum" :min="0" :max="record.totalNum" />
|
||||||
</template>
|
</template>
|
||||||
|
@ -49,10 +43,10 @@
|
||||||
<a-input-number style="margin: -5px 0" v-model="record.topicScore" :min="0" />
|
<a-input-number style="margin: -5px 0" v-model="record.topicScore" :min="0" />
|
||||||
</template>
|
</template>
|
||||||
<template slot="totalScore" slot-scope="text, record">
|
<template slot="totalScore" slot-scope="text, record">
|
||||||
<p>{{ record.topicScore }}</p>
|
<p>{{record.topicScore}}</p>
|
||||||
</template>
|
</template>
|
||||||
<template slot="footer" :style="{ float: 'left' }">
|
<template slot="footer" :style="{ float:'left' }">
|
||||||
<p class="right">总分数:{{ form.totalScore }} 分</p>
|
<p class="right">总分数:{{form.totalScore}} 分</p>
|
||||||
</template>
|
</template>
|
||||||
</a-table>
|
</a-table>
|
||||||
</a-card>
|
</a-card>
|
||||||
|
@ -75,8 +69,8 @@ export default {
|
||||||
components: {},
|
components: {},
|
||||||
props: {
|
props: {
|
||||||
projectForm: {
|
projectForm: {
|
||||||
type: Object
|
type: Object,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
// 这里存放数据
|
// 这里存放数据
|
||||||
|
@ -91,7 +85,7 @@ export default {
|
||||||
projectName: [{ required: true, message: '请输入项目名称', trigger: 'blur' }],
|
projectName: [{ required: true, message: '请输入项目名称', trigger: 'blur' }],
|
||||||
trainClass: [{ required: true, message: '请选择培训分类', trigger: 'blur' }],
|
trainClass: [{ required: true, message: '请选择培训分类', trigger: 'blur' }],
|
||||||
projectName: [{ required: true, message: '请输入项目名称', trigger: 'blur' }],
|
projectName: [{ required: true, message: '请输入项目名称', trigger: 'blur' }],
|
||||||
trainClass: [{ required: true, message: '请选择培训分类', trigger: 'blur' }]
|
trainClass: [{ required: true, message: '请选择培训分类', trigger: 'blur' }],
|
||||||
},
|
},
|
||||||
columns: [
|
columns: [
|
||||||
{ title: '序号', key: 'i', dataIndex: 'i', width: 70, scopedSlots: { customRender: 'serial' } },
|
{ title: '序号', key: 'i', dataIndex: 'i', width: 70, scopedSlots: { customRender: 'serial' } },
|
||||||
|
@ -105,7 +99,7 @@ export default {
|
||||||
if (text == 3) return '判断题'
|
if (text == 3) return '判断题'
|
||||||
if (text == 4) return '简答题'
|
if (text == 4) return '简答题'
|
||||||
if (text == 5) return '填空题'
|
if (text == 5) return '填空题'
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{ title: '总题量', dataIndex: 'totalNum', key: 'totalNum' },
|
{ title: '总题量', dataIndex: 'totalNum', key: 'totalNum' },
|
||||||
{
|
{
|
||||||
|
@ -113,55 +107,54 @@ export default {
|
||||||
dataIndex: 'topicNum',
|
dataIndex: 'topicNum',
|
||||||
width: 100,
|
width: 100,
|
||||||
key: 'topicNum',
|
key: 'topicNum',
|
||||||
scopedSlots: { customRender: 'topicNum' }
|
scopedSlots: { customRender: 'topicNum' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '单题分值',
|
title: '单题分值',
|
||||||
dataIndex: 'topicScore',
|
dataIndex: 'topicScore',
|
||||||
width: 100,
|
width: 100,
|
||||||
key: 'topicScore',
|
key: 'topicScore',
|
||||||
scopedSlots: { customRender: 'topicScore' }
|
scopedSlots: { customRender: 'topicScore' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '总分',
|
title: '总分',
|
||||||
dataIndex: 'totalScore',
|
dataIndex: 'totalScore',
|
||||||
key: 'total',
|
|
||||||
customRender: (value, row, index) => {
|
customRender: (value, row, index) => {
|
||||||
if (!row.topicNum || !row.topicScore) return ''
|
if (!row.topicNum || !row.topicScore) return '';
|
||||||
return row.topicNum * row.topicScore + '分'
|
return (row.topicNum * row.topicScore) + '分'
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
tableData: [],
|
tableData: [],
|
||||||
totalScore: 0
|
totalScore: 0,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 计算属性 类似于data概念
|
// 计算属性 类似于data概念
|
||||||
computed: {},
|
computed: {},
|
||||||
// 监控data中的数据变化
|
// 监控data中的数据变化
|
||||||
watch: {
|
watch: {
|
||||||
tableData: function() {
|
tableData: function () {
|
||||||
let sum = 0
|
let sum = 0;
|
||||||
this.tableData.forEach(element => {
|
this.tableData.forEach(element => {
|
||||||
if (element.totalScore) {
|
if(element.totalScore){
|
||||||
console.log('单条总分数', element.totalScore)
|
console.log('单条总分数',element.totalScore)
|
||||||
sum = sum + element.totalScore
|
sum = sum + element.totalScore;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
this.form.totalScore = sum
|
this.form.totalScore = sum;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 方法集合
|
// 方法集合
|
||||||
methods: {
|
methods: {
|
||||||
//保存
|
//保存
|
||||||
toSave() {
|
toSave() {
|
||||||
this.form.testPaperTactics = { ...this.tableData }
|
this.form.testPaperTactics = this.tableData;
|
||||||
this.form.projectStatus = 1
|
this.form.projectStatus = 1
|
||||||
this.$emit('executeSave', this.form)
|
this.$emit('executeSave', this.form)
|
||||||
},
|
},
|
||||||
//发布
|
//发布
|
||||||
toIssue() {
|
toIssue() {
|
||||||
this.form.testPaperTactics = { ...this.tableData }
|
this.form.testPaperTactics = this.tableData;
|
||||||
this.form.projectStatus = 2
|
this.form.projectStatus = 2
|
||||||
this.$emit('executeIssue', this.form)
|
this.$emit('executeIssue', this.form)
|
||||||
},
|
},
|
||||||
|
@ -170,18 +163,17 @@ export default {
|
||||||
this.$emit('prevStep', this.form)
|
this.$emit('prevStep', this.form)
|
||||||
},
|
},
|
||||||
initTable() {
|
initTable() {
|
||||||
let ids = this.form.lessonIds.map(t => {
|
let ids = this.form.lessonIds.map((t) => {
|
||||||
return parseInt(t.ids)
|
return parseInt(t.ids);
|
||||||
})
|
})
|
||||||
getQuestionNumByCourseIds({ ids: ids }).then(res => {
|
getQuestionNumByCourseIds({ ids: ids }).then((res) => {
|
||||||
this.tableData = res.data
|
this.tableData = res.data
|
||||||
if (this.tableData && this.form.testPaperTactics) {
|
if(this.tableData && this.form.testPaperTactics){
|
||||||
this.tableData.forEach((t1, t1Index) => {
|
this.tableData.forEach(t1 => {
|
||||||
this.form.testPaperTactics.forEach(t2 => {
|
this.form.testPaperTactics.forEach(t2 => {
|
||||||
if (t1.topicType === t2.topicType) {
|
if(t1.topicType === t2.topicType){
|
||||||
this.$set(this.tableData[t1Index], 'topicNum', t2.topicNum)
|
t1.topicNum = t2.topicNum
|
||||||
this.$set(this.tableData[t1Index], 'topicScore', t2.topicScore)
|
t1.topicScore = t2.topicScore
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -191,24 +183,24 @@ export default {
|
||||||
},
|
},
|
||||||
// 生命周期 - 创建完成(可以访问当前this实例)
|
// 生命周期 - 创建完成(可以访问当前this实例)
|
||||||
created() {
|
created() {
|
||||||
this.initTable()
|
this.initTable();
|
||||||
},
|
},
|
||||||
// 生命周期 - 挂载完成(可以访问DOM元素)
|
// 生命周期 - 挂载完成(可以访问DOM元素)
|
||||||
mounted() {},
|
mounted() { },
|
||||||
// 生命周期 - 创建之前
|
// 生命周期 - 创建之前
|
||||||
beforeCreate() {},
|
beforeCreate() { },
|
||||||
// 生命周期 - 挂载之前
|
// 生命周期 - 挂载之前
|
||||||
beforeMount() {},
|
beforeMount() { },
|
||||||
// 生命周期 - 更新之前
|
// 生命周期 - 更新之前
|
||||||
beforeUpdate() {},
|
beforeUpdate() { },
|
||||||
// 生命周期 - 更新之后
|
// 生命周期 - 更新之后
|
||||||
updated() {},
|
updated() { },
|
||||||
// 生命周期 - 销毁之前
|
// 生命周期 - 销毁之前
|
||||||
beforeDestroy() {},
|
beforeDestroy() { },
|
||||||
// 生命周期 - 销毁完成
|
// 生命周期 - 销毁完成
|
||||||
destroyed() {},
|
destroyed() { },
|
||||||
// 如果页面有keep-alive缓存功能,这个函数会触发
|
// 如果页面有keep-alive缓存功能,这个函数会触发
|
||||||
activated() {}
|
activated() {},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
@ -217,4 +209,4 @@ export default {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
Loading…
Reference in New Issue