odc.xiaohui
2023-06-15 4e43f5b3a19db9af5015e0200c9590c8aba3b9ed
src/views/exam/question/list.vue
@@ -36,7 +36,13 @@
    </el-form>
    <el-table v-loading="listLoading" :data="tableData" border fit highlight-current-row style="width: 100%">
      <el-table-column prop="id" label="Id" width="90px"/>
      <el-table-column prop="subjectId" label="课目" :formatter="subjectFormatter" width="120px"/>
      <el-table-column prop="subjectId" label="课目" :formatter="subjectIdFormatte" width="120px"/>
<!--      <el-table-column prop="subjectId" label="课目">-->
<!--        <template slot-scope="scope">-->
<!--&lt;!&ndash;          <span>{{this.subjectIdFormatte}}</span>&ndash;&gt;-->
<!--          <span>{{scope.row.questionSubjects.forEach(item=>{ return item.subName})}}</span>-->
<!--        </template>-->
<!--      </el-table-column>-->
      <el-table-column prop="questionType" label="题型" :formatter="questionTypeFormatter" width="70px"/>
      <el-table-column prop="shortTitle" label="题干" show-overflow-tooltip/>
      <el-table-column prop="score" label="分数" width="60px"/>
@@ -142,6 +148,14 @@
    questionTypeFormatter (row, column, cellValue, index) {
      return this.enumFormat(this.questionType, cellValue)
    },
    subjectIdFormatte(row, column, cellValue, index){
      console.log(row, column, cellValue, index)
      let str = ''
      row.questionSubjects.forEach(item=>{
        str+=item.subName+','
      })
      return str = str.slice(0,str.length-1)
    },
    subjectFormatter (row, column, cellValue, index) {
      return this.subjectEnumFormat(cellValue)
    },